metanorma-standoc 3.5.2 → 3.5.4

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: 7b54f086d63d7b8347f096a85f3fbeb80d3f8ac020361e5a76a24021477a19bb
4
- data.tar.gz: c692f65b9e5502326a88df11aeec4ff2f9a472252f58066d0895c71ed735c26b
3
+ metadata.gz: 226aa50e55b47cc5c2b1951a1ab7846b9d66beed7feed9ff508d482b499252d9
4
+ data.tar.gz: fb3b3cd3fa7e5e2c33d424a965a2f79dbc6f107ae02b728437d886e4592e7c86
5
5
  SHA512:
6
- metadata.gz: 8bddb1e65d7ee8f3fd9a45743893bab9d0aed3fe3f86037d7b3bd78372d9e393b41c1872e1a31d69c593c255c4e5f94caa61f66abe4c8eb34291ec58c6202791
7
- data.tar.gz: be777df6d608783776b699bbe53567d076197c04a5d217df3e2fe2bc7322c54627700e5d5618e2bedc3e7a0fa82138af0b121fcbd52313f312d3b94659ff3b27
6
+ metadata.gz: ae524cce75bd115159a547b56b134f21b1b2c46617a70b23a3dda2edd6dc0570ea1e59b5585540bef1835bafa727208707c311d71de8fd397e08ef167bd00825
7
+ data.tar.gz: 307205bf7fc9c09fd6eb662fc3d73215572ea9aa382d3f200593984ea14f49cd9f32c4fb4ae358e7af2c0ecd49cea45c995fd6b922dc5b09ed8b435e7c883191
@@ -26,7 +26,7 @@ module Metanorma
26
26
  init_attachments
27
27
  f = File.basename(path)
28
28
  File.exist?(File.join(@attachmentsdir, f)) and
29
- f += "_#{UUIDTools::UUID.random_create}"
29
+ f += "_#{Metanorma::Utils.random_uuid}"
30
30
  out_fld = File.join(@attachmentsdir, f)
31
31
  FileUtils.cp(path, out_fld)
32
32
  datauri_attachment(out_fld, bib.document)
@@ -46,6 +46,7 @@ module Metanorma
46
46
  def document1(node)
47
47
  init(node)
48
48
  ret = to_xml(makexml(node))
49
+ release_lutaml_caches
49
50
  outputs(node, ret) unless node.attr("nodoc") || !node.attr("docfile")
50
51
  ret
51
52
  end
@@ -66,6 +67,15 @@ module Metanorma
66
67
  OPEN_TITLE_NAME = %r{(<(title|name))}.freeze
67
68
  SOURCECODE_NAME = %r{(<sourcecode[^<>]*+>)\s++(<name[^<>]*+>(?>.*?</name>))\s++}m.freeze
68
69
 
70
+ # The lutaml plugin's macro caches hold fully parsed multi-GB XMI
71
+ # trees that serve only macro rendering during conversion; release
72
+ # them before the output phases stack their own document DOMs.
73
+ def release_lutaml_caches
74
+ return unless defined?(Metanorma::Plugin::Lutaml::CacheRegistry)
75
+
76
+ Metanorma::Plugin::Lutaml::CacheRegistry.clear_all
77
+ end
78
+
69
79
  def insert_xml_cr(doc)
70
80
  doc.gsub!(CLOSE_TAG, "\\1\n")
71
81
  doc.gsub!(OPEN_TITLE_NAME, "\n\\1")
@@ -8,7 +8,7 @@ module Metanorma
8
8
  module Blocks
9
9
  def id_attr(node = nil)
10
10
  anchor = node&.id
11
- { id: "_#{UUIDTools::UUID.random_create}",
11
+ { id: "_#{Metanorma::Utils.random_uuid}",
12
12
  anchor: anchor && !anchor.empty? ? anchor : nil,
13
13
  tag: node&.attr("tag"), columns: node&.attr("columns"),
14
14
  "multilingual-rendering": node&.attr("multilingual-rendering") }
@@ -12,7 +12,7 @@ module Metanorma
12
12
  m = %w(id name value disabled readonly checked maxlength minlength)
13
13
  .map { |a| attr[a] ? " #{map_attr_name(a)}='#{attr[a]}'" : nil }
14
14
  .compact
15
- m << " id='_#{UUIDTools::UUID.random_create}'"
15
+ m << " id='_#{Metanorma::Utils.random_uuid}'"
16
16
  %{<input type='#{target}' #{m.join}/>}
17
17
  end
18
18
  end
@@ -41,7 +41,7 @@ module Metanorma
41
41
  m = %w(id name rows cols value)
42
42
  .map { |a| attr[a] ? " #{map_attr_name(a)}='#{attr[a]}'" : nil }
43
43
  .compact
44
- m << " id='_#{UUIDTools::UUID.random_create}'"
44
+ m << " id='_#{Metanorma::Utils.random_uuid}'"
45
45
  %{<textarea #{m.join}/>}
46
46
  end
47
47
  end
@@ -59,7 +59,7 @@ module Metanorma
59
59
  m = %w(id name size disabled multiple value)
60
60
  .map { |a| attr[a] ? " #{map_attr_name(a)}='#{attr[a]}'" : nil }
61
61
  .compact
62
- m << " id='_#{UUIDTools::UUID.random_create}'"
62
+ m << " id='_#{Metanorma::Utils.random_uuid}'"
63
63
  out = Asciidoctor::Inline.new(parent, :quoted, attr["text"]).convert
64
64
  %{<select #{m.join}>#{out}</select>}
65
65
  end
@@ -65,7 +65,7 @@ module Metanorma
65
65
 
66
66
  def process(parent, target, attrs)
67
67
  out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
68
- id = "_#{UUIDTools::UUID.random_create}"
68
+ id = "_#{Metanorma::Utils.random_uuid}"
69
69
  %{<span id='#{id}' anchor='#{target}'>#{out}</span>}
70
70
  end
71
71
  end
@@ -77,7 +77,7 @@ module Metanorma
77
77
 
78
78
  def process(parent, target, attrs)
79
79
  out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
80
- id = "_#{UUIDTools::UUID.random_create}"
80
+ id = "_#{Metanorma::Utils.random_uuid}"
81
81
  %{<span id='#{id}' source='#{target}'>#{out}</span>}
82
82
  end
83
83
  end
@@ -145,7 +145,7 @@ module Metanorma
145
145
  def refitem_render_attrs(match, code)
146
146
  attr_code(anchor: match[:anchor], suppress_identifier: code[:dropid],
147
147
  amend: code[:amend], hidden: code[:hidden],
148
- id: "_#{UUIDTools::UUID.random_create}")
148
+ id: "_#{Metanorma::Utils.random_uuid}")
149
149
  end
150
150
 
151
151
  def refitem_render_formattedref(bibitem, title)
@@ -198,7 +198,7 @@ module Metanorma
198
198
 
199
199
  def ref_attributes(match)
200
200
  code = analyse_ref_code(match[:code])
201
- { anchor: match[:anchor], id: "_#{UUIDTools::UUID.random_create}",
201
+ { anchor: match[:anchor], id: "_#{Metanorma::Utils.random_uuid}",
202
202
  type: "standard",
203
203
  suppress_identifier: code[:dropid] || nil }
204
204
  end
@@ -41,11 +41,11 @@ module Metanorma
41
41
  end
42
42
 
43
43
  def add_id(node)
44
- node["id"] = "_#{UUIDTools::UUID.random_create}"
44
+ node["id"] = "_#{Metanorma::Utils.random_uuid}"
45
45
  end
46
46
 
47
47
  def add_id_text
48
- %(id = "_#{UUIDTools::UUID.random_create}")
48
+ %(id = "_#{Metanorma::Utils.random_uuid}")
49
49
  end
50
50
 
51
51
  def csv_split(text, delim = ";", encode: true)
@@ -162,7 +162,7 @@ module Metanorma
162
162
  # from that of current doc
163
163
  def separate_numbering_footnotes(docxml)
164
164
  docxml.xpath("//xmlns:fn").each do |f|
165
- f["reference"] = "_#{UUIDTools::UUID.random_create}_#{f['reference']}"
165
+ f["reference"] = "_#{Metanorma::Utils.random_uuid}_#{f['reference']}"
166
166
  end
167
167
  docxml
168
168
  end
@@ -8,7 +8,7 @@ module Metanorma
8
8
  class StructuredIdentifierType < Lutaml::Model::Serializable
9
9
  attribute :type, :string
10
10
  attribute :agency, :string, collection: true
11
- attribute :class, :string
11
+ attribute :identifier_class, :string
12
12
  attribute :docnumber, :string
13
13
  attribute :partnumber, :string
14
14
  attribute :edition, :string
@@ -27,7 +27,7 @@ module Metanorma
27
27
  element "structuredidentifier"
28
28
  map_attribute "type", to: :type
29
29
  map_element "agency", to: :agency
30
- map_attribute "class", to: :class
30
+ map_attribute "class", to: :identifier_class
31
31
  map_attribute "docnumber", to: :docnumber
32
32
  map_attribute "partnumber", to: :partnumber
33
33
  map_attribute "edition", to: :edition
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "3.5.2".freeze
22
+ VERSION = "3.5.4".freeze
23
23
  end
24
24
  end
@@ -92,7 +92,7 @@ module Metanorma
92
92
  ret = doc.xpath("//term").each_with_object({}) do |t, m|
93
93
  prefix = t.at("./domain")&.text
94
94
  t.xpath("./preferred//name").each do |n|
95
- ret = n.text
95
+ ret = designation_text(n)
96
96
  prefix and ret = "<#{prefix}> #{ret}"
97
97
  m[ret] ||= []
98
98
  m[ret] << t
@@ -101,6 +101,16 @@ module Metanorma
101
101
  preferred_validate_report(ret)
102
102
  end
103
103
 
104
+ # The designation text excludes nested index entries: <name> carries
105
+ # an <index><primary> duplicate of its own text, and counting that
106
+ # text doubled every designation ("Term abstract test methodabstract
107
+ # test method occurs twice...", metanorma-iso#1681).
108
+ def designation_text(name)
109
+ name = name.dup
110
+ name.xpath("./index").each(&:remove)
111
+ name.text
112
+ end
113
+
104
114
  def preferred_validate_report(terms)
105
115
  terms.each do |k, v|
106
116
  v.size > 1 or next
@@ -40,7 +40,7 @@ Gem::Specification.new do |spec|
40
40
  spec.add_dependency "metanorma-plugin-glossarist", "~> 0.5"
41
41
  spec.add_dependency "metanorma-plugin-lutaml", "~> 0.7.55" # LutamlDataPreprocessor shipped in 0.7.55
42
42
  spec.add_dependency "metanorma-plugin-plantuml", "~> 1.0.0"
43
- spec.add_dependency "metanorma-utils", "~> 2.0.1"
43
+ spec.add_dependency "metanorma-utils", "~> 2.0.10"
44
44
  spec.add_dependency "moxml", "~> 0.5.84"
45
45
  spec.add_dependency "leptris", "~> 1.9"
46
46
  spec.add_dependency "concurrent-ruby"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-standoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.2
4
+ version: 3.5.4
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-10-30 00:00:00.000000000 Z
11
+ date: 2026-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 2.0.1
173
+ version: 2.0.10
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 2.0.1
180
+ version: 2.0.10
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: moxml
183
183
  requirement: !ruby/object:Gem::Requirement