metanorma 2.5.10 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 579747ce72c82e8b994e424d242896e19f5210dc622d6deff34747f613b1965a
4
- data.tar.gz: 54ce451903c665067260b1b6c95ae39418f0b5c9fd1c23452492c45504bc4f5e
3
+ metadata.gz: 7e5961ffa32ef7920792abf4fa81f46acf83eaa392ff0311b609522e176ff031
4
+ data.tar.gz: 46221dbc4e816d908c54646c99ed3932d9f42ad3c61dbd4984bddcb11e5df117
5
5
  SHA512:
6
- metadata.gz: 292f5591ffcc32fcec02f839eaf74bc12b863dd5c91d3d19848588b960df4ce89cdf6aa8db74e1ac0bf0fac5436098926e8058a55e6b7305d35e0f7faa333b5f
7
- data.tar.gz: 297bcc082477736b93b84bfb43e877f25b225273a1f2bbadd44889f6a21f06f26fdcfd012d01d1ca5cf6056f6ef157902f872c5e52067c3a2a5ad431ff913a3c
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 "equivalent-xml"
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 fleet line is leptris 1.9.376 + moxml 0.5.149
13
- # (all suites green), and the exact pin now deadlocks against vectory's
14
- # leptris >= 1.9.361.1 floor.
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.5"
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
@@ -163,8 +163,8 @@ module Metanorma
163
163
  # parent is selected, or a sliced reinflate ships index pages whose
164
164
  # section pages are missing (iso-10303#811).
165
165
  def render_member?(ident)
166
- @only_members.include?(ident) ||
167
- @only_members.include?(@files.get(ident, :parentid))
166
+ @only_member_keys.include?(ident) ||
167
+ @only_member_keys.include?(@files.get(ident, :parentid))
168
168
  end
169
169
 
170
170
  # Resume predicate: is this member already compiled and stored for its
@@ -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
- fragments << new_fragment(fragments.size, header, seg[:lines])
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"),
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "2.5.10".freeze
2
+ VERSION = "2.5.12".freeze
3
3
  end
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.10
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-03 00:00:00.000000000 Z
11
+ date: 2026-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor