metanorma 2.5.9 → 2.5.12
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/Gemfile +3 -1
- data/Gemfile.devel +4 -4
- data/lib/metanorma/collection/manifest/manifest.rb +12 -0
- data/lib/metanorma/collection/renderer/fileprocess.rb +11 -1
- data/lib/metanorma/collection/renderer/renderer.rb +14 -0
- data/lib/metanorma/compile/fragment_parallel.rb +55 -1
- data/lib/metanorma/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: 7e5961ffa32ef7920792abf4fa81f46acf83eaa392ff0311b609522e176ff031
|
|
4
|
+
data.tar.gz: 46221dbc4e816d908c54646c99ed3932d9f42ad3c61dbd4984bddcb11e5df117
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b30c4548c26f3516272babb9e5cdde6fdeac27ddffa99c386573e91f4e4a1f473bb2db6a773a00eb1370690e0e7cef49a41ec0951656aca521f2cdd70a6801c4
|
|
7
|
+
data.tar.gz: 2d45ad4787e08c109be79012a618486f827107167acf5cbcedf5bfe2dbca02991932e37a68e9e53d7412ce708af5e9ff58c6d2063c1178beec84d55025a5f578
|
data/Gemfile
CHANGED
|
@@ -25,7 +25,9 @@ rescue StandardError
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
gem "debug"
|
|
28
|
-
gem "
|
|
28
|
+
gem "canon", "~> 0.3.122"
|
|
29
|
+
# lutaml-store 0.3.10 shipped conflict markers (lutaml-store#31); 0.3.11 fixes
|
|
30
|
+
gem "lutaml-store", "~> 0.3.11"
|
|
29
31
|
#gem "metanorma-iho"
|
|
30
32
|
#gem "metanorma-iso", ">= 3.2.0"
|
|
31
33
|
gem "mnconvert"
|
data/Gemfile.devel
CHANGED
|
@@ -9,15 +9,15 @@ gem "isodoc", github: "metanorma/isodoc", branch: "main"
|
|
|
9
9
|
gem "metanorma-iho", github: "metanorma/metanorma-iho", branch: "main"
|
|
10
10
|
gem "pubid", "~> 2.0.0.pre.alpha"
|
|
11
11
|
# The 1.9.356/0.5.13x pin pair worked around the leptris#1733 to_xml
|
|
12
|
-
# regression; retired — the
|
|
13
|
-
#
|
|
14
|
-
# leptris >= 1.9.
|
|
12
|
+
# regression; retired — moxml rides the 0.6 line (0.5 series gets no
|
|
13
|
+
# fixes; 0.6.0 removed the Opal surface, lutaml/moxml#516), which
|
|
14
|
+
# floors leptris >= 1.9.386 at load.
|
|
15
15
|
gem "leptris", "~> 1.9"
|
|
16
16
|
gem "relaton-cli", "~> 3.0.0.pre.alpha"
|
|
17
17
|
gem "glossarist", "~> 2.13"
|
|
18
18
|
gem "lutaml-model", "~> 0.8.107"
|
|
19
19
|
gem "metanorma-plugin-glossarist", "~> 0.5"
|
|
20
|
-
gem "moxml", "~> 0.
|
|
20
|
+
gem "moxml", "~> 0.6.0"
|
|
21
21
|
|
|
22
22
|
# Bridge: pubid 2.0.1 (and git main, until the PARG edition-2 migration
|
|
23
23
|
# lands) bakes grammars with the parsanol `mode` header alias, which
|
|
@@ -7,6 +7,11 @@ module Metanorma
|
|
|
7
7
|
class Manifest
|
|
8
8
|
# @return [Metanorma::Collection]
|
|
9
9
|
attr_reader :collection, :config, :lang, :script
|
|
10
|
+
# docref identifier replacements made during postprocessing: the
|
|
11
|
+
# original raw identifier (typically a GUID placeholder assigned to
|
|
12
|
+
# docrefs that declared none) mapped to the resolved identifier
|
|
13
|
+
# callers actually see (and that the file lookup keys entries by).
|
|
14
|
+
attr_reader :identifier_aliases
|
|
10
15
|
|
|
11
16
|
# @param level [String]
|
|
12
17
|
# @param dir [String]
|
|
@@ -17,6 +22,7 @@ module Metanorma
|
|
|
17
22
|
@collection = collection
|
|
18
23
|
@dir = dir
|
|
19
24
|
@disambig = ::Metanorma::Collection::Util::DisambigFiles.new
|
|
25
|
+
@identifier_aliases = {}
|
|
20
26
|
@config = manifest_postprocess(config)
|
|
21
27
|
end
|
|
22
28
|
|
|
@@ -57,6 +63,9 @@ module Metanorma
|
|
|
57
63
|
end
|
|
58
64
|
|
|
59
65
|
def manifest_identifier(config)
|
|
66
|
+
# capture before populate_id_from_doc: it replaces GUID identifiers
|
|
67
|
+
# in place, and the alias must map that original raw value.
|
|
68
|
+
original = config.identifier
|
|
60
69
|
no_id = populate_id_from_doc(config)
|
|
61
70
|
config.identifier =
|
|
62
71
|
if no_id && config.file # make file name be id
|
|
@@ -64,6 +73,9 @@ module Metanorma
|
|
|
64
73
|
else
|
|
65
74
|
@collection.class.resolve_identifier(config.identifier)
|
|
66
75
|
end
|
|
76
|
+
if original && original != config.identifier
|
|
77
|
+
@identifier_aliases[original] = config.identifier
|
|
78
|
+
end
|
|
67
79
|
Array(config.entry).each do |f|
|
|
68
80
|
manifest_identifier(f)
|
|
69
81
|
end
|
|
@@ -125,7 +125,7 @@ module Metanorma
|
|
|
125
125
|
# passes) but this run renders only the selected slice; the
|
|
126
126
|
# other members' sections are rendered by sibling runs over
|
|
127
127
|
# the same store.
|
|
128
|
-
@only_members and
|
|
128
|
+
@only_members and !render_member?(ident) and next
|
|
129
129
|
file, fname = @files.targetfile_id(ident, read: true)
|
|
130
130
|
@preserve_unresolved && member_stored?(ident, file) and next
|
|
131
131
|
warn "\n\n\n\n\nProcess #{fname}: #{DateTime.now.strftime('%H:%M:%S')}"
|
|
@@ -157,6 +157,16 @@ module Metanorma
|
|
|
157
157
|
ArtifactStore.content_hash(source, ::Metanorma::VERSION)
|
|
158
158
|
end
|
|
159
159
|
|
|
160
|
+
# Only-members selects docref identifiers; section-split outputs are
|
|
161
|
+
# derivative entries added at renderer init under their own keys,
|
|
162
|
+
# each carrying :parentid. A split output renders whenever its
|
|
163
|
+
# parent is selected, or a sliced reinflate ships index pages whose
|
|
164
|
+
# section pages are missing (iso-10303#811).
|
|
165
|
+
def render_member?(ident)
|
|
166
|
+
@only_member_keys.include?(ident) ||
|
|
167
|
+
@only_member_keys.include?(@files.get(ident, :parentid))
|
|
168
|
+
end
|
|
169
|
+
|
|
160
170
|
# Resume predicate: is this member already compiled and stored for its
|
|
161
171
|
# current input content? If so the isolated compile can skip it.
|
|
162
172
|
def member_stored?(ident, source)
|
|
@@ -139,6 +139,20 @@ module Metanorma
|
|
|
139
139
|
# list of files in the collection
|
|
140
140
|
@files = Metanorma::Collection::FileLookup.new(folder, self)
|
|
141
141
|
@files.add_section_split
|
|
142
|
+
# only_members carries the manifest's docref identifiers, but the
|
|
143
|
+
# file lookup keys entries by their resolved document identifiers
|
|
144
|
+
# (and section-split instances by "<docid> <title>"), so the
|
|
145
|
+
# selection must be translated into key space before the render
|
|
146
|
+
# loop - raw identifiers match nothing and the render skips every
|
|
147
|
+
# member while exiting zero (iso-10303#811's hollow artifact).
|
|
148
|
+
@only_member_keys =
|
|
149
|
+
if @only_members
|
|
150
|
+
aliases = collection.manifest.identifier_aliases || {}
|
|
151
|
+
@only_members.flat_map do |m|
|
|
152
|
+
resolved = aliases[m] || m
|
|
153
|
+
[resolved, @files.entry_key(resolved)]
|
|
154
|
+
end.compact.uniq
|
|
155
|
+
end
|
|
142
156
|
isodoc_populate
|
|
143
157
|
create_non_existing_directory(@outdir)
|
|
144
158
|
end
|
|
@@ -116,16 +116,70 @@ module Metanorma
|
|
|
116
116
|
lines = text.split("\n")
|
|
117
117
|
header, segments = segmentize(lines)
|
|
118
118
|
fragments = []
|
|
119
|
+
packer = fragment_packer(fragments, header)
|
|
119
120
|
segments.each do |seg|
|
|
120
121
|
if (mega = data2text_mega(seg))
|
|
122
|
+
packer.flush
|
|
121
123
|
mega_fragments(fragments, header, seg, mega)
|
|
122
124
|
else
|
|
123
|
-
|
|
125
|
+
packer.feed(seg[:lines])
|
|
124
126
|
end
|
|
125
127
|
end
|
|
128
|
+
packer.flush
|
|
126
129
|
fragments
|
|
127
130
|
end
|
|
128
131
|
|
|
132
|
+
# Pack consecutive segments into fragments of at least
|
|
133
|
+
# MIN_FRAG_BYTES source bytes: one fragment per clause multiplies
|
|
134
|
+
# the per-fragment fixed cost (relaton init, boilerplate, YAML
|
|
135
|
+
# loads — measured ~4s floor) by the clause count, which is a
|
|
136
|
+
# large LOSS on clause-dense documents with cheap clauses
|
|
137
|
+
# (jis-z-8301: 52 fragments, 2x slower than serial). Packing
|
|
138
|
+
# targets fragments substantial enough to amortise the fixed
|
|
139
|
+
# cost over workers x 2-3 fragments; documents whose clauses are
|
|
140
|
+
# already large are unaffected (one segment per fragment).
|
|
141
|
+
MIN_FRAG_BYTES = 40_000
|
|
142
|
+
|
|
143
|
+
# Accumulates consecutive whole segments across clause boundaries
|
|
144
|
+
# and emits fragments of at least MIN_FRAG_BYTES source bytes.
|
|
145
|
+
# Segments are never split: a boundary inside a clause separates
|
|
146
|
+
# the clause's heading from its subsections, and both halves then
|
|
147
|
+
# compile into morphed structures that lose their nested content.
|
|
148
|
+
class FragmentPacker
|
|
149
|
+
def initialize(min_bytes, &emit)
|
|
150
|
+
@min_bytes = min_bytes
|
|
151
|
+
@emit = emit
|
|
152
|
+
@buf = []
|
|
153
|
+
@bytes = 0
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def feed(seg_lines)
|
|
157
|
+
seg_bytes = seg_lines.sum { |l| l.bytesize + 1 }
|
|
158
|
+
if @bytes.positive? && @bytes >= @min_bytes
|
|
159
|
+
flush
|
|
160
|
+
end
|
|
161
|
+
@buf.concat(seg_lines)
|
|
162
|
+
@bytes += seg_bytes
|
|
163
|
+
if @bytes >= @min_bytes
|
|
164
|
+
flush
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def flush
|
|
169
|
+
return if @buf.empty?
|
|
170
|
+
|
|
171
|
+
@emit.call(@buf.dup)
|
|
172
|
+
@buf = []
|
|
173
|
+
@bytes = 0
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def fragment_packer(fragments, header, min_bytes: MIN_FRAG_BYTES)
|
|
178
|
+
FragmentPacker.new(min_bytes) do |body_lines|
|
|
179
|
+
fragments << new_fragment(fragments.size, header, body_lines)
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
129
183
|
def new_fragment(i, header, body_lines)
|
|
130
184
|
path = File.join(@dir, "#{@prefix}-#{i}.adoc")
|
|
131
185
|
File.write(path, (header + body_lines).join("\n").concat("\n"),
|
data/lib/metanorma/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.5.
|
|
4
|
+
version: 2.5.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: asciidoctor
|