metanorma-plugin-glossarist 0.2.4 → 0.2.5

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: 12ddac982c211a6bb49202468d586a08b4b9570e80e1ee466e23e2799c75bd71
4
+ data.tar.gz: c9e05329020c2af1ebff8f4af978bb28a103b80e8941719de0bf6e9f88ae14e3
5
5
  SHA512:
6
- metadata.gz: 1d33f20252ce0db1b55d61f453f54a69f915ea227fe868c23c4daa8b36e2eea7755b546ef6526f7e94071fbfbf24c43d7d8aabe9715d8701c64500583a6fb1cd
7
- data.tar.gz: 2a07cc65110876baaef8c0ddb0018d088521326f0d2f5e9ee5e4a95abacf4124f0fe8d0b33062e3b9a4efaf6bbdd934afd3efbe62ea5937a1c0abdd6671cc761
6
+ metadata.gz: d12ae0428bcc90977f81af1606a72e9018155ec76153950ddd542fa546cbee3c74ea8ffcb56e64dadcb409acd6197282be0d53a4eadbbe861b1aecccdbb9c1cf
7
+ data.tar.gz: 6b74bc686a2a0f6f6690e81a90e5749b27699a2ebd3e601ddcaf1bfa2164f328af176a27a4e240c5d7fa5da993b8db061014bbb42d0d6bc0088705e82d26f0dd
@@ -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
241
  def concept_bibliography(concept) # rubocop:disable Metrics/AbcSize
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)
@@ -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.5".freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.5
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-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor