stepmod-utils 0.3.16 → 0.3.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/.github/workflows/release.yml +2 -2
- data/exe/stepmod-annotate-all +12 -7
- data/exe/stepmod-extract-terms +35 -33
- data/lib/stepmod/utils/concept.rb +0 -9
- data/lib/stepmod/utils/converters/express_example.rb +19 -0
- data/lib/stepmod/utils/converters/express_note.rb +19 -0
- data/lib/stepmod/utils/converters/module_ref_express_description.rb +14 -0
- data/lib/stepmod/utils/converters/stepmod_ext_description.rb +4 -5
- data/lib/stepmod/utils/smrl_description_converter.rb +1 -1
- data/lib/stepmod/utils/smrl_resource_converter.rb +2 -1
- data/lib/stepmod/utils/stepmod_file_annotator.rb +24 -2
- data/lib/stepmod/utils/terms_extractor.rb +176 -66
- data/lib/stepmod/utils/version.rb +1 -1
- data/stepmod-utils.gemspec +2 -0
- metadata +37 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8be21fe4d04046487ecb36fdebeb74f8dbbb7bda473cbb1b3451b62b15d62a0
|
4
|
+
data.tar.gz: f3005c150d30d5c8aac9b77f9221cfcfc575e0d541208152087f6ff88623375d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b004697a0c9eeecc570ba7e184fd7165fa991be9b0046f13305106a6cbdff123aca57299c340ce72fb95214ad878a0d0aff140af5e07308070d1c8a336c09921
|
7
|
+
data.tar.gz: 9aaa80fff000066c954b660592626a9ee0132cfca173c0d93aeb572211adf1929d79dc1f1336858725b031b287d1a9d07f9e4d79e45b8d4a4727819fbe303b9f
|
data/.github/workflows/rake.yml
CHANGED
@@ -15,10 +15,10 @@ on:
|
|
15
15
|
|
16
16
|
jobs:
|
17
17
|
release:
|
18
|
-
uses: metanorma/
|
18
|
+
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
19
19
|
with:
|
20
20
|
next_version: ${{ github.event.inputs.next_version }}
|
21
|
-
event_name: ${{ github.event_name }}
|
22
21
|
secrets:
|
23
22
|
rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
|
23
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
24
24
|
|
data/exe/stepmod-annotate-all
CHANGED
@@ -27,15 +27,20 @@ files.each_slice(MAX_QUEUE_SIZE) do |batch|
|
|
27
27
|
batch.each do |file|
|
28
28
|
pool.post do
|
29
29
|
puts("#{Thread.current.object_id}: Queued processing #{file}")
|
30
|
-
annotated = Stepmod::Utils::StepmodFileAnnotator.new(
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
annotated = Stepmod::Utils::StepmodFileAnnotator.new(
|
31
|
+
express_file: file,
|
32
|
+
resource_docs_cache_file: resource_docs_cache_file,
|
33
|
+
stepmod_dir: stepmod_dir
|
34
|
+
).call
|
35
|
+
|
36
|
+
annotated_file_name = "#{File.basename(file, '.exp')}_annotated.exp"
|
37
|
+
annotated_file_path = File.join(File.dirname(file), annotated_file_name)
|
38
|
+
|
39
|
+
File.open(annotated_file_path, "w") do |file|
|
36
40
|
file.puts(annotated)
|
37
41
|
end
|
38
|
-
|
42
|
+
|
43
|
+
puts("#{Thread.current.object_id}: Done processing #{File.basename(file)} => #{annotated_file_path}.")
|
39
44
|
end
|
40
45
|
end
|
41
46
|
pool.shutdown
|
data/exe/stepmod-extract-terms
CHANGED
@@ -106,28 +106,29 @@ def replace_images(content)
|
|
106
106
|
content
|
107
107
|
end
|
108
108
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
|
109
|
+
## Skip all Clause 3 terms
|
110
|
+
# part_concepts.each do |(bibdata, current_part_concepts)|
|
111
|
+
# current_part_concepts = current_part_concepts.to_a.map do |n|
|
112
|
+
# n.localizations["en"]
|
113
|
+
# end
|
114
|
+
# fn = "03x-stepmod-#{bibdata.part}.adoc"
|
115
|
+
# File.open(fn, "w") do |file|
|
116
|
+
# file.puts("== #{part_to_title(bibdata)}\n\n")
|
117
|
+
# file.puts(replace_images(current_part_concepts.map(&:to_mn_adoc).join("\n")))
|
118
|
+
# end
|
119
|
+
# log "INFO: written to: #{fn}"
|
120
|
+
# end
|
121
|
+
|
122
|
+
# File.open("03x-stepmod.adoc", "w") do |file|
|
123
|
+
# part_concepts.sort_by do |(bibdata, current_part_concepts)|
|
124
|
+
# bibdata.part.to_i
|
125
|
+
# end.each do |(bibdata, current_part_concepts)|
|
126
|
+
# fn = "03x-stepmod-#{bibdata.part}.adoc"
|
127
|
+
# file.puts("\ninclude::#{fn}[]\n")
|
128
|
+
# end
|
129
|
+
# end
|
130
|
+
|
131
|
+
# log "INFO: written summary file to: 03x-stepmod.adoc"
|
131
132
|
|
132
133
|
part_resources.each do |(bibdata, current_part_resources)|
|
133
134
|
current_part_resources = current_part_resources.to_a.map do |n|
|
@@ -194,17 +195,18 @@ end
|
|
194
195
|
|
195
196
|
log "INFO: written summary file to: 05x-stepmod-entities-modules.adoc"
|
196
197
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
198
|
+
## Skipping all Clause 3 terms
|
199
|
+
# File.open("031-stepmod-general.adoc", "w") do |file|
|
200
|
+
# file.puts(
|
201
|
+
# replace_images(
|
202
|
+
# general_concepts.to_a.map do |n|
|
203
|
+
# n.localizations["en"]
|
204
|
+
# end.map(&:to_mn_adoc).join("\n")
|
205
|
+
# )
|
206
|
+
# )
|
207
|
+
# end
|
208
|
+
|
209
|
+
# log "INFO: written to: 031-stepmod-general.adoc"
|
208
210
|
|
209
211
|
File.open("041-stepmod-entities-resources.adoc", "w") do |file|
|
210
212
|
file.puts(
|
@@ -23,15 +23,6 @@ module Stepmod
|
|
23
23
|
|
24
24
|
return nil if converted_definition.nil? || converted_definition.strip.empty?
|
25
25
|
|
26
|
-
if definition_xml.name == "ext_description"
|
27
|
-
converted_definition = <<~TEXT
|
28
|
-
#{converted_definition}
|
29
|
-
|
30
|
-
NOTE: This term is incompletely defined in this document.
|
31
|
-
Reference <<#{reference_anchor}>> for the complete definition.
|
32
|
-
TEXT
|
33
|
-
end
|
34
|
-
|
35
26
|
# https://github.com/metanorma/stepmod-utils/issues/86
|
36
27
|
|
37
28
|
# TODO: This portion DOES NOT HANDLE the <synonym> element. WTF??
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stepmod
|
4
|
+
module Utils
|
5
|
+
module Converters
|
6
|
+
class ExpressExample < ReverseAdoc::Converters::Base
|
7
|
+
def convert(node, state = {})
|
8
|
+
<<~TEMPLATE
|
9
|
+
(*"#{state[:schema_and_entity]}.__example"
|
10
|
+
#{treat_children(node, state).strip}
|
11
|
+
*)
|
12
|
+
TEMPLATE
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
ReverseAdoc::Converters.register :express_example, ExpressExample.new
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stepmod
|
4
|
+
module Utils
|
5
|
+
module Converters
|
6
|
+
class ExpressNote < ReverseAdoc::Converters::Base
|
7
|
+
def convert(node, state = {})
|
8
|
+
<<~TEMPLATE
|
9
|
+
(*"#{state[:schema_and_entity]}.__note"
|
10
|
+
#{treat_children(node, state).strip}
|
11
|
+
*)
|
12
|
+
TEMPLATE
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
ReverseAdoc::Converters.register :express_note, ExpressNote.new
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Stepmod
|
2
|
+
module Utils
|
3
|
+
module Converters
|
4
|
+
class ModuleRefExpressDescription < ReverseAdoc::Converters::Base
|
5
|
+
def convert(node, _state = {})
|
6
|
+
parts = node["linkend"].to_s.split(":").last.split(".")
|
7
|
+
"<<express:#{parts.join('.').strip},#{parts.last.strip}>>"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
ReverseAdoc::Converters.register :module_ref,
|
11
|
+
ModuleRefExpressDescription.new
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -43,18 +43,17 @@ module Stepmod
|
|
43
43
|
|
44
44
|
domain = case linkend.first
|
45
45
|
when /_mim$/, /_arm$/
|
46
|
-
"
|
46
|
+
"application module"
|
47
47
|
# when /_schema$/
|
48
48
|
else
|
49
|
-
"
|
49
|
+
"resource"
|
50
50
|
end
|
51
51
|
|
52
52
|
<<~TEMPLATE
|
53
53
|
=== #{linkend.last}
|
54
|
+
#{domain ? "domain:[#{domain}: #{linkend.first}]" : ''}
|
54
55
|
|
55
|
-
#{
|
56
|
-
|
57
|
-
#{child_text}
|
56
|
+
#{child_text.strip}
|
58
57
|
TEMPLATE
|
59
58
|
end
|
60
59
|
end
|
@@ -41,7 +41,7 @@ module Stepmod
|
|
41
41
|
root || (return "")
|
42
42
|
|
43
43
|
ReverseAdoc.config.with(options) do
|
44
|
-
result = ReverseAdoc::Converters.lookup(root.name).convert(root)
|
44
|
+
result = ReverseAdoc::Converters.lookup(root.name).convert(root, options)
|
45
45
|
Stepmod::Utils::Cleaner.new.tidy(result)
|
46
46
|
end
|
47
47
|
end
|
@@ -59,7 +59,8 @@ module Stepmod
|
|
59
59
|
root || (return "")
|
60
60
|
|
61
61
|
ReverseAdoc.config.with(options) do
|
62
|
-
result = ReverseAdoc::Converters.lookup(root.name).convert(root)
|
62
|
+
result = ReverseAdoc::Converters.lookup(root.name).convert(root, options)
|
63
|
+
|
63
64
|
Stepmod::Utils::Cleaner.new.tidy(result)
|
64
65
|
end
|
65
66
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require "json"
|
2
2
|
require "stepmod/utils/smrl_description_converter"
|
3
3
|
require "stepmod/utils/smrl_resource_converter"
|
4
|
+
require "stepmod/utils/converters/express_note"
|
5
|
+
require "stepmod/utils/converters/express_example"
|
4
6
|
|
5
7
|
module Stepmod
|
6
8
|
module Utils
|
@@ -64,7 +66,27 @@ module Stepmod
|
|
64
66
|
def convert_from_description_text(descriptions_file, description)
|
65
67
|
Dir.chdir(File.dirname(descriptions_file)) do
|
66
68
|
wrapper = "<ext_descriptions>#{description}</ext_descriptions>"
|
67
|
-
|
69
|
+
notes = description.xpath("note")
|
70
|
+
examples = description.xpath("example")
|
71
|
+
|
72
|
+
converted_description = <<~DESCRIPTION
|
73
|
+
|
74
|
+
#{Stepmod::Utils::SmrlDescriptionConverter.convert(wrapper, no_notes_examples: true)}
|
75
|
+
DESCRIPTION
|
76
|
+
|
77
|
+
converted_examples = examples.map do |example|
|
78
|
+
Stepmod::Utils::Converters::ExpressExample
|
79
|
+
.new
|
80
|
+
.convert(example, schema_and_entity: description["linkend"])
|
81
|
+
end.join
|
82
|
+
|
83
|
+
converted_notes = notes.map do |note|
|
84
|
+
Stepmod::Utils::Converters::ExpressNote
|
85
|
+
.new
|
86
|
+
.convert(note, schema_and_entity: description["linkend"])
|
87
|
+
end.join
|
88
|
+
|
89
|
+
"#{converted_description}#{converted_examples}#{converted_notes}"
|
68
90
|
end
|
69
91
|
end
|
70
92
|
|
@@ -77,7 +99,7 @@ module Stepmod
|
|
77
99
|
|
78
100
|
Dir.chdir(File.dirname(descriptions_file)) do
|
79
101
|
wrapper = "<resource>#{schema}</resource>"
|
80
|
-
"\n#{Stepmod::Utils::SmrlResourceConverter.convert(wrapper)}"
|
102
|
+
"\n#{Stepmod::Utils::SmrlResourceConverter.convert(wrapper, no_notes_examples: true)}"
|
81
103
|
end
|
82
104
|
end
|
83
105
|
end
|
@@ -3,6 +3,9 @@ require "stepmod/utils/bibdata"
|
|
3
3
|
require "stepmod/utils/concept"
|
4
4
|
require "glossarist"
|
5
5
|
require "securerandom"
|
6
|
+
require "expressir"
|
7
|
+
require "expressir/express/parser"
|
8
|
+
require "indefinite_article"
|
6
9
|
|
7
10
|
ReverseAdoc.config.unknown_tags = :bypass
|
8
11
|
|
@@ -198,7 +201,7 @@ module Stepmod
|
|
198
201
|
case file_path.to_s
|
199
202
|
when /resource.xml$/
|
200
203
|
log "INFO: Processing resource.xml for #{file_path}"
|
201
|
-
|
204
|
+
|
202
205
|
current_document.xpath("//schema").each do |schema_node|
|
203
206
|
schema_name = schema_node["name"]
|
204
207
|
if parsed_schema_names[schema_name]
|
@@ -210,19 +213,36 @@ module Stepmod
|
|
210
213
|
parsed_schema_names[schema_name] = file_path
|
211
214
|
end
|
212
215
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
216
|
+
exp_annotated_path =
|
217
|
+
"#{stepmod_path}/resources/#{schema_name}/#{schema_name}_annotated.exp"
|
218
|
+
|
219
|
+
log "INFO: Processing resources schema #{exp_annotated_path}"
|
220
|
+
|
221
|
+
if File.exists?(exp_annotated_path)
|
222
|
+
repo = Expressir::Express::Parser.from_file(exp_annotated_path)
|
223
|
+
schema = repo.schemas.first
|
224
|
+
|
225
|
+
schema.entities.each do |entity|
|
226
|
+
old_definition = entity.remarks.first
|
227
|
+
|
228
|
+
domain = "resource: #{schema.id}"
|
229
|
+
entity_definition = generate_entity_definition(entity, domain, old_definition)
|
230
|
+
|
231
|
+
reference_anchor = bibdata.anchor
|
232
|
+
reference_clause = nil
|
233
|
+
|
234
|
+
concept = Stepmod::Utils::Concept.new(
|
235
|
+
designations: [entity.id],
|
236
|
+
definition: old_definition,
|
237
|
+
converted_definition: entity_definition,
|
238
|
+
id: "#{reference_anchor}.#{reference_clause}",
|
239
|
+
reference_anchor: reference_anchor,
|
240
|
+
reference_clause: reference_clause,
|
241
|
+
file_path: Pathname.new(file_path)
|
224
242
|
.relative_path_from(stepmod_path),
|
243
|
+
language_code: "en",
|
225
244
|
)
|
245
|
+
|
226
246
|
next unless concept
|
227
247
|
|
228
248
|
if term_special_category(bibdata)
|
@@ -252,62 +272,89 @@ module Stepmod
|
|
252
272
|
parsed_schema_names[schema_name] = file_path
|
253
273
|
end
|
254
274
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
)
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
275
|
+
exp_annotated_path =
|
276
|
+
"#{stepmod_path}/modules/#{schema_name}/arm_annotated.exp"
|
277
|
+
|
278
|
+
log "INFO: Processing modules schema #{exp_annotated_path}"
|
279
|
+
|
280
|
+
if File.exists?(exp_annotated_path)
|
281
|
+
repo = Expressir::Express::Parser.from_file(exp_annotated_path)
|
282
|
+
|
283
|
+
repo.schemas.each do |schema|
|
284
|
+
schema.entities.each do |entity|
|
285
|
+
old_definition = entity.remarks.first
|
286
|
+
|
287
|
+
domain = "application module: #{schema.id}"
|
288
|
+
entity_definition = generate_entity_definition(entity, domain, old_definition)
|
289
|
+
|
290
|
+
reference_anchor = bibdata.anchor
|
291
|
+
reference_clause = nil
|
292
|
+
|
293
|
+
concept = Stepmod::Utils::Concept.new(
|
294
|
+
designations: [entity.id],
|
295
|
+
definition: old_definition,
|
296
|
+
converted_definition: entity_definition,
|
297
|
+
id: "#{reference_anchor}.#{reference_clause}",
|
298
|
+
reference_anchor: reference_anchor,
|
299
|
+
reference_clause: reference_clause,
|
300
|
+
file_path: Pathname.new(file_path)
|
301
|
+
.relative_path_from(stepmod_path),
|
302
|
+
language_code: "en",
|
303
|
+
)
|
304
|
+
|
305
|
+
next unless concept
|
306
|
+
|
307
|
+
current_part_modules_arm[schema.id] ||=
|
308
|
+
Glossarist::Collection.new
|
309
|
+
find_or_initialize_concept(
|
310
|
+
current_part_modules_arm[schema.id], concept
|
311
|
+
)
|
312
|
+
|
313
|
+
# puts part_modules_arm.inspect
|
314
|
+
parsed_bibliography << bibdata
|
315
|
+
end
|
280
316
|
end
|
281
317
|
end
|
282
318
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
319
|
+
mim_exp_annotated_path = "#{stepmod_path}/modules/#{schema_name}/mim_annotated.exp"
|
320
|
+
|
321
|
+
log "INFO: Processing modules schema #{mim_exp_annotated_path}"
|
322
|
+
|
323
|
+
if File.exists?(mim_exp_annotated_path)
|
324
|
+
repo = Expressir::Express::Parser.from_file(mim_exp_annotated_path)
|
325
|
+
|
326
|
+
repo.schemas.each do |schema|
|
327
|
+
schema.entities.each do |entity|
|
328
|
+
old_definition = entity.remarks.first
|
329
|
+
|
330
|
+
domain = "application module: #{schema.id}"
|
331
|
+
definition = generate_entity_definition(entity, domain, old_definition)
|
332
|
+
|
333
|
+
reference_anchor = bibdata.anchor
|
334
|
+
reference_clause = nil
|
335
|
+
|
336
|
+
concept = Stepmod::Utils::Concept.new(
|
337
|
+
designations: [entity.id],
|
338
|
+
definition: old_definition,
|
339
|
+
converted_definition: definition,
|
340
|
+
id: "#{reference_anchor}.#{reference_clause}",
|
341
|
+
reference_anchor: reference_anchor,
|
342
|
+
reference_clause: reference_clause,
|
343
|
+
file_path: Pathname.new(file_path)
|
344
|
+
.relative_path_from(stepmod_path),
|
345
|
+
language_code: "en",
|
346
|
+
)
|
347
|
+
|
348
|
+
next unless concept
|
349
|
+
|
350
|
+
current_part_modules_mim[schema.id] ||=
|
351
|
+
Glossarist::Collection.new
|
352
|
+
find_or_initialize_concept(
|
353
|
+
current_part_modules_mim[schema.id], concept
|
354
|
+
)
|
355
|
+
|
356
|
+
parsed_bibliography << bibdata
|
357
|
+
end
|
311
358
|
end
|
312
359
|
end
|
313
360
|
|
@@ -343,10 +390,73 @@ module Stepmod
|
|
343
390
|
end
|
344
391
|
|
345
392
|
def find_or_initialize_concept(collection, localized_concept)
|
393
|
+
concept_id = SecureRandom.uuid
|
394
|
+
|
346
395
|
concept = collection
|
347
|
-
.store(Glossarist::Concept.new(id:
|
396
|
+
.store(Glossarist::Concept.new(id: concept_id))
|
348
397
|
concept.add_l10n(localized_concept)
|
349
398
|
end
|
399
|
+
|
400
|
+
# rubocop:disable Layout/LineLength
|
401
|
+
def generate_entity_definition(entity, domain, old_definition)
|
402
|
+
return "" if entity.nil?
|
403
|
+
|
404
|
+
entity_text = if entity.subtype_of.size.zero?
|
405
|
+
"entity data type that represents " +
|
406
|
+
entity.id.indefinite_article + " **#{entity.id}** entity"
|
407
|
+
else
|
408
|
+
"entity data type that is a type of "+
|
409
|
+
"**#{entity.subtype_of.map(&:id).join('** and **')}** that represents " +
|
410
|
+
entity.id.indefinite_article + " **#{entity.id}** entity"
|
411
|
+
end
|
412
|
+
|
413
|
+
definition = <<~DEFINITION
|
414
|
+
=== #{entity.id}
|
415
|
+
domain:[#{domain}]
|
416
|
+
|
417
|
+
#{entity_text}
|
418
|
+
|
419
|
+
DEFINITION
|
420
|
+
|
421
|
+
unless old_definition.nil? || old_definition.blank?
|
422
|
+
definition << <<~OLD_DEFINITION
|
423
|
+
[NOTE]
|
424
|
+
--
|
425
|
+
#{old_definition&.strip}
|
426
|
+
--
|
427
|
+
OLD_DEFINITION
|
428
|
+
end
|
429
|
+
|
430
|
+
# We no longer add Notes and Examples to the extracted terms
|
431
|
+
# definition + format_remark_items(entity.remark_items)
|
432
|
+
|
433
|
+
definition
|
434
|
+
end
|
435
|
+
|
436
|
+
def format_remark_items(remark_items)
|
437
|
+
notes = remark_items.detect { |i| i.id == "__note" }&.remarks
|
438
|
+
examples = remark_items.detect { |i| i.id == "__example" }&.remarks
|
439
|
+
|
440
|
+
formatted_notes = format_remarks(notes, "NOTE", "--")
|
441
|
+
formatted_examples = format_remarks(examples, "example", "====")
|
442
|
+
|
443
|
+
formatted_notes + formatted_examples
|
444
|
+
end
|
445
|
+
# rubocop:enable Layout/LineLength
|
446
|
+
|
447
|
+
def format_remarks(remarks, remark_item_name, remark_item_symbol)
|
448
|
+
return "" if remarks.nil?
|
449
|
+
|
450
|
+
remarks.map do |remark|
|
451
|
+
<<~REMARK
|
452
|
+
|
453
|
+
[#{remark_item_name}]
|
454
|
+
#{remark_item_symbol}
|
455
|
+
#{remark}
|
456
|
+
#{remark_item_symbol}
|
457
|
+
REMARK
|
458
|
+
end.join
|
459
|
+
end
|
350
460
|
end
|
351
461
|
end
|
352
462
|
end
|
data/stepmod-utils.gemspec
CHANGED
@@ -32,7 +32,9 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.require_paths = ["lib"]
|
33
33
|
|
34
34
|
spec.add_runtime_dependency "concurrent-ruby"
|
35
|
+
spec.add_runtime_dependency "expressir"
|
35
36
|
spec.add_runtime_dependency "glossarist", "~> 0.1.0"
|
37
|
+
spec.add_runtime_dependency "indefinite_article"
|
36
38
|
spec.add_runtime_dependency "ptools"
|
37
39
|
spec.add_runtime_dependency "reverse_adoc", ">= 0.3.5"
|
38
40
|
spec.add_runtime_dependency "thor", ">= 0.20.3"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stepmod-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.17
|
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: 2022-
|
11
|
+
date: 2022-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: expressir
|
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: glossarist
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +52,20 @@ dependencies:
|
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: 0.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: indefinite_article
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: ptools
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,7 +206,9 @@ files:
|
|
178
206
|
- lib/stepmod/utils/converters/em_express_description.rb
|
179
207
|
- lib/stepmod/utils/converters/eqn.rb
|
180
208
|
- lib/stepmod/utils/converters/example.rb
|
209
|
+
- lib/stepmod/utils/converters/express_example.rb
|
181
210
|
- lib/stepmod/utils/converters/express_g.rb
|
211
|
+
- lib/stepmod/utils/converters/express_note.rb
|
182
212
|
- lib/stepmod/utils/converters/express_ref.rb
|
183
213
|
- lib/stepmod/utils/converters/express_ref_express_description.rb
|
184
214
|
- lib/stepmod/utils/converters/ext_description.rb
|
@@ -190,6 +220,7 @@ files:
|
|
190
220
|
- lib/stepmod/utils/converters/ignore.rb
|
191
221
|
- lib/stepmod/utils/converters/introduction.rb
|
192
222
|
- lib/stepmod/utils/converters/module_ref.rb
|
223
|
+
- lib/stepmod/utils/converters/module_ref_express_description.rb
|
193
224
|
- lib/stepmod/utils/converters/note.rb
|
194
225
|
- lib/stepmod/utils/converters/ol.rb
|
195
226
|
- lib/stepmod/utils/converters/p.rb
|
@@ -222,7 +253,7 @@ homepage: https://github.com/metanorma/stepmod-utils
|
|
222
253
|
licenses:
|
223
254
|
- BSD-2-Clause
|
224
255
|
metadata: {}
|
225
|
-
post_install_message:
|
256
|
+
post_install_message:
|
226
257
|
rdoc_options: []
|
227
258
|
require_paths:
|
228
259
|
- lib
|
@@ -237,8 +268,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
268
|
- !ruby/object:Gem::Version
|
238
269
|
version: '0'
|
239
270
|
requirements: []
|
240
|
-
rubygems_version: 3.
|
241
|
-
signing_key:
|
271
|
+
rubygems_version: 3.3.7
|
272
|
+
signing_key:
|
242
273
|
specification_version: 4
|
243
274
|
summary: Stepmod-utils is a toolkit that works on STEPmod data.
|
244
275
|
test_files: []
|