stepmod-utils 0.3.28 → 0.3.29
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 +4 -4
- data/exe/stepmod-extract-concepts +56 -0
- data/lib/stepmod/utils/terms_extractor.rb +5 -1
- data/lib/stepmod/utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20464f99d7ac2bb1ef98259e6e66d356fde298ca671e67587a57e072fdaad77c
|
4
|
+
data.tar.gz: 21ef21a08bd1dd78dca12c5f960ff8b715dbfbb3183a2d6ae3bb2da39300f53a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e941853286cd6888c10323d8dce31b8347764e9588805eeae62248f8b1bcbf5c0f4e9324a24886704580dc874aa8ff92abc4d921a6bac224db3ff1983aa14707
|
7
|
+
data.tar.gz: 12ef57a910098c8f9cd9f98ad0af39072b6fb7496a6cbb7b238b401ee8f2f8dabaa4296ae2caaa3e5f24e54ce76674a76c8c8aa83c627b51e17d49706963c1b2
|
@@ -139,8 +139,47 @@ def replace_content(content)
|
|
139
139
|
content
|
140
140
|
end
|
141
141
|
|
142
|
+
def extract_bibliographies(concepts, bibliographies)
|
143
|
+
concepts.each do |concept|
|
144
|
+
sources = concept.default_lang.sources
|
145
|
+
|
146
|
+
sources.each do |source|
|
147
|
+
next if bibliographies[source.origin.text]
|
148
|
+
|
149
|
+
bibliographies[source.origin.text] = {
|
150
|
+
"type" => source.type,
|
151
|
+
"origin" => {
|
152
|
+
"ref" => source.origin.text,
|
153
|
+
# "link" => source.origin.link,
|
154
|
+
},
|
155
|
+
}
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def extract_sections(concepts, container)
|
161
|
+
concepts.each do |concept|
|
162
|
+
domain = concept.default_lang.domain
|
163
|
+
|
164
|
+
next if container[domain]
|
165
|
+
|
166
|
+
container[domain] = {
|
167
|
+
"domain" => domain,
|
168
|
+
"title" => domain.split(":").last.strip,
|
169
|
+
}
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
yaml_outputs = {
|
174
|
+
clause_4_sections: {},
|
175
|
+
clause_5_sections: {},
|
176
|
+
bibliographies: {}
|
177
|
+
}
|
178
|
+
|
142
179
|
part_resources.each do |(_bibdata, current_part_resources)|
|
143
180
|
current_part_resources.save_to_files(output_dir)
|
181
|
+
extract_sections(current_part_resources, yaml_outputs[:clause_4_sections])
|
182
|
+
extract_bibliographies(current_part_resources, yaml_outputs[:bibliographies])
|
144
183
|
end
|
145
184
|
log "INFO: part_resources written to YAML files in #{output_dir}"
|
146
185
|
|
@@ -150,12 +189,16 @@ end.each do |(_bibdata, part_modules_arm, part_modules_mim)|
|
|
150
189
|
unless part_modules_arm.empty?
|
151
190
|
part_modules_arm.values.map do |managed_concept|
|
152
191
|
managed_concept.save_to_files(output_dir)
|
192
|
+
extract_sections(managed_concept, yaml_outputs[:clause_5_sections])
|
193
|
+
extract_bibliographies(managed_concept, yaml_outputs[:bibliographies])
|
153
194
|
end
|
154
195
|
end
|
155
196
|
|
156
197
|
unless part_modules_mim.empty?
|
157
198
|
part_modules_mim.values.map do |managed_concept|
|
158
199
|
managed_concept.save_to_files(output_dir)
|
200
|
+
extract_sections(managed_concept, yaml_outputs[:clause_5_sections])
|
201
|
+
extract_bibliographies(managed_concept, yaml_outputs[:bibliographies])
|
159
202
|
end
|
160
203
|
end
|
161
204
|
end
|
@@ -163,3 +206,16 @@ log "INFO: part_modules written to YAML files in #{output_dir}"
|
|
163
206
|
|
164
207
|
resource_concepts.save_to_files(output_dir)
|
165
208
|
log "INFO: resource_concepts written to YAML files in #{output_dir}"
|
209
|
+
|
210
|
+
extract_sections(resource_concepts, yaml_outputs[:clause_4_sections])
|
211
|
+
extract_bibliographies(resource_concepts, yaml_outputs[:bibliographies])
|
212
|
+
|
213
|
+
{
|
214
|
+
clause_4_sections: "resource_sections.yaml",
|
215
|
+
clause_5_sections: "module_sections.yaml",
|
216
|
+
bibliographies: "bib.yaml"
|
217
|
+
}.each_pair do |var, filename|
|
218
|
+
path = File.join(output_dir, filename)
|
219
|
+
File.write(path, yaml_outputs[var].values.to_yaml)
|
220
|
+
log "INFO: #{var.to_s} written to #{path}."
|
221
|
+
end
|
@@ -382,7 +382,11 @@ module Stepmod
|
|
382
382
|
{
|
383
383
|
"type" => "authoritative",
|
384
384
|
"ref" => bibdata.docid,
|
385
|
-
|
385
|
+
|
386
|
+
# TODO: Commenting out link right now since it's not needed.
|
387
|
+
# GitHub: metanorma/iso-10303-2#286
|
388
|
+
#
|
389
|
+
# "link" => "https://www.iso.org/standard/32858.html",
|
386
390
|
},
|
387
391
|
],
|
388
392
|
notes: notes,
|
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.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|