suma 0.5.13 → 0.5.15
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/note_processor.rb +14 -0
- data/lib/suma/staged_collection_builder.rb +24 -0
- data/lib/suma/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: e4e9d6b489b68d471befb51316694e2f84e400b891840861035d68fca951d5e9
|
|
4
|
+
data.tar.gz: 11d272b589da8fb0481487f25163a7c38840ede0ad4c26e094aa63133d6689b3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e3d3dfffd94269601f12d229584a842a2056e09792dc3955a24ac5788b0fbbd2fbbdcc1d67566c43c4bb72e863682557f7ab833feae3344cf1ca3dea92b5951
|
|
7
|
+
data.tar.gz: 12af99d3250d9fd0f9f342b7afead52e13f2d10715089908c0a59f3b59ce9c155f6842e5490d4db15b57dc938becd91cf0b3a058e55a9d45d86f3b2a105e5a4c
|
data/lib/suma/note_processor.rb
CHANGED
|
@@ -57,10 +57,24 @@ module Suma
|
|
|
57
57
|
notes = only_keep_first_sentence(notes)
|
|
58
58
|
notes = remove_see_content(notes)
|
|
59
59
|
notes = remove_redundant_note(notes)
|
|
60
|
+
notes = convert_legacy_bibitem_mentions(notes)
|
|
60
61
|
notes = remove_invalid_references(notes)
|
|
61
62
|
compare_with_definitions(notes, definitions)
|
|
62
63
|
end
|
|
63
64
|
|
|
65
|
+
# EXPRESS remarks carry bibliography cross-references as AsciiDoc
|
|
66
|
+
# derived anchors (<<ISO_10303-42_2022>>). The glossarist mention
|
|
67
|
+
# syntax for a bibliography entry is {{bib:<anchor>}}: translate
|
|
68
|
+
# them so the notes survive (remove_invalid_references drops any
|
|
69
|
+
# note still carrying a raw <<...>> block).
|
|
70
|
+
def convert_legacy_bibitem_mentions(notes)
|
|
71
|
+
notes.each do |note|
|
|
72
|
+
note.content = note.content.gsub(/<<([^<>]+)>>/) do
|
|
73
|
+
"{{bib:#{Regexp.last_match(1)}}}"
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
64
78
|
private
|
|
65
79
|
|
|
66
80
|
def build_initial_notes
|
|
@@ -168,6 +168,18 @@ module Suma
|
|
|
168
168
|
t0 = Time.now
|
|
169
169
|
begin
|
|
170
170
|
File.write(one_path, YAML.dump(manifest))
|
|
171
|
+
# The artefact store keys on the rendered document's own
|
|
172
|
+
# docid, while the parent reinflates by the docref
|
|
173
|
+
# identifier; members whose document docid differs from the
|
|
174
|
+
# docref (docrefs carrying metanorma's GUID marker) were
|
|
175
|
+
# therefore unrecoverable ("no stored artefact"). Alias the
|
|
176
|
+
# artefacts this render produced under the docref slug too.
|
|
177
|
+
member_id = manifest.dig("manifest", "docref", 0, "identifier")
|
|
178
|
+
id_slug = member_id.to_s
|
|
179
|
+
.gsub(/[^A-Za-z0-9._-]+/, "-").gsub(/-{2,}/, "-")
|
|
180
|
+
.gsub(/\A-|-\z/, "")
|
|
181
|
+
semantics_before = Dir.children(store_dir)
|
|
182
|
+
.select { |f| f.end_with?(".semantic.xml") }
|
|
171
183
|
compile = { install_fonts: false }
|
|
172
184
|
compile[:novalid] = true if no_valid == "1"
|
|
173
185
|
Metanorma::Collection.parse(one_path).render(
|
|
@@ -175,6 +187,18 @@ module Suma
|
|
|
175
187
|
preserve_unresolved: true, artifact_store_dir: store_dir,
|
|
176
188
|
compile: compile,
|
|
177
189
|
)
|
|
190
|
+
unless id_slug.empty?
|
|
191
|
+
produced = Dir.children(store_dir).select do |f|
|
|
192
|
+
f.end_with?(".semantic.xml")
|
|
193
|
+
end - semantics_before
|
|
194
|
+
produced.each do |f|
|
|
195
|
+
if (m = f.match(/\A(.*).([0-9a-f]+).semantic.xml\z/))
|
|
196
|
+
alias_name = "\#{id_slug}.\#{m[2]}.semantic.xml"
|
|
197
|
+
alias_path = File.join(store_dir, alias_name)
|
|
198
|
+
FileUtils.cp(File.join(store_dir, f), alias_path)
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
end
|
|
178
202
|
warn format("[staged worker %d] batch %d/%d member %d OK (%ds)",
|
|
179
203
|
Process.pid, idx + 1, count, j, Time.now - t0)
|
|
180
204
|
ensure
|
data/lib/suma/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.15
|
|
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-10-
|
|
11
|
+
date: 2026-10-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: expressir
|