metanorma-plugin-glossarist 0.2.4 → 0.2.6

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: b1130c9f69e99794177efc000503b204ab4be39df69c5f3178043016beae858f
4
- data.tar.gz: d0743287efaea1d5fa1702c7aec7f82050b8f6d43bcf4815129b9af9506a0eb4
3
+ metadata.gz: 04a2e374136e18d7fdd6884930ebcd2d6646ea7861b9bb3cea1b0887668a1c82
4
+ data.tar.gz: 3e402d75262a6a4b30bc5907dbb76bee97f9288b7dad75eec3f2b4ca0cafb5c2
5
5
  SHA512:
6
- metadata.gz: 1d33f20252ce0db1b55d61f453f54a69f915ea227fe868c23c4daa8b36e2eea7755b546ef6526f7e94071fbfbf24c43d7d8aabe9715d8701c64500583a6fb1cd
7
- data.tar.gz: 2a07cc65110876baaef8c0ddb0018d088521326f0d2f5e9ee5e4a95abacf4124f0fe8d0b33062e3b9a4efaf6bbdd934afd3efbe62ea5937a1c0abdd6671cc761
6
+ metadata.gz: 13f003cc43b2ee0d1cc9accbcd0fcf73242738efe0438a19c97fcd375633b58425f4795aac5061fd5a15a7338a17cc66fe74681377f9d7def0140fd5ec86a03b
7
+ data.tar.gz: 232855236acb718effcfba7db26db3609b4fdaf772063ecd3e8e7a249c964d3a87070f21cacd96d4516cd7c6c5e208aab66b25c21f686bef4c2be78ca8484e74
data/Gemfile CHANGED
@@ -6,8 +6,8 @@ git_source(:github) { |repo| "https://github.com/#{repo}" }
6
6
 
7
7
  gem "metanorma-standoc"
8
8
  gem "pry"
9
- gem "rake", "~> 12.0"
10
- gem "rspec", "~> 3.0"
9
+ gem "rake", "~> 13.0"
10
+ gem "rspec", "~> 3.6"
11
11
 
12
12
  gemspec
13
13
 
@@ -52,6 +52,7 @@ module Metanorma
52
52
  @title_depth = { value: 2 }
53
53
  @rendered_bibliographies = {}
54
54
  @seen_glossarist = []
55
+ @context_names = []
55
56
  end
56
57
 
57
58
  def process(document, reader)
@@ -130,8 +131,8 @@ module Metanorma
130
131
 
131
132
  def process_dataset_tag(document, input_lines, liquid_doc, match)
132
133
  @seen_glossarist << "x"
133
- @context_names = prepare_dataset_contexts(document, match[1])
134
-
134
+ @context_names << prepare_dataset_contexts(document, match[1])
135
+ @context_names.flatten!
135
136
  dataset_section = <<~TEMPLATE
136
137
  #{prepare_document(document, input_lines)}
137
138
  TEMPLATE
@@ -179,8 +180,8 @@ module Metanorma
179
180
  def get_context_path(document, key) # rubocop:disable Metrics/MethodLength
180
181
  context_path = nil
181
182
  # try to get context_path from glossarist-dataset definition
182
- if @context_names
183
- context_names = @context_names.split(",").map(&:strip)
183
+ if @context_names && !@context_names.empty?
184
+ context_names = @context_names.map(&:strip)
184
185
  context_path = context_names.find do |context|
185
186
  context_name, = context.split("=")
186
187
  context_name == key
@@ -231,14 +232,15 @@ module Metanorma
231
232
  @seen_glossarist << "x"
232
233
  dataset_name, concept_name = match[1].split(",").map(&:strip)
233
234
  concept = get_concept(dataset_name, concept_name)
234
-
235
- liquid_doc.add_content(
236
- concept_bibliography(concept),
237
- )
235
+ bibliography = concept_bibliography(concept)
236
+ if bibliography
237
+ liquid_doc.add_content(bibliography)
238
+ end
238
239
  end
239
240
 
240
- def concept_bibliography(concept) # rubocop:disable Metrics/AbcSize
241
+ def concept_bibliography(concept) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
241
242
  sources = concept.data.localizations["eng"].data.sources
243
+ return nil if sources.nil? || sources.empty?
242
244
 
243
245
  bibliography = sources.map do |source|
244
246
  ref = source.origin.text
@@ -252,7 +254,7 @@ module Metanorma
252
254
  end
253
255
 
254
256
  def prepare_dataset_contexts(document, contexts)
255
- context_names = contexts.split(";").map do |context|
257
+ contexts.split(";").map do |context|
256
258
  context_name, file_path = context.split(":").map(&:strip)
257
259
  path = relative_file_path(document, file_path)
258
260
 
@@ -262,8 +264,6 @@ module Metanorma
262
264
 
263
265
  "#{context_name}=#{path}"
264
266
  end
265
-
266
- context_names.join(",")
267
267
  end
268
268
 
269
269
  def relative_file_path(document, file_path)
@@ -367,12 +367,15 @@ module Metanorma
367
367
  result = []
368
368
 
369
369
  sources.each do |source|
370
- if source.origin.text && source.origin.text != ""
370
+ if source.origin.text &&
371
+ source.origin.text != "" &&
372
+ source.origin.locality.type == "clause"
371
373
  source_origin_text = source.origin.text
372
374
  .gsub(" ", "_")
373
375
  .gsub("/", "_")
374
376
  .gsub(":", "_")
375
- source_content = "#{source_origin_text},#{source.origin.clause}"
377
+ source_content = "#{source_origin_text}," \
378
+ "#{source.origin.locality.reference_from}"
376
379
  content = <<~SOURCES
377
380
  [.source]
378
381
  <<#{source_content}>>
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Glossarist
4
- VERSION = "0.2.4".freeze
4
+ VERSION = "0.2.6".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.required_ruby_version = ">= 2.7.0" # rubocop:disable Gemspec/RequiredRubyVersion
28
28
 
29
- spec.add_dependency "asciidoctor", "~> 2.0.0"
30
- spec.add_dependency "glossarist", "~> 2.3.6"
31
- spec.add_dependency "liquid", "~> 5"
29
+ spec.add_dependency "asciidoctor"
30
+ spec.add_dependency "glossarist", "~> 2.3.7"
31
+ spec.add_dependency "liquid"
32
32
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-plugin-glossarist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-06-05 00:00:00.000000000 Z
11
+ date: 2025-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0
19
+ version: '0'
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.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: glossarist
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.3.6
33
+ version: 2.3.7
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.3.6
40
+ version: 2.3.7
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: liquid
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '5'
47
+ version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '5'
54
+ version: '0'
55
55
  description: Metanorma plugin for glossarist
56
56
  email:
57
57
  - open.source@ribose.com