jekyll-geolexica 1.9.6 → 1.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a8652cdfc6bbcee18f8c154c6949b3e3b6bef735276441ccabe1d0f1b4bee6c
4
- data.tar.gz: b9e9667dca0ecef269670c849395b6e1718fd7ca971a0f6f8017f9bfbf1c06ea
3
+ metadata.gz: 87780c0abd7530643394cac28becce105659a827acd9d64907402ccee1fa818f
4
+ data.tar.gz: a6b9c3a236d6f37d9f8f2fca755ede239ca999e68d2c470f678c5027d2335027
5
5
  SHA512:
6
- metadata.gz: 568648536d09d2e9213f68f77a1fa2781cfb43470c4d24444481f2e9491e690e9e2664dbbe20a09e7fd84f1cce3d91c29434f82b81a19cdc8e0e9afa51cb1146
7
- data.tar.gz: e549817d5fca3123cdbd7f552399344adbccde18a14d2b19baf0968bcf7ba60df8ce2685884ed0c26e2b7957d9c4c8c3ad7edf563f227a7491a3c94928c7bed3
6
+ metadata.gz: 328897babe8fa43ae29c3046733698fa880ae441173baab02b7069d1bbabd78b2e17e1bc412a788f265e7cb6b283b0eeba3912a4fd69f2cf673e65fdec31ec25
7
+ data.tar.gz: d2ceb20e24e7e179a3df10b8cf58564a811c856427105ba61b9932d584d634c57d24878bf50dd022b08d7bc8c86fb85e74f969563a424d5be60da01b222441a7
@@ -19,15 +19,15 @@ Gem::Specification.new do |spec|
19
19
  spec.license = "MIT"
20
20
 
21
21
  spec.metadata = {
22
- "bug_tracker_uri" => (github_url + "/issues"),
23
- "homepage_uri" => ribose_url,
24
- "source_code_uri" => github_url,
22
+ "bug_tracker_uri" => "#{github_url}/issues",
23
+ "homepage_uri" => ribose_url,
24
+ "source_code_uri" => github_url,
25
25
  }
26
26
 
27
- spec.files = all_files_in_git.reject do |f|
27
+ spec.files = all_files_in_git.reject do |f|
28
28
  [
29
29
  f.match(%r{^(test|spec|features|.github)/}),
30
- f.match(%r{^\.}),
30
+ f.match(/^\./),
31
31
  ].any?
32
32
  end
33
33
 
@@ -35,20 +35,18 @@ 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
+ spec.add_runtime_dependency "glossarist", "~> 2.3"
39
+ spec.add_runtime_dependency "jbuilder"
39
40
  # Jekyll 4.1.0 adds some breaking changes which are reverted in 4.1.1.
40
41
  # I doubt we should be worried, but there is no good reason to allow them
41
42
  # either.
42
43
  # See: https://jekyllrb.com/news/2020/06/24/jekyll-4-1-1-released/
43
44
  spec.add_runtime_dependency "jekyll", ">= 3.8.5", "< 4.3", "!= 4.1.0"
44
- spec.add_runtime_dependency "jbuilder"
45
45
 
46
46
  spec.add_runtime_dependency "jekyll-asciidoc"
47
- # Pin logger to <= 1.5.3 due to incompatibility of logger 1.6.0 with Jekyll 4.3.2
48
- spec.add_runtime_dependency "logger", "<= 1.5.3"
47
+ spec.add_runtime_dependency "plurimath"
49
48
  spec.add_runtime_dependency "relaton"
50
49
  spec.add_runtime_dependency "unitsml"
51
- spec.add_runtime_dependency "plurimath"
52
50
 
53
51
  # Zeitwerk::Loader#push_dir supports :namespace argument from v. 2.4.
54
52
  spec.add_runtime_dependency "zeitwerk", "~> 2.4"
@@ -18,7 +18,7 @@ module Jekyll
18
18
  end
19
19
 
20
20
  def type
21
- self.collection_name.to_sym
21
+ collection_name.to_sym
22
22
  end
23
23
 
24
24
  protected
@@ -171,7 +171,6 @@ module Jekyll
171
171
  "/api/concepts/#{termid}.yaml"
172
172
  end
173
173
  end
174
-
175
174
  end
176
175
  end
177
176
  end
@@ -8,7 +8,7 @@ module Jekyll
8
8
  class ConceptSerializer < SimpleDelegator
9
9
  include Configuration
10
10
 
11
- NON_LANGUAGE_KEYS = %w[term termid]
11
+ NON_LANGUAGE_KEYS = %w[term termid].freeze
12
12
 
13
13
  # A Jekyll::Site instance.
14
14
  attr_reader :site
@@ -30,21 +30,39 @@ module Jekyll
30
30
  def make_pages
31
31
  site.glossary.each_concept do |concept|
32
32
  Jekyll.logger.debug("Geolexica:",
33
- "building pages for concept #{concept.termid}")
33
+ "building pages for concept #{concept.termid}")
34
34
  concept.pages.replace({
35
- html: (ConceptPage::HTML.new(site, concept) if output_html?),
36
- json: (ConceptPage::JSON.new(site, concept) if output_json?),
37
- jsonld: (ConceptPage::JSONLD.new(site, concept) if output_jsonld?),
38
- tbx: (ConceptPage::TBX.new(site, concept) if output_tbx?),
39
- turtle: (ConceptPage::Turtle.new(site, concept) if output_turtle?),
40
- yaml: (ConceptPage::YAML.new(site, concept) if output_yaml?),
41
- })
35
+ html: (if output_html?
36
+ ConceptPage::HTML.new(site,
37
+ concept)
38
+ end),
39
+ json: (if output_json?
40
+ ConceptPage::JSON.new(site,
41
+ concept)
42
+ end),
43
+ jsonld: (if output_jsonld?
44
+ ConceptPage::JSONLD.new(site,
45
+ concept)
46
+ end),
47
+ tbx: (if output_tbx?
48
+ ConceptPage::TBX.new(site,
49
+ concept)
50
+ end),
51
+ turtle: (if output_turtle?
52
+ ConceptPage::Turtle.new(site,
53
+ concept)
54
+ end),
55
+ yaml: (if output_yaml?
56
+ ConceptPage::YAML.new(site,
57
+ concept)
58
+ end),
59
+ })
42
60
  add_page(*concept.pages.values.compact)
43
61
  end
44
62
  end
45
63
 
46
64
  def sort_pages
47
- generated_pages.sort_by! { |p| p.termid }
65
+ generated_pages.sort_by!(&:termid)
48
66
  end
49
67
 
50
68
  def initialize_collections
@@ -53,6 +71,7 @@ module Jekyll
53
71
  concepts_ttl concepts_tbx concepts_yaml
54
72
  ].each do |label|
55
73
  next if site.collections[label]
74
+
56
75
  site.config["collections"][label] ||= { "output" => true }
57
76
  site.collections[label] = Jekyll::Collection.new(site, label)
58
77
  end
@@ -65,7 +84,7 @@ module Jekyll
65
84
  end
66
85
 
67
86
  def add_page *pages
68
- self.generated_pages.concat(pages)
87
+ generated_pages.concat(pages)
69
88
  end
70
89
 
71
90
  def find_page(name)
@@ -33,17 +33,22 @@ module Jekyll
33
33
  end
34
34
 
35
35
  def images_metadata_path
36
- glossary_path = glossary_config["glossary_path"]
37
- return {} if glossary_path.nil? || glossary_path.empty?
36
+ images_metadata_path = glossary_config["images_metadata_path"] ||
37
+ glossary_config["glossary_path"]
38
+
39
+ return {} if images_metadata_path.nil? || images_metadata_path.empty?
38
40
 
39
- File.expand_path("#{glossary_path}/images_metadata.yaml", site.source)
41
+ File.expand_path(
42
+ "#{images_metadata_path}/images_metadata.yaml", site.source
43
+ )
40
44
  end
41
45
 
42
46
  def bibliography_path
43
- glossary_path = glossary_config["glossary_path"]
44
- return nil if glossary_path.nil? || glossary_path.empty?
47
+ bibliography_path = glossary_config["bibliography_path"] ||
48
+ glossary_config["glossary_path"]
49
+ return nil if bibliography_path.nil? || bibliography_path.empty?
45
50
 
46
- File.expand_path("#{glossary_path}/bibliography.yaml", site.source)
51
+ File.expand_path("#{bibliography_path}/bibliography.yaml", site.source)
47
52
  end
48
53
 
49
54
  def suggest_translation_url
@@ -11,12 +11,16 @@ module Jekyll
11
11
  #
12
12
  # TODO Maybe support string inputs.
13
13
  def display_authoritative_source(input)
14
- ref, clause, link = input["origin"].values_at("ref", "clause", "link") rescue nil
14
+ ref, clause, link = begin
15
+ input["origin"].values_at("ref", "clause", "link")
16
+ rescue StandardError
17
+ nil
18
+ end
15
19
 
16
20
  return "" if ref.nil? && link.nil?
17
21
 
18
22
  ref_caption = escape_once(ref || link)
19
- ref_part = link ? %[<a href="#{link}">#{ref_caption}</a>] : ref_caption
23
+ ref_part = link ? %(<a href="#{link}">#{ref_caption}</a>) : ref_caption
20
24
 
21
25
  clause_part = clause && escape_once(clause)
22
26
 
@@ -25,7 +29,7 @@ module Jekyll
25
29
  modification = input["modification"]
26
30
  return source unless modification
27
31
 
28
- "#{source}, #{input["status"] || "modified"} -- #{modification}"
32
+ "#{source}, #{input['status'] || 'modified'} -- #{modification}"
29
33
  end
30
34
 
31
35
  def concepts_url(base_url)
@@ -86,8 +90,12 @@ module Jekyll
86
90
  link = bib_ref["link"]
87
91
  docidentifier = bib_ref["reference"]
88
92
  else
89
- link = bib_ref["link"].detect { |l| l["type"] == "src" }["content"]["uri_string"]
90
- docidentifier = bib_ref["docidentifier"].detect { |d| d["primary"] }["id"]
93
+ link = bib_ref["link"].detect do |l|
94
+ l["type"] == "src"
95
+ end["content"]["uri_string"]
96
+ docidentifier = bib_ref["docidentifier"].detect do |d|
97
+ d["primary"]
98
+ end["id"]
91
99
  end
92
100
 
93
101
  link_tag(link, docidentifier)
@@ -133,11 +141,14 @@ module Jekyll
133
141
 
134
142
  def images_metadata
135
143
  site = @context.registers[:site]
136
- glossary_path = site.config["geolexica"]["glossary_path"]
137
- return {} if glossary_path.nil? || glossary_path.empty?
144
+ site_config = site.config["geolexica"]
145
+ images_metadata_path = site_config["images_metadata_path"] ||
146
+ site_config["glossary_path"]
147
+ return {} if images_metadata_path.nil? || images_metadata_path.empty?
138
148
 
139
149
  @images_metadata ||= YAML.safe_load_file(
140
- File.expand_path("#{glossary_path}/images_metadata.yaml", site.source),
150
+ File.expand_path("#{images_metadata_path}/images_metadata.yaml",
151
+ site.source),
141
152
  permitted_classes: [Time],
142
153
  )
143
154
  end
@@ -17,19 +17,20 @@ module Jekyll
17
17
  end
18
18
 
19
19
  def load_glossary
20
- Jekyll.logger.info('Geolexica:', 'Loading concepts')
20
+ Jekyll.logger.info("Geolexica:", "Loading concepts")
21
21
  @collection.load_from_files(glossary_path)
22
22
 
23
23
  @collection.each do |managed_concept|
24
24
  concept_hash = {
25
25
  "id" => managed_concept.uuid,
26
26
  "term" => managed_concept.default_designation,
27
- "termid" => managed_concept.id,
27
+ "termid" => managed_concept.data.id,
28
28
  "status" => managed_concept.status,
29
- }.merge(managed_concept.to_h)
29
+ }.merge(managed_concept.to_yaml_hash)
30
30
 
31
31
  managed_concept.localizations.each do |lang, localization|
32
- concept_hash[lang] = localization.to_h["data"]
32
+ concept_hash[lang] =
33
+ localization.to_yaml_hash["data"].merge({ "status" => localization.entry_status })
33
34
  end
34
35
 
35
36
  preprocess_concept_hash(concept_hash)
@@ -38,7 +39,7 @@ module Jekyll
38
39
  end
39
40
 
40
41
  def store(concept)
41
- super(concept.data['termid'], concept)
42
+ super(concept.data["termid"], concept)
42
43
  end
43
44
 
44
45
  def language_statistics
@@ -48,7 +49,7 @@ module Jekyll
48
49
  # Defines how Glossary is exposed in Liquid templates.
49
50
  def to_liquid
50
51
  {
51
- 'language_statistics' => language_statistics
52
+ "language_statistics" => language_statistics,
52
53
  }
53
54
  end
54
55
 
@@ -59,9 +60,9 @@ module Jekyll
59
60
 
60
61
  def calculate_language_statistics
61
62
  unsorted = each_value.lazy
62
- .flat_map { |concept| term_languages & concept.data.keys }
63
- .group_by(&:itself)
64
- .transform_values(&:count)
63
+ .flat_map { |concept| term_languages & concept.data.keys }
64
+ .group_by(&:itself)
65
+ .transform_values(&:count)
65
66
 
66
67
  # This is not crucial, but gives nicer output, and ensures that
67
68
  # all +term_languages+ are present.
@@ -80,7 +81,7 @@ module Jekyll
80
81
  end
81
82
 
82
83
  def termid
83
- data['termid']
84
+ data["termid"]
84
85
  end
85
86
 
86
87
  class LiquidCompatibleHash < Hash
@@ -40,13 +40,13 @@ module Jekyll
40
40
  ascii_equation = CGI.unescapeHTML(Regexp.last_match[1])[1..-2]
41
41
 
42
42
  mathml_equation = ::Plurimath::Math
43
- .parse(ascii_equation, math_notation)
44
- .to_mathml
43
+ .parse(ascii_equation, math_notation)
44
+ .to_mathml
45
45
 
46
46
  normalize_mathml(mathml_equation, page.html?)
47
47
  end
48
48
  end
49
- rescue => e
49
+ rescue StandardError => e
50
50
  # Skipping broken formulas
51
51
  Jekyll.logger.info(e.message)
52
52
  end
@@ -54,16 +54,20 @@ module Jekyll
54
54
  def normalize_mathml(mathml_equation, is_html)
55
55
  # temporary hack to use display inline for math equations because
56
56
  # currently there is no option to use display inline in plurimath
57
- mathml_equation = mathml_equation.gsub("display=\"block\"", "display=\"inline\"")
57
+ mathml_equation = mathml_equation.gsub('display="block"',
58
+ 'display="inline"')
58
59
 
59
60
  # Removing newlines(\n) and escaping double quotes(")
60
61
  # because they will cause parsing issues in json
61
- mathml_equation = mathml_equation.gsub("\n", "").gsub("\"", "\\\"") unless is_html
62
+ unless is_html
63
+ mathml_equation = mathml_equation.delete("\n").gsub('"',
64
+ '\"')
65
+ end
62
66
 
63
67
  mathml_equation
64
68
  end
65
69
 
66
- def hook event, target, action
70
+ def hook(event, target, action)
67
71
  Jekyll::Hooks.register target, event, &method(action)
68
72
  end
69
73
  end
@@ -1,7 +1,7 @@
1
1
  # (c) Copyright 2021 Ribose Inc.
2
2
  #
3
3
 
4
- # TODO Extract that to a separate gem.
4
+ # TODO: Extract that to a separate gem.
5
5
 
6
6
  require "jbuilder"
7
7
 
@@ -13,7 +13,7 @@ module Jekyll
13
13
  wrapper = JbuilderWrapper.new(context)
14
14
  wrapper.eval_source(source)
15
15
  wrapper.target!
16
- rescue
16
+ rescue StandardError
17
17
  Jekyll.logger.error $!.detailed_message
18
18
  raise
19
19
  end
@@ -39,9 +39,7 @@ module Jekyll
39
39
  @builder
40
40
  end
41
41
 
42
- def context
43
- @context
44
- end
42
+ attr_reader :context
45
43
 
46
44
  def page
47
45
  @context["page"]
@@ -53,7 +51,7 @@ module Jekyll
53
51
 
54
52
  def eval_source(source)
55
53
  instance_eval(source)
56
- rescue
54
+ rescue StandardError
57
55
  raise Error.new(source)
58
56
  end
59
57
 
@@ -28,6 +28,7 @@ module Jekyll
28
28
  def make_pages
29
29
  all_pages_pathnames.each do |p|
30
30
  next if skip_page?(p)
31
+
31
32
  add_page Page.new(site, base_dir, p.dirname.to_s, p.basename.to_s)
32
33
  end
33
34
  end
@@ -35,9 +36,9 @@ module Jekyll
35
36
  # Lists all regular files in +base_dir+ recursively, and returns them
36
37
  # as an Array of Pathname instances, which are relative to +base_dir+.
37
38
  def all_pages_pathnames
38
- Dir.glob("**/*", base: base_dir).
39
- map { |path| Pathname.new(path) }.
40
- reject { |pathname| pathname.expand_path(base_dir).directory? }
39
+ Dir.glob("**/*", base: base_dir)
40
+ .map { |path| Pathname.new(path) }
41
+ .reject { |pathname| pathname.expand_path(base_dir).directory? }
41
42
  end
42
43
 
43
44
  def base_dir
@@ -46,12 +47,12 @@ module Jekyll
46
47
 
47
48
  def skip_page?(pathname)
48
49
  (pathname.extname == ".ttl" && !output_turtle?) ||
49
- (pathname.extname == ".json" && !output_json?) ||
50
- false
50
+ (pathname.extname == ".json" && !output_json?) ||
51
+ false
51
52
  end
52
53
 
53
54
  def add_page *pages
54
- self.generated_pages.concat(pages)
55
+ generated_pages.concat(pages)
55
56
  end
56
57
  end
57
58
  end
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Jekyll
5
5
  module Geolexica
6
- VERSION = "1.9.6".freeze
6
+ VERSION = "1.9.7".freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-geolexica
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.6
4
+ version: 1.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-08 00:00:00.000000000 Z
11
+ date: 2025-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glossarist
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.7
19
+ version: '2.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.7
26
+ version: '2.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: jbuilder
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: jekyll
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -51,7 +65,7 @@ dependencies:
51
65
  - !ruby/object:Gem::Version
52
66
  version: 4.1.0
53
67
  - !ruby/object:Gem::Dependency
54
- name: jbuilder
68
+ name: jekyll-asciidoc
55
69
  requirement: !ruby/object:Gem::Requirement
56
70
  requirements:
57
71
  - - ">="
@@ -65,7 +79,7 @@ dependencies:
65
79
  - !ruby/object:Gem::Version
66
80
  version: '0'
67
81
  - !ruby/object:Gem::Dependency
68
- name: jekyll-asciidoc
82
+ name: plurimath
69
83
  requirement: !ruby/object:Gem::Requirement
70
84
  requirements:
71
85
  - - ">="
@@ -78,20 +92,6 @@ dependencies:
78
92
  - - ">="
79
93
  - !ruby/object:Gem::Version
80
94
  version: '0'
81
- - !ruby/object:Gem::Dependency
82
- name: logger
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - "<="
86
- - !ruby/object:Gem::Version
87
- version: 1.5.3
88
- type: :runtime
89
- prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - "<="
93
- - !ruby/object:Gem::Version
94
- version: 1.5.3
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: relaton
97
97
  requirement: !ruby/object:Gem::Requirement
@@ -120,20 +120,6 @@ dependencies:
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
- - !ruby/object:Gem::Dependency
124
- name: plurimath
125
- requirement: !ruby/object:Gem::Requirement
126
- requirements:
127
- - - ">="
128
- - !ruby/object:Gem::Version
129
- version: '0'
130
- type: :runtime
131
- prerelease: false
132
- version_requirements: !ruby/object:Gem::Requirement
133
- requirements:
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- version: '0'
137
123
  - !ruby/object:Gem::Dependency
138
124
  name: zeitwerk
139
125
  requirement: !ruby/object:Gem::Requirement
@@ -204,7 +190,7 @@ dependencies:
204
190
  - - "~>"
205
191
  - !ruby/object:Gem::Version
206
192
  version: '3.9'
207
- description:
193
+ description:
208
194
  email:
209
195
  - open.source@ribose.com
210
196
  executables: []
@@ -305,7 +291,7 @@ metadata:
305
291
  bug_tracker_uri: https://github.com/geolexica/jekyll-geolexica/issues
306
292
  homepage_uri: https://open.ribose.com/
307
293
  source_code_uri: https://github.com/geolexica/jekyll-geolexica
308
- post_install_message:
294
+ post_install_message:
309
295
  rdoc_options: []
310
296
  require_paths:
311
297
  - lib
@@ -320,8 +306,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
320
306
  - !ruby/object:Gem::Version
321
307
  version: '0'
322
308
  requirements: []
323
- rubygems_version: 3.3.26
324
- signing_key:
309
+ rubygems_version: 3.5.22
310
+ signing_key:
325
311
  specification_version: 4
326
312
  summary: Geolexica plugin for Jekyll
327
313
  test_files: []