Skip to content

Commit

Permalink
A lot of messy changes dealing with issues #50, #86, and #99.
Browse files Browse the repository at this point in the history
Overhauled company data source to simplify and better handle x509
certificates.
Restructured Nanoc identifiers to be simpler and more consistent.
Clarified requirement and creation of the web_id attribute.
Simplified helpers by moving some (NOT YET ALL) item creation code to
Nanoc data sources (#86).
Restructured relevant text helpers to directly extend String class.
Remove spurious text helper methods that were already provided by
activesupport.
Remove the to_slug helper method.
Updated many hard-coded item identifier references to use site config.
Introduced WIP personal profile pages, replacing author pages.
Updated account_service_item render call on the company page, missed in
8dbe352
Updated rules to use the new identifiers.
  • Loading branch information
cdchapman committed Dec 15, 2019
1 parent 8dbe352 commit ff02d2e
Show file tree
Hide file tree
Showing 36 changed files with 652 additions and 297 deletions.
3 changes: 1 addition & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ require: rubocop-rspec

Naming/FileName:
Exclude:
# We use command files such as "update-company-data.rb" that translate
# into method names.
# We use a naming convention that translates into Nanoc API method names.
- 'commands/*.rb'
- 'Rules.rb'

Expand Down
33 changes: 23 additions & 10 deletions METADATA.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,29 +460,37 @@ Specifies personal titles for a person, e.g. "Frau", "Dr.", "Herr",

RECOMMENDED_FOR_KINDS: `member`

A list of public keys of user certificates. Constructed as an array containing
`Hash` objects with the following keys, each representing an x509 public key.
This array could be empty if the member has no user certificates.
A list of public keys extracted from user certificates. Constructed as an array
containing `Hash` objects with the following keys, each representing an x509
public key.

This array could be empty if the member has no valid user certificates.

#### `id`

The URI subject alternative name definitively bound to the public key. The `id`
of the first element of the [`pkey`](#pkey) is used as the value of the user's
[`web_id`](#web_id) attribute.

#### `modulus`

The modulus (n) of the RSA public key.
The modulus (n) of the RSA public key, as a hex binary string.

#### `exponent`

The publicExponent (e) of the RSA public key.
The publicExponent (e) of the RSA public key, as an integer.

#### `md5`

The MD5 digest of the DER-encoded RSA public key.
The MD5 digest identifier of the DER-encoded RSA public key.

#### `sha1`

The SHA1 digest of the DER-encoded RSA public key.
The SHA1 digest identifier of the DER-encoded RSA public key.

#### `sha256`

The SHA256 digest of the DER-encoded RSA public key.
The SHA256 digest identifier of the DER-encoded RSA public key.

### `postalcode`

Expand Down Expand Up @@ -583,9 +591,14 @@ RECOMMENDED_FOR_KINDS: `person`, `member`

The title of a person in their organizational context.

### [`web_id`]
### `web_id`

REQUIRED_FOR_KINDS: `person`, `member`

The [WebID] of the person, if the person has one.
The [WebID] of the person, or local Web identifier if not known. For members
with user certificates, the value is from the URI subject alternative name
[`id` value](#id) of [the x509 certificate](#pkey). For other people, the
attibute is added directly to the [people.yaml](var/people.yaml) file.

### [`hashtag`]

Expand Down
1 change: 0 additions & 1 deletion Rules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# Things to ignore globally
ignore '/**/_*'
ignore '/_*/**/*'
ignore '/lifepreserver/**/*'
ignore '/**/README.md'
ignore '/**/LICENSE'

Expand Down
2 changes: 1 addition & 1 deletion items/location/redirections.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ location = <%= path_to(linked_data).sub(/\.ttl$/, '') %> {
# Content negotiation for personal profile pages
###

<% @items.find_all("#{@config[:static_root]}#{@config[:people_root]}/*/index.*").each do |profile| %>
<% @items.find_all(File.join(@config[:company_root], @config[:people_root], '*')).each do |profile| %>
location <%= path_to(profile) %> {
add_header Vary $vary_header;
add_header Cache-Control $cache_control;
Expand Down
2 changes: 1 addition & 1 deletion items/static/assets/stylesheets/partials/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ main {
}
}

.teammember {
.vcard {
.photo {
margin-bottom: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion items/static/authors/chris-chapman.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Posts by Chris Chapman
kind: redirect
redirect_to_id: '/static/people/chris-chapman/index.*'
redirect_to_id: '/company/people/chris-chapman'
---
2 changes: 1 addition & 1 deletion items/static/authors/katie-chapman.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Posts by Katie Chapman
kind: redirect
redirect_to_id: '/static/people/katie-chapman/index.*'
redirect_to_id: '/company/people/katie-chapman'
---
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: essay
author_name: Chris Chapman
created_at: 2017-05-11
updated_at: 2017-07-19
part_of_id: '/static/blog/posts/defining-the-scholarly-commons/index.*'
part_of_id: '/static/blog/posts/defining-the-scholarly-commons/index.md'
tags:
- Scholarly Commons
- Technology
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: essay
author_name: Chris Chapman
created_at: 2017-04-20
updated_at: 2017-08-14
part_of_id: '/static/blog/posts/defining-the-scholarly-commons/index.*'
part_of_id: '/static/blog/posts/defining-the-scholarly-commons/index.md'
tags:
- Scholarly Commons
- Holism
Expand Down
4 changes: 2 additions & 2 deletions items/static/company/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ priority: 0.6
</div>
</div>
<figure class="aside section img" id="vcard">
<a href="<%= path_to(@items['/company/_pentandra'], rep: :vcard) %>" title="Click to download our vCard">
<img src="<%= path_to(@items['/company/_pentandra'], rep: :qrcode) %>" alt="machine-readable QR code with embedded vCard for Pentandra Research Solutions" />
<a href="<%= path_to(@items['/company/organizations/pentandra'], rep: :vcard) %>" title="Click to download our vCard">
<img src="<%= path_to(@items['/company/organizations/pentandra'], rep: :qrcode) %>" alt="machine-readable QR code with embedded vCard for Pentandra Research Solutions" />
</a>
<figcaption class="bold">Our vCard</figcaption>
</figure>
Expand Down
38 changes: 38 additions & 0 deletions items/static/people.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: People
description: People somehow connected to Pentandra.
---

<div class="group">

<h1>People</h1>

<div class="bd">

<p class="big">

Here are listed people that have some sort of connection to our work or
that we have mentioned in our writings. Think of this as an index of
people at the back of a book. Mentioning does not imply endorsement in
either direction.

</p>

<p class="bigger">

If you're only looking for members of our company, please check out
<%= link_to('our company roster',
@items['/static/company/index.*'],
fragment: 'our-roster') %>.

</p>

</div>

</div>

<div class="loud noted section" resource="pentandra:related-people" typeof="foaf:Group">
<% sorted_members.each_with_index do |person, index| %>
<%= render('/partials/personcard.*', person: person, index: index) %>
<% end %>
</div>
12 changes: 0 additions & 12 deletions layouts/blog/author.erb

This file was deleted.

8 changes: 4 additions & 4 deletions layouts/blog/tag.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<% if tag[:semantic] %>
<div class="bd">
<p class="big">

The <span class="tags"><%= link_for_tag(tag) %></span> tag represents the concept <a href="<%= tag[:uri] %>" title="<%= tag[:label] %> on DBpedia"><cite><%=h tag[:label].downcase %></cite></a>, which is described as follows:

</p>
<% filter(:old_style_figures, type: :html) do %>
<% filter(:abbreviate, type: :html) do %>
<figure id="<%= tag[:tag].to_slug %>" class="bq rev" resource="#<%= tag[:tag].to_slug %>" typeof="schema:CreativeWork">
<figure id="<%= tag[:tag].parameterize %>" class="bq rev" resource="#<%= tag[:tag].parameterize %>" typeof="schema:CreativeWork">
<blockquote property="schema:text" cite="<%= tag[:uri] %>"><%=h parse_abstract(tag[:abstract]) %></blockquote>
<figcaption>--- <a property="dc:title" rel="cc:attributionURL prov:wasDerivedFrom" href="<%= tag[:primaryTopicOf] %>"><cite><%=h tag[:label] %></cite> on <b property="cc:attributionName">Wikipedia</b></a>, licensed under a <a property="cc:license" href="http://creativecommons.org/licenses/by-sa/3.0/"><abbr title="Creative Commons Attribution-ShareAlike 3.0 Unported" >CC-BY-SA</abbr> license</a>. <span class="small"><span class="icon-cc"></span><span class="icon-cc-by"></span><span class="icon-cc-sa"></span></span></figcaption>
</figure>
Expand All @@ -23,7 +23,7 @@
</div>

<% tagged_items = items_with_tag(tag, published_weblog) %>
<div property="schema:hasPart" resource="pentandra-website:items-tagged-<%= tag[:tag].to_slug %>" typeof="schema:ItemList">
<div property="schema:hasPart" resource="pentandra-website:items-tagged-<%= tag[:tag].parameterize %>" typeof="schema:ItemList">
<link property="schema:itemListOrder" resource="schema:itemListOrderDescending" />
<meta property="schema:numberOfItems" content="<%= tagged_items.length %>" datatype="schema:Integer" />
<% tagged_items.each_with_index do |tagged, index| %>
Expand Down
4 changes: 2 additions & 2 deletions layouts/personal_feed.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<% member = member_by_name(@member_name) %>
<%= atom_feed(alternate_url: path_to_profile_page(member, absolute: true),
author_name: member[:name],
author_name: @member_name,
author_uri: member[:web_id],
icon: path_to(member, rep: :photo),
entries: posts_by_author(member[:name]),
content_proc: ->(post) { post.compiled_content(rep: :feed_entry) },
excerpt_proc: ->(post) { post_summary(post.reps.fetch(:feed_entry)) },
limit: 10)
limit: @limit || 10)
%>
72 changes: 72 additions & 0 deletions layouts/personal_profile.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<link about="" typeof="foaf:PersonalProfileDocument" />
<article property="foaf:maker foaf:primaryTopic" typeof="foaf:Person" resource="<%= @item.fetch(:web_id) %>">
<%# Ideas for this page
phone number link
personal about me stuff
favorite drink
rss feeds
pgp keys
interests, personal drivers, goals
longer description
CV/resume?
roles in other organizations
links to social media profiles and other sites or webid profiles
nicknames?
preferred time zone, language
%>
<div class="section">
<header>
<h1 class="flush"><span property="rdfs:label schema:name foaf:name"><%= @item[:name] %></span></h1>
</header>

<div class="bd">
<p class="big"><%= @item.fetch(:description) %></p>

<dl>
<dt>Title</dt>
<dd><%= @item.fetch(:title) %></dd>
<dt>WebID</dt>
<dd><a href="<%= @item.fetch(:web_id) %>" class="uri"><%= @item.fetch(:web_id) %></a></dd>
</dl>

<% if @item.key?(:pkey) %>
<div id="pkey" prefix="<%= prefix_mappings_for(:cert, :xsd) %>">
<% @item[:pkey].each do |pkey| %>
<div id="pkey_<%= pkey.fetch(:sha1)[0..8] %>" property="cert:key" typeof="cert:RSAPublicKey">
WebID SHA1 fingerprint: <pre class="small"><samp class="identifier"><%= pkey.fetch(:sha1).upcase.scan(/../).join(':') %></samp></pre>
<span property="cert:modulus" datatype="xsd:hexBinary" content="<%= pkey.fetch(:modulus) %>"></span>
<span property="cert:exponent" datatype="xsd:nonNegativeInteger" content="<%= pkey.fetch(:exponent) %>"></span>
</div>
<% end %>
</div>
<% end %>

<img src="<%# path_to(@item, rep: :fpr_qrcode) %>" />

</div>

<aside class="aside">
<figure id="photo">
<img class="photo framed" src="<%= path_to(@item, rep: :photo) %>" alt="Photo of <%= @item[:name] %>" property="schema:image foaf:img" />
</figure>

<figure class="aside section img" id="vcard">
<a href="<%= path_to(@item, rep: :vcard) %>" title="Click to download my vCard">
<img src="<%= path_to(@item, rep: :qrcode) %>" alt="machine-readable QR code with embedded vCard for <%= @item[:name] %>" />
</a>
<figcaption class="bold">My vCard</figcaption>
</figure>
</aside>

</div>

<% author_posts = posts_by_author(@item[:name], published_weblog) %>
<section id="my-posts" class="noted group" property="schema:hasPart" resource="pentandra-blog:posts_by_<%= @item[:name].parameterize(separator: '_') %>" typeof="schema:ItemList">
<h2>My blog posts</h2>
<link property="schema:itemListOrder" resource="schema:itemListOrderDescending" />
<meta property="schema:numberOfItems" content="<%= h author_posts.length %>" datatype="schema:Integer" />
<% author_posts.each_with_index do |post, index| %>
<%= render('/blog/partials/summary.*', item: post, position: index + 1) %>
<% end %>
</section>
</article>
Loading

0 comments on commit ff02d2e

Please sign in to comment.