jekyll-geolexica 1.8.15 → 1.9.1

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: 95c0a7c0547605c1021f70db23fb61dfd5bcc394508c380d5ba7c83d62e15050
4
- data.tar.gz: dc7ebc49fd3aec4a6e3fc49432d12e6725c4acc27a68b8e8689f922a69b354a1
3
+ metadata.gz: 71d15e10d8832700e6e8feaa23a0347069e4e7c0482d633ae46fe66cd66bbba2
4
+ data.tar.gz: 8ebe077ef66a74ec5378843be25a6d6a52e3e41a7b42d4b66befb87574f8be9a
5
5
  SHA512:
6
- metadata.gz: bd1b971b4fb9ab92f9f8661dc7e3476091c0470bf3c4d49111551e0284e9340ea292cd2b679e6ac6f5acc36ab2bc24f1adcb2652285784c72eff0a367a3348a2
7
- data.tar.gz: f3aef44aa0bbaa85dc494463b74f8d2cce23958065666e2216354f58f46c6c8085706de66acf4b34bc56cbd5bbda2d703bc941a520a60f867e4ac44dacb627c7
6
+ metadata.gz: d969b0ffae0eb1435f49152892b4484282ce3093e867c8f18ac5e69241bbaad52f16675987e399e9d081e8ae366f4d7efec6bba6932c67570fb8a2868b4c1cae
7
+ data.tar.gz: 95f6c35f08e6baf7c7e3129e65473f7ed0fd6790a03593dbb86944f4f6f0597341f6493b747395d29c3f9f997f0978754d6ae17153754015b4b7f5139bd284af
@@ -2,7 +2,7 @@
2
2
  {%- if json_url %}
3
3
  <section class="field json">
4
4
  <p class="field-name">JSON</p>
5
- <p class="field-value"><a href="{{ json_url }}">{{ json_url }}</a></p>
5
+ <p class="field-value"><a href="{{ json_url | relative_url }}">{{ json_url | relative_url }}</a></p>
6
6
  </section>
7
7
  {% endif -%}
8
8
 
@@ -10,7 +10,7 @@
10
10
  {%- if yaml_url %}
11
11
  <section class="field yaml">
12
12
  <p class="field-name">YAML</p>
13
- <p class="field-value"><a href="{{ yaml_url }}">{{ yaml_url }}</a></p>
13
+ <p class="field-value"><a href="{{ yaml_url | relative_url }}">{{ yaml_url | relative_url }}</a></p>
14
14
  </section>
15
15
  {% endif -%}
16
16
 
@@ -18,7 +18,7 @@
18
18
  {%- if json_url %}
19
19
  <section class="field json">
20
20
  <p class="field-name">SKOS in JSON-LD</p>
21
- <p class="field-value"><a href="{{ json_url }}">{{ json_url }}</a></p>
21
+ <p class="field-value"><a href="{{ json_url | relative_url }}">{{ json_url | relative_url }}</a></p>
22
22
  </section>
23
23
  {% endif -%}
24
24
 
@@ -26,7 +26,7 @@
26
26
  {%- if ttl_url %}
27
27
  <section class="field ttl">
28
28
  <p class="field-name">SKOS in RDF</p>
29
- <p class="field-value"><a href="{{ ttl_url }}">{{ ttl_url }}</a></p>
29
+ <p class="field-value"><a href="{{ ttl_url | relative_url }}">{{ ttl_url | relative_url }}</a></p>
30
30
  </section>
31
31
  {% endif -%}
32
32
 
@@ -34,6 +34,6 @@
34
34
  {%- if tbx_url %}
35
35
  <section class="field tbx">
36
36
  <p class="field-name">TBX-ISO-TML</p>
37
- <p class="field-value"><a href="{{ tbx_url }}">{{ tbx_url }}</a></p>
37
+ <p class="field-value"><a href="{{ tbx_url | relative_url }}">{{ tbx_url | relative_url }}</a></p>
38
38
  </section>
39
39
  {% endif -%}
data/_includes/head.html CHANGED
@@ -9,15 +9,15 @@
9
9
 
10
10
  <title>{% include title.html %}</title>
11
11
 
12
- <link rel="icon" type="image/png" href="/images/favicon-32x32.png" sizes="32x32" />
13
- <link rel="icon" type="image/png" href="/images/android-chrome-192x192.png" sizes="192x192" />
14
- <link rel="icon" type="image/png" href="/images/favicon-96x96.png" sizes="96x96" />
15
- <link rel="icon" type="image/png" href="/images/favicon-16x16.png" sizes="16x16" />
16
- <link rel="shortcut icon" href="/favicon.ico" />
12
+ <link rel="icon" type="image/png" href="{{ '/images/favicon-32x32.png' | relative_url }}" sizes="32x32" />
13
+ <link rel="icon" type="image/png" href="{{ '/images/android-chrome-192x192.png' | relative_url }}" sizes="192x192" />
14
+ <link rel="icon" type="image/png" href="{{ '/images/favicon-96x96.png' | relative_url }}" sizes="96x96" />
15
+ <link rel="icon" type="image/png" href="{{ '/images/favicon-16x16.png' | relative_url }}" sizes="16x16" />
16
+ <link rel="shortcut icon" href="{{ '/favicon.ico' | relative_url }}" />
17
17
 
18
18
  <meta name="msapplication-TileColor" content="#ffffff" />
19
- <meta name="msapplication-TileImage" content="/images/mstile-144x144.png" />
20
- <meta name="msapplication-config" content="/browserconfig.xml" />
19
+ <meta name="msapplication-TileImage" content="{{ '/images/mstile-144x144.png' | relative_url }}" />
20
+ <meta name="msapplication-config" content="{{ '/browserconfig.xml' | relative_url }}" />
21
21
  <meta name="theme-color" content="#ffffff" />
22
22
 
23
23
  <link rel="canonical" href="{{ page.url | replace: 'index.html', '' | relative_url }}" />
@@ -26,7 +26,7 @@
26
26
  {% if extra_stylesheets %}
27
27
  {% for ss in extra_stylesheets %}
28
28
  <link rel="stylesheet"
29
- href="{{ ss.href }}"
29
+ href="{{ ss.href | relative_url }}"
30
30
  {% if ss.integrity %}integrity="{{ ss.integrity }}"{% endif %}
31
31
  {% if ss.crossorigin %}crossorigin="{{ ss.crossorigin }}"{% endif %}>
32
32
  {% endfor %}
@@ -17,7 +17,7 @@ extra_scripts:
17
17
 
18
18
  <section class="browse-concepts">
19
19
  <h2 class="section-title">Concepts</h2>
20
- <a href="/concepts/" class="browse-concepts">Browse concepts</a>
20
+ <a href="{{ '/concepts/' | relative_url }}" class="browse-concepts">Browse concepts</a>
21
21
  </section>
22
22
 
23
23
  {{ content }}
@@ -9,7 +9,7 @@
9
9
  <header class="{% if site.has_brand_name %}brand{% endif %}">
10
10
  <div class="site-headline">
11
11
  <div class="parent-org-reference">
12
- <a href="/" class="logo-link">
12
+ <a href="{{ '/' | relative_url }}" class="logo-link">
13
13
  <img src="{{ site.committee.main_logo.path | relative_url }}" alt="{{ site.committee.main_logo.alt_text }}">
14
14
  </a>
15
15
  </div>
@@ -124,7 +124,7 @@
124
124
  {% if extra_scripts %}
125
125
  {% for sc in extra_scripts %}
126
126
  <script
127
- src="{{ sc.src }}"
127
+ src="{{ sc.src | relative_url }}"
128
128
  {% if sc.integrity %}integrity="{{ sc.integrity }}"{% endif %}
129
129
  {% if sc.crossorigin %}crossorigin="{{ sc.crossorigin }}"{% endif %}></script>
130
130
  {% endfor %}
@@ -8,7 +8,7 @@ permalink: "/api/concept-search-index.json"
8
8
  json.array! site["concepts"].each_with_index.to_a do |(concept, idx)|
9
9
  json.termid concept.termid
10
10
  json.term concept.data.dig("eng", "terms", 0, "designation")
11
- json.term_url concept.url
11
+ json.term_url "#{site["baseurl"]}#{concept.url}"
12
12
 
13
13
  json.sort_order do
14
14
  json.natural idx + 1 # loop index, indexing from 1
@@ -26,7 +26,7 @@ json.array! site["concepts"].each_with_index.to_a do |(concept, idx)|
26
26
 
27
27
  json.term localized.dig("terms", 0, "designation")
28
28
  json.id localized["id"]
29
- json.term_url "#{concept.url}#entry-lang-#{lang}"
29
+ json.term_url "#{site["baseurl"]}#{concept.url}#entry-lang-#{lang}"
30
30
  json.entry_status concept["status"]
31
31
  json.language_code localized["language_code"]
32
32
  json.review_decision english["review_decision"]
@@ -12,8 +12,11 @@ for concept_page in site["concepts"]
12
12
  json.set! concept_page.termid.to_s do
13
13
  json.term concept_page.data["term"]
14
14
  json.termid concept_page.termid
15
- json.set! "uri-html", concept_page.url
16
- json.set! "uri-json", concept_json_page&.url
15
+ json.set! "uri-html", "#{site["baseurl"]}#{concept_page.url}"
16
+
17
+ if concept_json_page&.url
18
+ json.set! "uri-json", "#{site["baseurl"]}#{concept_json_page.url}"
19
+ end
17
20
  end
18
21
  end
19
22
 
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  ---
3
- importScripts('/assets/js/babel-polyfill.js');
3
+ importScripts("{{ '/assets/js/babel-polyfill.js' | relative_url }}");
4
4
 
5
- const CONCEPTS_URL = '/api/concept-search-index.json';
5
+ const CONCEPTS_URL = "{{ '/api/concept-search-index.json' | relative_url }}";
6
6
 
7
7
  /** For example:
8
8
  * const LANGUAGES = [ 'eng', 'deu' ];
@@ -2,7 +2,7 @@
2
2
  ---
3
3
  (function () {
4
4
 
5
- const searchWorker = new Worker('/assets/js/concept-search-worker.js');
5
+ const searchWorker = new Worker("{{ '/assets/js/concept-search-worker.js' | relative_url }}");
6
6
 
7
7
  /** For example:
8
8
  * const LANGUAGES = [ 'eng', 'deu' ];
@@ -231,7 +231,7 @@
231
231
  );
232
232
  }
233
233
  headerEls.push(el('span', { key: 'title' }, 'Find a concept'));
234
- headerEls.push(el('a', { key: 'link', href: '/concepts' }, '(browse all)'));
234
+ headerEls.push(el('a', { key: 'link', href: "{{ '/concepts' | relative_url }}" }, '(browse all)'));
235
235
 
236
236
  var els = [
237
237
  el('h2', { key: 'section-title', className: 'section-title' }, headerEls),
@@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
36
  spec.require_paths = ["lib"]
37
37
 
38
+ spec.add_runtime_dependency "glossarist", "~> 2.0.7"
38
39
  # Jekyll 4.1.0 adds some breaking changes which are reverted in 4.1.1.
39
40
  # I doubt we should be worried, but there is no good reason to allow them
40
41
  # either.
@@ -16,6 +16,11 @@ module Jekyll
16
16
  File.expand_path(path, site.source)
17
17
  end
18
18
 
19
+ def glossary_path
20
+ glob_string = glossary_config["glossary_path"]
21
+ File.expand_path(glob_string, site.source)
22
+ end
23
+
19
24
  def glossary_format
20
25
  glossary_config["format"]
21
26
  end
@@ -13,11 +13,28 @@ module Jekyll
13
13
 
14
14
  def initialize(site)
15
15
  @site = site
16
+ @collection = Glossarist::ManagedConceptCollection.new
16
17
  end
17
18
 
18
19
  def load_glossary
19
20
  Jekyll.logger.info('Geolexica:', 'Loading concepts')
20
- Dir.glob(concepts_glob).each { |path| load_concept(path) }
21
+ @collection.load_from_files(glossary_path)
22
+
23
+ @collection.each do |managed_concept|
24
+ concept_hash = {
25
+ "id" => managed_concept.uuid,
26
+ "term" => managed_concept.default_designation,
27
+ "termid" => managed_concept.id,
28
+ "status" => managed_concept.status,
29
+ }.merge(managed_concept.to_h)
30
+
31
+ managed_concept.localizations.each do |lang, localization|
32
+ concept_hash[lang] = localization.to_h["data"]
33
+ end
34
+
35
+ preprocess_concept_hash(concept_hash)
36
+ store(Concept.new(concept_hash))
37
+ end
21
38
  end
22
39
 
23
40
  def store(concept)
@@ -37,70 +54,6 @@ module Jekyll
37
54
 
38
55
  protected
39
56
 
40
- def load_concept(concept_file_path)
41
- Jekyll.logger.debug('Geolexica:',
42
- "reading concept from file #{concept_file_path}")
43
-
44
- concept_hash = if glossary_format == 'paneron'
45
- read_paneron_concept_file(concept_file_path)
46
- else
47
- read_concept_file(concept_file_path)
48
- end
49
-
50
- preprocess_concept_hash(concept_hash)
51
- store Concept.new(concept_hash)
52
- rescue StandardError
53
- Jekyll.logger.error('Geolexica:',
54
- "failed to read concept from file #{concept_file_path}")
55
- raise
56
- end
57
-
58
- # Reads and parses concept file located at given path.
59
- def read_concept_file(path)
60
- YAML.safe_load(File.read(path), permitted_classes: [Time])
61
- end
62
-
63
- def read_paneron_concept_file(path)
64
- safe_load_options = { permitted_classes: [Date, Time] }
65
- concept = YAML.safe_load(File.read(path), **safe_load_options)
66
- concept['termid'] = concept['data']['identifier']
67
-
68
- (concept['data']['localizedConcepts'] || []).each do |lang, local_concept_id|
69
- localized_concept_path = File.join(localized_concepts_path, "#{local_concept_id}.yaml")
70
- concept[lang] = YAML.safe_load(File.read(localized_concept_path), **safe_load_options)['data']
71
-
72
- next unless concept[lang]
73
-
74
- normalize_sources(concept[lang])
75
- concept['term'] = concept[lang]['terms'].first['designation'] if lang == 'eng'
76
- end
77
-
78
- concept
79
- end
80
-
81
- def normalize_sources(concept)
82
- authoritative_sources = concept.delete('authoritativeSource') || []
83
- concept['sources'] ||= []
84
-
85
- authoritative_sources.each do |authoritative_source|
86
- if authoritative_source['relationship']
87
- status = authoritative_source['relationship']['type']
88
- modification = authoritative_source['relationship']['modification']
89
- end
90
-
91
- concept['sources'] << {
92
- "status" => status,
93
- "modification" => modification,
94
- "origin" => {
95
- 'ref' => authoritative_source['ref'],
96
- 'clause' => authoritative_source['clause'],
97
- 'link' => authoritative_source['link'],
98
- }.compact,
99
- 'type' => 'authoritative'
100
- }.compact
101
- end
102
- end
103
-
104
57
  # Does nothing, but some sites may replace this method.
105
58
  def preprocess_concept_hash(concept_hash); end
106
59
 
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Jekyll
5
5
  module Geolexica
6
- VERSION = "1.8.15".freeze
6
+ VERSION = "1.9.1".freeze
7
7
  end
8
8
  end
@@ -2,6 +2,7 @@
2
2
  #
3
3
 
4
4
  require "jekyll"
5
+ require "glossarist"
5
6
 
6
7
  module Jekyll
7
8
  module Geolexica
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-geolexica
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.15
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-24 00:00:00.000000000 Z
11
+ date: 2024-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: glossarist
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.7
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.7
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: jekyll
15
29
  requirement: !ruby/object:Gem::Requirement