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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12ddac982c211a6bb49202468d586a08b4b9570e80e1ee466e23e2799c75bd71
|
4
|
+
data.tar.gz: c9e05329020c2af1ebff8f4af978bb28a103b80e8941719de0bf6e9f88ae14e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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
|
-
|
236
|
-
|
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
|
-
|
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)
|
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
|
+
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-
|
11
|
+
date: 2025-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|