suma 0.5.29 → 0.5.31
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/lib/suma/cli/build.rb +13 -8
- data/lib/suma/cli/core.rb +3 -0
- data/lib/suma/note_processor.rb +10 -1
- data/lib/suma/schema_compiler.rb +1 -1
- data/lib/suma/term_extractor.rb +39 -1
- data/lib/suma/version.rb +1 -1
- data/suma.gemspec +2 -0
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 988b5f4b9f5dd2979ce2b2b38d58b81a26c28deea570d1ef81521c38b213f289
|
|
4
|
+
data.tar.gz: b311e9bfbec6e5744d9c1b903d67da6152f4c0e09037158280db52d0ee225a67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 112f94d3a4af0a568e46bf17511f635902c4b6397686b723ba1dabf0d1f5e3472c2f84164d281eac1154d3b606600dc3eaf41d8044966b07c3cc7b232b8d77cb
|
|
7
|
+
data.tar.gz: 8dfaa618a8ae1ad12761fb47c43d669bab381d002839e9129e2785fb6e407df765110924df99f23cac929855e49669d4c5c8ab2e8890f05b991aca458424a81d
|
data/lib/suma/cli/build.rb
CHANGED
|
@@ -88,13 +88,20 @@ module Suma
|
|
|
88
88
|
private
|
|
89
89
|
|
|
90
90
|
def run(manifest, options)
|
|
91
|
-
schemas_all_path = options[:schemas_all_path] ||
|
|
92
|
-
manifest.gsub("metanorma", "schemas")
|
|
93
|
-
|
|
94
91
|
Processor.new(
|
|
95
92
|
metanorma_yaml_path: manifest,
|
|
96
|
-
schemas_all_path: schemas_all_path,
|
|
97
|
-
|
|
93
|
+
schemas_all_path: schemas_all_path(manifest, options),
|
|
94
|
+
**processor_options(options),
|
|
95
|
+
**staged_options(options),
|
|
96
|
+
).run
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def schemas_all_path(manifest, options)
|
|
100
|
+
options[:schemas_all_path] || manifest.gsub("metanorma", "schemas")
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def processor_options(options)
|
|
104
|
+
{ compile: options[:compile],
|
|
98
105
|
output_directory: "_site",
|
|
99
106
|
incremental: options[:incremental],
|
|
100
107
|
state_file: options[:state_file],
|
|
@@ -104,9 +111,7 @@ module Suma
|
|
|
104
111
|
sign_key: options[:sign_key],
|
|
105
112
|
no_valid: options[:no_valid],
|
|
106
113
|
ext: options[:ext],
|
|
107
|
-
unresolved_eref_markers: options[:unresolved_eref_markers]
|
|
108
|
-
**staged_options(options),
|
|
109
|
-
).run
|
|
114
|
+
unresolved_eref_markers: options[:unresolved_eref_markers] }
|
|
110
115
|
end
|
|
111
116
|
|
|
112
117
|
def staged_options(options)
|
data/lib/suma/cli/core.rb
CHANGED
|
@@ -23,6 +23,9 @@ module Suma
|
|
|
23
23
|
"Build collection specified in site manifest (`metanorma*.yml`)"
|
|
24
24
|
# Mirrors so Core accepts the switches Cli::Build reparses; the inner
|
|
25
25
|
# class owns their declarations.
|
|
26
|
+
option :ext, type: :string, aliases: "-x",
|
|
27
|
+
desc: "Comma-separated schema-doc output formats " \
|
|
28
|
+
"(e.g. html) - overrides the template defaults"
|
|
26
29
|
option :compile, type: :boolean, default: true,
|
|
27
30
|
desc: "Compile or skip compile of collection"
|
|
28
31
|
option :schemas_all_path, type: :string, aliases: "-s",
|
data/lib/suma/note_processor.rb
CHANGED
|
@@ -78,12 +78,21 @@ module Suma
|
|
|
78
78
|
private
|
|
79
79
|
|
|
80
80
|
def build_initial_notes
|
|
81
|
-
trimmed = trim_definition(
|
|
81
|
+
trimmed = trim_definition(remarks_without_figure_blocks)
|
|
82
82
|
return [] unless trimmed && !trimmed.empty?
|
|
83
83
|
|
|
84
84
|
[Glossarist::V3::DetailedDefinition.new(content: trimmed)]
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
+
# Expressg figure blocks are figure metadata, not note prose: their
|
|
88
|
+
# `.svgmap` hotspot lists render through the schema document itself,
|
|
89
|
+
# and treating them as notes leaks `<<express:...>>` hotspot targets
|
|
90
|
+
# into concept notes as mis-namespaced citations that fold corrupt
|
|
91
|
+
# at rest (iso-10303 part-2: 2 corrupted mentions).
|
|
92
|
+
def remarks_without_figure_blocks
|
|
93
|
+
Array(remarks).reject { |remark| remark.to_s.include?("[.svgmap]") }
|
|
94
|
+
end
|
|
95
|
+
|
|
87
96
|
def trim_definition(definition)
|
|
88
97
|
return nil if definition.nil? || definition.empty?
|
|
89
98
|
|
data/lib/suma/schema_compiler.rb
CHANGED
data/lib/suma/term_extractor.rb
CHANGED
|
@@ -288,7 +288,8 @@ module Suma
|
|
|
288
288
|
"#{entity_name_to_text(entity.id)} #{entity_ref}"
|
|
289
289
|
else
|
|
290
290
|
entity_subtypes = subtypes.map do |e|
|
|
291
|
-
|
|
291
|
+
owner = declaring_schema_id(schema, e.id) || schema.id
|
|
292
|
+
urn_mention(express_entity_urn("#{owner}.#{e.id}"), e.id)
|
|
292
293
|
end
|
|
293
294
|
|
|
294
295
|
"#{entity_type} that is a type of " \
|
|
@@ -297,5 +298,42 @@ module Suma
|
|
|
297
298
|
"#{entity_name_to_text(entity.id)} #{entity_ref}"
|
|
298
299
|
end
|
|
299
300
|
end
|
|
301
|
+
|
|
302
|
+
# The schema an imported declaration is declared in, resolved through
|
|
303
|
+
# +schema+'s interfaces — the same resolution the source remark xrefs
|
|
304
|
+
# carry: a local declaration wins; then a USE FROM item naming the
|
|
305
|
+
# declaration; then a single bare USE FROM. nil leaves the citation
|
|
306
|
+
# unqualified-with-owner, since inventing an owner would be wrong
|
|
307
|
+
# (iso-10303#835: the citing schema is not the declaring schema).
|
|
308
|
+
def declaring_schema_id(schema, entity_id)
|
|
309
|
+
return schema.id if schema.entities.any? { |e| e.id == entity_id }
|
|
310
|
+
|
|
311
|
+
item_matches = []
|
|
312
|
+
bare_sources = []
|
|
313
|
+
schema.interfaces.each do |interface|
|
|
314
|
+
source = interface.schema&.id
|
|
315
|
+
next unless source && interface.kind == "USE"
|
|
316
|
+
|
|
317
|
+
items = Array(interface.items)
|
|
318
|
+
if items.empty?
|
|
319
|
+
bare_sources << source
|
|
320
|
+
elsif items.any? { |item| import_item_id(item) == entity_id }
|
|
321
|
+
item_matches << source
|
|
322
|
+
end
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
if item_matches.uniq.one?
|
|
326
|
+
item_matches.first
|
|
327
|
+
elsif item_matches.empty? && bare_sources.uniq.one?
|
|
328
|
+
bare_sources.first
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
# The imported declaration's name as written in the USE FROM list:
|
|
333
|
+
# InterfaceItem carries it on #ref (the reference node), with #id
|
|
334
|
+
# holding the local rename when present.
|
|
335
|
+
def import_item_id(item)
|
|
336
|
+
item.ref&.id || item.id
|
|
337
|
+
end
|
|
300
338
|
end
|
|
301
339
|
end
|
data/lib/suma/version.rb
CHANGED
data/suma.gemspec
CHANGED
|
@@ -33,6 +33,8 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
|
33
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
34
34
|
spec.require_paths = ["lib"]
|
|
35
35
|
|
|
36
|
+
# Bundled gem required directly by lib code: base64 in jsdai/figure_image.rb (metanorma/metanorma#669)
|
|
37
|
+
spec.add_dependency "base64"
|
|
36
38
|
spec.add_dependency "expressir"
|
|
37
39
|
spec.add_dependency "glossarist", "~> 2.8", ">= 2.8.7"
|
|
38
40
|
spec.add_dependency "leptris"
|
metadata
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: suma
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.31
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: base64
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
13
27
|
- !ruby/object:Gem::Dependency
|
|
14
28
|
name: expressir
|
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|