-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored data sources and identifiers involving people.
Fixes #85 and parts of #79. Separates out the concept of a company member and any other person. Assigns a local identifier if a web_id is not provided, so every person has a unique and stable identifier. Updates relevant filters for greater clarity and to these identifiers. Populates web_id during preprocessing as an item attribute rather than providing a function to dynamically assemble during buildtime. Provides a new data source for people.
- Loading branch information
Showing
21 changed files
with
295 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
- name: Sarven Capadisli | ||
web_id: https://csarven.ca/#i | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'active_support/core_ext/hash/keys' | ||
require 'active_support/core_ext/string/inflections' | ||
require 'digest' | ||
|
||
Class.new(Nanoc::DataSource) do | ||
identifier :people | ||
|
||
def up | ||
@people = YAML.load_file(@config[:people_data]).map(&:symbolize_keys) | ||
end | ||
|
||
def items | ||
@people.map do |person| | ||
person_to_item(person) | ||
end | ||
end | ||
|
||
protected | ||
|
||
def person_to_item(person) | ||
slug = person[:name].parameterize | ||
|
||
attributes = { | ||
kind: 'person', | ||
slug: slug, | ||
mtime: mtime_of(@config[:people_data]), | ||
is_hidden: true, | ||
} | ||
|
||
new_item( | ||
person[:name], | ||
attributes.merge(person), | ||
Nanoc::Identifier.new("/people/_#{slug}"), | ||
attributes_checksum_data: Digest::SHA1.digest(Marshal.dump(person)), | ||
) | ||
end | ||
|
||
def mtime_of(meta_filename) | ||
File.stat(meta_filename).mtime | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.