jekyll-theme-isotc211-helpers 0.4.9 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b77dd5b596a1a94b89e1decfca8be4d5a28f0f906ac05ad4f61fbe438197dac0
4
- data.tar.gz: c3ba656da24b3e34184cfc9f1b20cc02373543aed580e668701ad13b9f1566dd
3
+ metadata.gz: 90089bacda6bd7dc778a45f132e8efb24a08134d9e427dd586f1a136ba270395
4
+ data.tar.gz: a5e03e1f20684dcbb0d32f701a477082ff7e05bf4775e1f36382ca07429428c2
5
5
  SHA512:
6
- metadata.gz: 6151f0976c7309442e354699f195a0901bd541b79821e53c834ddeb127c2e3d8b03466b62da063c7f3a969c943e48d67fadb02c88d10112d02ddf43f3d7c5eac
7
- data.tar.gz: 69cee40ad8cc1e51add6f81e84b02fa29d41efcaea5b615457af270fff1db9c3b3d41e4a54ac9e395f76030af4d1d031a91b1e0758956919cf05862ad5cea522
6
+ metadata.gz: 7a02448d766555f640551334768c44b8428d593075a559597fbd15a9abf29e2f201f15b8e4552d22975749fc8616d27920e2110c1e8a37b3870507c235321730
7
+ data.tar.gz: f3ad66549b2f6630919ad228d43afcb391ff9c8fa6383e29010362a1bc81a0bffeef9435ede6801ef2f4976aea2af5b716a8b969e8b2bf69a19d60d2261fa467
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # ISO TC 211 theme helpers
1
+ # ISO/TC 211 theme helpers
2
2
 
3
- Jekyll plugin for the ISO TC 211 gem-based Jekyll theme by Ribose.
3
+ Jekyll plugin for the ISO/TC 211 gem-based Jekyll theme by Ribose.
4
4
 
5
5
  It provides the data reading and page generation capabilities
6
6
  required by the theme.
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'jekyll-theme-isotc211-helpers'
5
- s.version = '0.4.9'
5
+ s.version = '0.5.0'
6
6
  s.authors = ['Ribose Inc.']
7
7
  s.email = ['open.source@ribose.com']
8
8
 
9
- s.summary = 'Helpers for the ISO TC 211 Jekyll theme'
9
+ s.summary = 'Helpers for the ISO/TC 211 Jekyll theme'
10
10
  s.homepage = 'https://github.com/riboseinc/jekyll-theme-isotc211-helpers/'
11
11
  s.license = 'MIT'
12
12
 
@@ -2,6 +2,15 @@ require 'pathname'
2
2
 
3
3
  module Jekyll
4
4
 
5
+ class ResourceReader < Generator
6
+ safe true
7
+ priority :high
8
+
9
+ def generate(site)
10
+ site.generate_resource_pages
11
+ end
12
+ end
13
+
5
14
  class ResourceListingPage < Page
6
15
  def initialize(site, base_dir, url, layout, header, resources)
7
16
  @site = site
@@ -20,7 +29,7 @@ module Jekyll
20
29
  end
21
30
 
22
31
  class ResourcePage < Page
23
- def initialize(site, base_dir, index_url, index_label, layout, id, label, meta, contents)
32
+ def initialize(site, base_dir, index_url, index_label, layout, id, label, contents_tree)
24
33
  @site = site
25
34
  @base = base_dir
26
35
  @dir = File.join(index_url, id)
@@ -33,8 +42,7 @@ module Jekyll
33
42
  'title' => "#{label.capitalize} #{id}",
34
43
  'parent_title' => index_label,
35
44
  'parent_link' => "/#{index_url}",
36
- 'meta' => { "id" => id },
37
- 'contents' => contents,
45
+ 'contents' => contents_tree,
38
46
  }
39
47
  end
40
48
  end
@@ -53,7 +61,7 @@ module Jekyll
53
61
  resources)
54
62
  end
55
63
 
56
- def write_resource_page(listing_id, resource_id, contents)
64
+ def write_resource_page(listing_id, resource_id, contents_tree)
57
65
  cfg = self.config['resource_listings'][listing_id]
58
66
 
59
67
  self.pages << ResourcePage.new(
@@ -64,8 +72,7 @@ module Jekyll
64
72
  cfg['resource_layout'],
65
73
  resource_id,
66
74
  cfg['resource_label'],
67
- {},
68
- contents)
75
+ contents_tree)
69
76
  end
70
77
 
71
78
  def read_resource_contents(dir, id, listing_id)
@@ -73,7 +80,7 @@ module Jekyll
73
80
  return directory_hash(dir, "#{cfg['resource_label'].capitalize} #{id}")
74
81
  end
75
82
 
76
- def read_resources
83
+ def generate_resource_pages
77
84
  if self.config.key?('resource_listings')
78
85
 
79
86
  self.config['resource_listings'].each do |listing_id, cfg|
@@ -85,8 +92,9 @@ module Jekyll
85
92
  # Ignore dot-directories
86
93
  next
87
94
  end
95
+
88
96
  id = basename
89
- resources[id] = {}
97
+ resources[id] = {} # Empty hash can in future be resource metadata
90
98
  contents = self.read_resource_contents(resource_dir.to_s, id, listing_id)
91
99
  self.write_resource_page(listing_id, id, contents)
92
100
  end
@@ -99,26 +107,18 @@ module Jekyll
99
107
 
100
108
  end
101
109
 
102
- class ResourceReader < Generator
103
- safe true
104
- priority :high
105
-
106
- def generate(site)
107
- site.read_resources
108
- end
109
- end
110
-
111
110
  end
112
111
 
113
112
 
114
113
  def directory_hash(path, name=nil, level=0)
115
114
  data = {
116
- "data" => (name || path),
117
- "full_path" => path,
118
- "level" => level,
115
+ 'data' => (name || path),
116
+ 'full_path' => path,
117
+ 'level' => level,
119
118
  }
120
- data["children"] = children = []
119
+ data['children'] = children = []
121
120
 
121
+ # Increment nesting indicator
122
122
  level += 1
123
123
 
124
124
  Dir.foreach(path) do |entry|
@@ -129,7 +129,11 @@ def directory_hash(path, name=nil, level=0)
129
129
  if File.directory?(full_path)
130
130
  children << directory_hash(full_path, entry, level=level)
131
131
  else
132
- children << { "data" => entry, "full_path" => full_path, "level" => level }
132
+ children << {
133
+ 'data' => entry,
134
+ 'full_path' => full_path,
135
+ 'level' => level,
136
+ }
133
137
  end
134
138
  end
135
139
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-isotc211-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-14 00:00:00.000000000 Z
11
+ date: 2019-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -88,5 +88,5 @@ rubyforge_project:
88
88
  rubygems_version: 2.7.6.2
89
89
  signing_key:
90
90
  specification_version: 4
91
- summary: Helpers for the ISO TC 211 Jekyll theme
91
+ summary: Helpers for the ISO/TC 211 Jekyll theme
92
92
  test_files: []