metanorma-standoc 3.4.0 → 3.4.1

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: bd7bb1c2eddf906901c649dfebebe9ed9a927acb580f801230c0ddb5ef7ccf6e
4
- data.tar.gz: 851c87886924185eb0923d596c68004339b61bc853c523f29d8d56817941798c
3
+ metadata.gz: 3eb29c4fd8703e5cfb83ca8be2d9bf331e64ef55f79b5a0c6fbc40527aec8f6f
4
+ data.tar.gz: 967a36a66206d56c88152c1ee82782a27876164319b6d30d6a6be7c54a6887e6
5
5
  SHA512:
6
- metadata.gz: 9149dd7dcef66682f4577dd4fbca61d45ca47b982f69f04917b7302647472db77fc3ea20d95cfeaa7c8ca97cc94a71f4d447bf7bd34ab8bfcbbede32f6c44127
7
- data.tar.gz: a1a8ebe497caf7e545865d232d2f5bff903d687845bc4de9dd584cea7fa8ea4764d1ef4e7cd0cb4fb88d83405fc30cdc60335ce38a63af8b5549c6b2e95eef75
6
+ metadata.gz: e88f192913aca8f905983eaf547f8cacbdc6d74a7046e78c9ce7cbb0a958130d8ecf5598a5164cc1faa3e77080180dee4cc5025278b9a6ee8a0363c04e6f7cfc
7
+ data.tar.gz: 0c90ed2192f721f0f02302808e2be444d1f81b58e853fa0db7be4c38ae198d3774f37ca6f89c6913cc008e34ed549e2d79a14fb6b2161e667824dc6c1c9f4099
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  # Auto-generated by Cimas: Do not edit it manually!
2
2
  # See https://github.com/metanorma/cimas
3
3
  inherit_from:
4
- - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
4
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
5
 
6
6
  # local repo-specific modifications
7
7
  # ...
@@ -1840,20 +1840,33 @@ def from_xml(xml)
1840
1840
  # <bibitem> elements are always flavor-independent: use the base
1841
1841
  # Relaton::Bib::Bibitem regardless of collection flavor.
1842
1842
  # <bibdata> elements carry flavor-specific metadata (<ext> etc.) and
1843
- # must be parsed with the appropriate flavor Bibdata class.
1843
+ # must be parsed with the appropriate flavor Item class.
1844
1844
  r = if b.name == "bibitem"
1845
1845
  ::Relaton::Bib::Bibitem
1846
1846
  else
1847
- mn2relaton_parser(xml.root["flavor"], bibdata: true)
1847
+ mn2relaton_parser(xml.root["flavor"])
1848
1848
  end
1849
1849
  b.xpath("//xmlns:fmt-identifier").each(&:remove)
1850
1850
  r.from_xml(b.to_xml)
1851
1851
  end
1852
1852
  ```
1853
1853
 
1854
- The `mn2relaton_parser` method is unchanged the `bibdata:` keyword parameter is
1855
- retained for future use. The `bibdata: false` / Bibitem-returning branches in
1856
- `mn2relaton_parser` are now unreachable from `from_xml` but remain in place.
1854
+ The `mn2relaton_parser` method now returns the flavor's `Item` class (e.g.
1855
+ `Relaton::Iso::Item`) instead of `Bibdata`/`Bibitem`. The `bibdata:` keyword
1856
+ parameter has been removed.
1857
+
1858
+ This is necessary because in Relaton 2.x, `BibdataShared` (defined in
1859
+ `Relaton::Bib`) sets `model ItemData` inside `class_eval`, and Ruby constant
1860
+ lookup resolves `ItemData` in the **definer's** scope (`Relaton::Bib`), not the
1861
+ includer's scope. So `Relaton::Iso::Bibdata.from_xml` produces a generic
1862
+ `Relaton::Bib::ItemData` instance. When `to_xml(bibdata: true)` is called, the
1863
+ generic instance delegates to `Relaton::Bib::Bibdata.to_xml`, which does not know
1864
+ about flavor-specific `ext` attributes, causing a crash.
1865
+
1866
+ By contrast, `Relaton::Iso::Item` explicitly declares `model ItemData` in its own
1867
+ class body within `Relaton::Iso`, correctly resolving to `Relaton::Iso::ItemData`.
1868
+ The resulting `ItemData` instance's `to_xml(bibdata: true)` correctly delegates to
1869
+ `Relaton::Iso::Bibdata.to_xml(self)` via the `namespace` helper.
1857
1870
 
1858
1871
  **Impact on round-trip fidelity:**
1859
1872
 
@@ -0,0 +1,8 @@
1
+ require "isodoc"
2
+
3
+ module IsoDoc
4
+ module Standoc
5
+ class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
6
+ end
7
+ end
8
+ end
@@ -1,4 +1,5 @@
1
1
  require "relaton/bib"
2
+ require "relaton/bib/hash_parser_v1"
2
3
 
3
4
  module Metanorma
4
5
  module Standoc
@@ -225,6 +225,7 @@ module Metanorma
225
225
  end
226
226
  end
227
227
 
228
+ # (e.g. in ISO, reformatting identifier)
228
229
  def docidentifier_cleanup(xmldoc); end
229
230
  end
230
231
  end
@@ -143,7 +143,7 @@ module Metanorma
143
143
  unnumbered_blocks_cleanup(xmldoc)
144
144
  termdocsource_cleanup(xmldoc) # feeds: metadata_cleanup
145
145
  metadata_cleanup(xmldoc) # feeds: boilerplate_cleanup, bibdata_cleanup,
146
- # docidentifier_cleanup (in generic: template)
146
+ # docidentifier_cleanup
147
147
  misccontainer_cleanup(xmldoc)
148
148
  sections_cleanup(xmldoc) # feeds: obligations_cleanup, toc_cleanup,
149
149
  # floatingtitle_cleanup
@@ -3,7 +3,8 @@ module Metanorma
3
3
  module Reqt
4
4
  def requirement_cleanup(xmldoc)
5
5
  @reqt_models ||=
6
- @conv.requirements_processor.new({ default: @default_requirement_model })
6
+ @conv.requirements_processor.new({ conv: @conv.presentation_xml_converter(Metanorma::Standoc::EmptyAttr.new),
7
+ default: @default_requirement_model })
7
8
  @reqt_models.requirement_cleanup(xmldoc)
8
9
  end
9
10
  end
@@ -52,9 +52,9 @@ module Metanorma
52
52
  SYMABBR = "[.//definitions[@type = 'symbols']]" \
53
53
  "[.//definitions[@type = 'abbreviated_terms']]".freeze
54
54
  SYM_NO_ABBR = "[.//definitions[@type = 'symbols']]" \
55
- "[not(.//definitions[@type = 'abbreviated_terms'])]".freeze
55
+ "[not(.//definitions[@type = 'abbreviated_terms'])]".freeze
56
56
  ABBR_NO_SYM = "[.//definitions[@type = 'abbreviated_terms']]" \
57
- "[not(.//definitions[@type = 'symbols'])]".freeze
57
+ "[not(.//definitions[@type = 'symbols'])]".freeze
58
58
 
59
59
  def section_names_terms_cleanup(xml)
60
60
  section_names_definitions(xml)
@@ -30,13 +30,10 @@ module Metanorma
30
30
  end
31
31
 
32
32
  def lines_strip_textspan(span, nextspan)
33
- #AAA
34
33
  lines = []
35
34
  span[:text] and
36
35
  lines = span[:text].lines[0..-2].map(&:rstrip) <<
37
36
  span[:text].lines[-1]&.sub(/\n$/, "")
38
- #lines = span[:text].lines[0..-2].map(&:rstrip) <<
39
- #span[:text].lines[-1]&.sub(/\n$/, "")
40
37
  # no final line rstrip: can be space linking to next line
41
38
  span[:last] or lines << nextspan[:text].lines.first # next token context
42
39
  lines
@@ -57,9 +54,9 @@ module Metanorma
57
54
 
58
55
  def gather_text_for_linebreak_cleanup1(block)
59
56
  block.xpath(".//text() | .//eref[not(text())] | " \
60
- ".//xref[not(text())] | .//termref[not(text())] | " \
61
- ".//link[not(text())] ").map do |e|
62
- #x = block.xpath(".//text()").map do |e|
57
+ ".//xref[not(text())] | .//termref[not(text())] | " \
58
+ ".//link[not(text())] ").map do |e|
59
+ # x = block.xpath(".//text()").map do |e|
63
60
  { elem: e, text: e.text, stem: ancestor_include?(e, %w(stem)),
64
61
  skip: ancestor_include?(e, PRESERVE_LINEBREAK_ELEMENTS) }
65
62
  end
@@ -91,17 +88,6 @@ module Metanorma
91
88
  end
92
89
  end
93
90
 
94
- #AAA
95
- # "abc<tag/>", def => "abc",<tag/> def
96
- # TODO?
97
- #def uninterrupt_quotes_around_xml1(xmldoc)
98
- #xmldoc.xpath("//text()[preceding-sibling::*[1]]").each do |n|
99
- #uninterrupt_quotes_around_xml_skip(n) and next
100
- #uninterrupt_quotes_around_xml1(n.previous)
101
- #end
102
- #end
103
-
104
-
105
91
  IGNORE_QUOTES_ELEMENTS =
106
92
  %w(pre tt sourcecode stem asciimath figure bibdata passthrough
107
93
  identifier metanorma-extension boilerplate).freeze
@@ -87,7 +87,8 @@ module Metanorma
87
87
 
88
88
  def xref_compound_cleanup(xmldoc)
89
89
  xmldoc.xpath("//xref").each do |x|
90
- x["target"].include?(";") or next
90
+ next unless x["target"]&.include?(";")
91
+
91
92
  locations = x["target"].split(";")
92
93
  x["target"] = locations.first.sub(/^[^!]*!/, "")
93
94
  xref_compound_cleanup1(x, locations)
@@ -109,8 +109,10 @@ module Metanorma
109
109
  def init_reqt(node)
110
110
  @default_requirement_model = node.attr("requirements-model") ||
111
111
  default_requirement_model
112
+ @default_requirement_render = node.attr("requirements-render")
113
+ conv = presentation_xml_converter(EmptyAttr.new)
112
114
  @reqt_models = requirements_processor
113
- .new({ default: @default_requirement_model })
115
+ .new({ default: @default_requirement_model, conv: conv })
114
116
  end
115
117
 
116
118
  def init_toc(node)
@@ -3,213 +3,213 @@ module Metanorma
3
3
  class Converter
4
4
  # rubocop:disable Naming/VariableNumber
5
5
  STANDOC_LOG_MESSAGES = {
6
- "STANDOC_1": { category: "Include",
7
- error: "Specified boilerplate file does not exist: %s",
8
- severity: 0 },
9
- "STANDOC_2": { category: "Table", error: "Empty table",
10
- severity: 0 },
11
- "STANDOC_3": { category: "Crossreferences",
12
- error: "invalid index \"%s\" cross-reference: " \
13
- "wrong number of attributes in `index:%s[%s]`",
14
- severity: 0 },
15
- "STANDOC_4": { category: "Table",
16
- error: "Table rows in table %s: check rowspan",
17
- severity: 0 },
18
- "STANDOC_5": { category: "Table",
19
- error: "Table exceeds maximum number of columns defined (%s)",
20
- severity: 0 },
21
- "STANDOC_6": { category: "Maths",
22
- error: "Malformed MathML: %s\n%s",
23
- severity: 0 },
24
- "STANDOC_7": { category: "Metanorma XML Syntax", error: "%s",
25
- severity: 2 },
26
- "STANDOC_8": { category: "Anchors", error: "Malformed URI: %s",
27
- severity: 0 },
28
- "STANDOC_9": { category: "Bibliography",
29
- error: "Attachment %s does not exist",
30
- severity: 0 },
31
- "STANDOC_10": { category: "Anchors",
32
- error: "The following reference is missing an anchor:\n%s",
33
- severity: 1 },
34
- "STANDOC_11": { category: "Bibliography",
35
- error: "Reference %s is missing a title",
36
- severity: 1 },
37
- "STANDOC_12": { category: "Bibliography",
38
- error: "Reference %s is missing a document identifier (docid)",
39
- severity: 1 },
40
- "STANDOC_13": { category: "AsciiDoc Input",
41
- error: "term reference not in expected format:%s",
42
- severity: 1 },
43
- "STANDOC_14": { category: "Style",
44
- error: "Style override set for ordered list",
45
- severity: 2 },
46
- "STANDOC_15": { category: "Crossreferences",
47
- error: "Could not resolve footnoteblock:[%s]",
48
- severity: 1 },
49
- "STANDOC_16": { category: "AsciiDoc Input",
50
- error: "Section not marked up as [bibliography]!",
51
- severity: 2 },
52
- "STANDOC_17": { category: "Bibliography",
53
- error: "ERROR: No document identifier retrieved for %s",
54
- severity: 2 },
55
- "STANDOC_18": { category: "Bibliography",
56
- error: "ERROR: No title retrieved for %s", severity: 2 },
57
- "STANDOC_19": { category: "Bibliography",
58
- error: "Cannot find reference %s for local Relaton " \
59
- "data source %s", severity: 0 },
60
- "STANDOC_20": { category: "AsciiDoc Input",
61
- error: "Metadata definition list does not follow a term designation",
62
- severity: 2 },
63
- "STANDOC_21": { category: "Terms",
64
- error: "Removed duplicate designation %s",
65
- severity: 2 },
66
- "STANDOC_22": { category: "Bibliography",
67
- error: "Term \"%s\" does not match IEV %s \"%s\"",
68
- severity: 1 },
69
- "STANDOC_23": { category: "Anchors",
70
- error: "Concept cross-reference error: %s",
71
- severity: 0 },
72
- "STANDOC_24": { category: "Terms",
73
- error: "Term %s occurs twice as preferred designation: %s",
74
- severity: 1 },
75
- "STANDOC_25": { category: "Terms", severity: 0,
76
- error: <<~ERROR.freeze },
77
- Clause not recognised as a term clause, but contains designation markup
78
- (<code>preferred:[], admitted:[], alt:[], deprecated:[]</code>):<br/>
79
- %s</br>
80
- Ensure the parent clause is recognised as a terms clause by inserting <code>[heading=terms and definitions]</code> above the title,
81
- in case the heading is not automatically recognised. See also <a href="https://www.metanorma.org/author/topics/sections/concepts/#clause-title">Metanorma documentation</a>.
82
- ERROR
83
- "STANDOC_26": { category: "AsciiDoc Input",
84
- error: "Error: Symbol reference in `symbol[%s]` missing: \"%s\" is not defined in document",
85
- severity: 1 },
86
- "STANDOC_27": { category: "AsciiDoc Input",
87
- error: "Error: Term reference to `%s` missing: \"%s\" is not defined in document%s",
88
- severity: 1 },
89
- "STANDOC_28": { category: "Crossreferences",
90
- error: "term source %s not referenced",
91
- severity: 1 },
92
- "STANDOC_29": { category: "AsciiDoc Input",
93
- error: "converter missing for %s node in Metanorma backend",
94
- severity: 1 },
95
- "STANDOC_30": { category: "Crossreferences",
96
- error: "%s does not have a corresponding anchor ID in the bibliography!",
97
- severity: 2 },
98
- "STANDOC_31": { category: "Crossreferences",
99
- error: "Illegal cross-reference connective: %s",
100
- severity: 0 },
101
- "STANDOC_32": { category: "Crossreferences",
102
- error: "%s does not have a corresponding anchor ID in the bibliography!",
103
- severity: 2 },
104
- "STANDOC_33": { category: "Maths",
105
- error: "Invalid MathML: %s\n %s%s",
106
- severity: 0 },
107
- "STANDOC_34": { category: "Style",
108
- error: "There is an instance of %s nested within %s",
109
- severity: 2 },
110
- "STANDOC_35": { category: "Style",
111
- error: "There is a crossreference to an instance of %s nested within %s: %s",
112
- severity: 2 },
113
- "STANDOC_36": { category: "Anchors",
114
- error: "ID %s has already been used at line %s",
115
- severity: 0 },
116
- "STANDOC_37": { category: "Bibliography",
117
- error: "Cannot process format %s for local Relaton data source %s",
118
- severity: 0 },
119
- "STANDOC_38": { category: "Anchors",
120
- error: "Crossreference target %s is undefined",
121
- severity: 1 },
122
- "STANDOC_39": { category: "Blocks",
123
- error: "%s is empty",
124
- severity: 1 },
125
- "STANDOC_40": { category: "Bibliography",
126
- error: "Could not retrieve %s: no access to online site",
127
- severity: 1 },
128
- "STANDOC_41": { category: "Include",
129
- error: "Unresolved directive %s",
130
- severity: 0 },
131
- "STANDOC_42": { category: "Metanorma XML Syntax",
132
- error: "Invalid passthrough content: %s\n" \
133
- "This is not valid Metanorma XML. If you intended a different format, such as HTML, you need to specify `format=` on the pass markup;\n" \
134
- "refer to https://www.metanorma.org/author/topics/blocks/passthroughs/",
135
- severity: 0 },
136
- "STANDOC_43": { category: "AsciiDoc Input",
137
- error: <<~REF.freeze, severity: 1 },
138
- no anchor on reference, markup may be malformed: see
139
- https://www.metanorma.org/author/topics/sections/bibliography/ ,
140
- https://www.metanorma.org/author/iso/topics/markup/#bibliographies : %s
141
- REF
142
- "STANDOC_44": { category: "Images", error: "Image not found: %s",
143
- severity: 0 },
144
- "STANDOC_45": { category: "Images",
145
- error: "Corrupt PNG image detected: %s",
146
- severity: 2 },
147
- "STANDOC_46": { category: "Images",
148
- error: "Image too large for Data URI encoding: disable Data URI encoding (`:data-uri-image: false`), or set `:data-uri-maxsize: 0`",
149
- severity: 0 },
150
- "STANDOC_47": { category: "Crossreferences",
151
- error: "mismatch of callouts (%s) and annotations (%s)",
152
- severity: 0 },
153
- "STANDOC_48": { category: "Style", error: "(generic warning) %s",
154
- severity: 2 },
155
- "STANDOC_49": { category: "Bibliography",
156
- error: "Numeric reference in normative references",
157
- severity: 1 },
158
- "STANDOC_50": { category: "Fatal Error", error: "%s", severity: 0 },
159
- "STANDOC_51": { category: "Maths",
160
- error: "latexmlmath failed to process equation:\n%s",
161
- severity: 1 },
162
- "STANDOC_52": { category: "Bibliography",
163
- error: "Bibliographic spans: %s",
164
- severity: 0 },
165
- "STANDOC_53": { category: "Bibliography",
166
- error: "Bibliographic spans: %s",
167
- severity: 1 },
168
- "STANDOC_54": { category: "Bibliography",
169
- error: "Cannot process file %s for local Relaton data source %s",
170
- severity: 0 },
171
- "STANDOC_55": { category: "Images",
172
- error: "Corrupt SVG image detected, error found: %s %s%s%s",
173
- severity: 2 },
174
- "STANDOC_56": { category: "Images",
175
- error: "Corrupt SVG image detected, could not be fixed: %s %s%s%s",
176
- severity: 1 },
177
- "STANDOC_57": { category: "Images",
178
- error: "SVG image warning: %s %s%s%s",
179
- severity: 3 },
180
- "STANDOC_58": { category: "Images",
181
- error: "Corrupt SVG image detected, fix attempted: %s %s: %s %s, Node: %s",
182
- severity: 2 },
183
- "STANDOC_59": { category: "Images",
184
- error: "SVG unresolved internal reference: %s line %s",
185
- severity: 3 },
186
- "STANDOC_60": { category: "Bibliography",
187
- error: "Unrecognised bibliographic style: %s",
188
- severity: 1 },
189
- "STANDOC_61": { category: "AsciiDoc Input",
190
- error: "Improperly nested sourcecode markup: %s",
191
- severity: 0 },
192
- "STANDOC_62": { category: "Crossreferences",
193
- error: "Sourcecode with callout markup but no annotations",
194
- severity: 1 },
195
- "STANDOC_63": { category: "Images",
196
- error: "Warning on PNG image: %s",
197
- severity: 3 },
198
- "RELATON_1": { category: "Relaton",
199
- error: "(Error from Relaton) %s",
200
- severity: 0 },
201
- "RELATON_2": { category: "Relaton",
202
- error: "(Error from Relaton) %s",
203
- severity: 1 },
204
- "RELATON_3": { category: "Relaton",
205
- error: "(Error from Relaton) %s",
206
- severity: 2 },
207
- "RELATON_4": { category: "Relaton",
208
- error: "(Error from Relaton) %s",
209
- severity: 3 },
210
- "RELATON_5": { category: "Relaton",
211
- error: "(Error from Relaton IEV) %s",
212
- severity: 0 },
6
+ STANDOC_1: { category: "Include",
7
+ error: "Specified boilerplate file does not exist: %s",
8
+ severity: 0 },
9
+ STANDOC_2: { category: "Table", error: "Empty table",
10
+ severity: 0 },
11
+ STANDOC_3: { category: "Crossreferences",
12
+ error: "invalid index \"%s\" cross-reference: " \
13
+ "wrong number of attributes in `index:%s[%s]`",
14
+ severity: 0 },
15
+ STANDOC_4: { category: "Table",
16
+ error: "Table rows in table %s: check rowspan",
17
+ severity: 0 },
18
+ STANDOC_5: { category: "Table",
19
+ error: "Table exceeds maximum number of columns defined (%s)",
20
+ severity: 0 },
21
+ STANDOC_6: { category: "Maths",
22
+ error: "Malformed MathML: %s\n%s",
23
+ severity: 0 },
24
+ STANDOC_7: { category: "Metanorma XML Syntax", error: "%s",
25
+ severity: 2 },
26
+ STANDOC_8: { category: "Anchors", error: "Malformed URI: %s",
27
+ severity: 0 },
28
+ STANDOC_9: { category: "Bibliography",
29
+ error: "Attachment %s does not exist",
30
+ severity: 0 },
31
+ STANDOC_10: { category: "Anchors",
32
+ error: "The following reference is missing an anchor:\n%s",
33
+ severity: 1 },
34
+ STANDOC_11: { category: "Bibliography",
35
+ error: "Reference %s is missing a title",
36
+ severity: 1 },
37
+ STANDOC_12: { category: "Bibliography",
38
+ error: "Reference %s is missing a document identifier (docid)",
39
+ severity: 1 },
40
+ STANDOC_13: { category: "AsciiDoc Input",
41
+ error: "term reference not in expected format:%s",
42
+ severity: 1 },
43
+ STANDOC_14: { category: "Style",
44
+ error: "Style override set for ordered list",
45
+ severity: 2 },
46
+ STANDOC_15: { category: "Crossreferences",
47
+ error: "Could not resolve footnoteblock:[%s]",
48
+ severity: 1 },
49
+ STANDOC_16: { category: "AsciiDoc Input",
50
+ error: "Section not marked up as [bibliography]!",
51
+ severity: 2 },
52
+ STANDOC_17: { category: "Bibliography",
53
+ error: "ERROR: No document identifier retrieved for %s",
54
+ severity: 2 },
55
+ STANDOC_18: { category: "Bibliography",
56
+ error: "ERROR: No title retrieved for %s", severity: 2 },
57
+ STANDOC_19: { category: "Bibliography",
58
+ error: "Cannot find reference %s for local Relaton " \
59
+ "data source %s", severity: 0 },
60
+ STANDOC_20: { category: "AsciiDoc Input",
61
+ error: "Metadata definition list does not follow a term designation",
62
+ severity: 2 },
63
+ STANDOC_21: { category: "Terms",
64
+ error: "Removed duplicate designation %s",
65
+ severity: 2 },
66
+ STANDOC_22: { category: "Bibliography",
67
+ error: "Term \"%s\" does not match IEV %s \"%s\"",
68
+ severity: 1 },
69
+ STANDOC_23: { category: "Anchors",
70
+ error: "Concept cross-reference error: %s",
71
+ severity: 0 },
72
+ STANDOC_24: { category: "Terms",
73
+ error: "Term %s occurs twice as preferred designation: %s",
74
+ severity: 1 },
75
+ STANDOC_25: { category: "Terms", severity: 0,
76
+ error: <<~ERROR.freeze },
77
+ Clause not recognised as a term clause, but contains designation markup
78
+ (<code>preferred:[], admitted:[], alt:[], deprecated:[]</code>):<br/>
79
+ %s</br>
80
+ Ensure the parent clause is recognised as a terms clause by inserting <code>[heading=terms and definitions]</code> above the title,
81
+ in case the heading is not automatically recognised. See also <a href="https://www.metanorma.org/author/topics/sections/concepts/#clause-title">Metanorma documentation</a>.
82
+ ERROR
83
+ STANDOC_26: { category: "AsciiDoc Input",
84
+ error: "Error: Symbol reference in `symbol[%s]` missing: \"%s\" is not defined in document",
85
+ severity: 1 },
86
+ STANDOC_27: { category: "AsciiDoc Input",
87
+ error: "Error: Term reference to `%s` missing: \"%s\" is not defined in document%s",
88
+ severity: 1 },
89
+ STANDOC_28: { category: "Crossreferences",
90
+ error: "term source %s not referenced",
91
+ severity: 1 },
92
+ STANDOC_29: { category: "AsciiDoc Input",
93
+ error: "converter missing for %s node in Metanorma backend",
94
+ severity: 1 },
95
+ STANDOC_30: { category: "Crossreferences",
96
+ error: "%s does not have a corresponding anchor ID in the bibliography!",
97
+ severity: 2 },
98
+ STANDOC_31: { category: "Crossreferences",
99
+ error: "Illegal cross-reference connective: %s",
100
+ severity: 0 },
101
+ STANDOC_32: { category: "Crossreferences",
102
+ error: "%s does not have a corresponding anchor ID in the bibliography!",
103
+ severity: 2 },
104
+ STANDOC_33: { category: "Maths",
105
+ error: "Invalid MathML: %s\n %s%s",
106
+ severity: 0 },
107
+ STANDOC_34: { category: "Style",
108
+ error: "There is an instance of %s nested within %s",
109
+ severity: 2 },
110
+ STANDOC_35: { category: "Style",
111
+ error: "There is a crossreference to an instance of %s nested within %s: %s",
112
+ severity: 2 },
113
+ STANDOC_36: { category: "Anchors",
114
+ error: "ID %s has already been used at line %s",
115
+ severity: 0 },
116
+ STANDOC_37: { category: "Bibliography",
117
+ error: "Cannot process format %s for local Relaton data source %s",
118
+ severity: 0 },
119
+ STANDOC_38: { category: "Anchors",
120
+ error: "Crossreference target %s is undefined",
121
+ severity: 1 },
122
+ STANDOC_39: { category: "Blocks",
123
+ error: "%s is empty",
124
+ severity: 1 },
125
+ STANDOC_40: { category: "Bibliography",
126
+ error: "Could not retrieve %s: no access to online site",
127
+ severity: 1 },
128
+ STANDOC_41: { category: "Include",
129
+ error: "Unresolved directive %s",
130
+ severity: 0 },
131
+ STANDOC_42: { category: "Metanorma XML Syntax",
132
+ error: "Invalid passthrough content: %s\n" \
133
+ "This is not valid Metanorma XML. If you intended a different format, such as HTML, you need to specify `format=` on the pass markup;\n" \
134
+ "refer to https://www.metanorma.org/author/topics/blocks/passthroughs/",
135
+ severity: 0 },
136
+ STANDOC_43: { category: "AsciiDoc Input",
137
+ error: <<~REF.freeze, severity: 1 },
138
+ no anchor on reference, markup may be malformed: see
139
+ https://www.metanorma.org/author/topics/sections/bibliography/ ,
140
+ https://www.metanorma.org/author/iso/topics/markup/#bibliographies : %s
141
+ REF
142
+ STANDOC_44: { category: "Images", error: "Image not found: %s",
143
+ severity: 0 },
144
+ STANDOC_45: { category: "Images",
145
+ error: "Corrupt PNG image detected: %s",
146
+ severity: 2 },
147
+ STANDOC_46: { category: "Images",
148
+ error: "Image too large for Data URI encoding: disable Data URI encoding (`:data-uri-image: false`), or set `:data-uri-maxsize: 0`",
149
+ severity: 0 },
150
+ STANDOC_47: { category: "Crossreferences",
151
+ error: "mismatch of callouts (%s) and annotations (%s)",
152
+ severity: 0 },
153
+ STANDOC_48: { category: "Style", error: "(generic warning) %s",
154
+ severity: 2 },
155
+ STANDOC_49: { category: "Bibliography",
156
+ error: "Numeric reference in normative references",
157
+ severity: 1 },
158
+ STANDOC_50: { category: "Fatal Error", error: "%s", severity: 0 },
159
+ STANDOC_51: { category: "Maths",
160
+ error: "latexmlmath failed to process equation:\n%s",
161
+ severity: 1 },
162
+ STANDOC_52: { category: "Bibliography",
163
+ error: "Bibliographic spans: %s",
164
+ severity: 0 },
165
+ STANDOC_53: { category: "Bibliography",
166
+ error: "Bibliographic spans: %s",
167
+ severity: 1 },
168
+ STANDOC_54: { category: "Bibliography",
169
+ error: "Cannot process file %s for local Relaton data source %s",
170
+ severity: 0 },
171
+ STANDOC_55: { category: "Images",
172
+ error: "Corrupt SVG image detected, error found: %s %s%s%s",
173
+ severity: 2 },
174
+ STANDOC_56: { category: "Images",
175
+ error: "Corrupt SVG image detected, could not be fixed: %s %s%s%s",
176
+ severity: 1 },
177
+ STANDOC_57: { category: "Images",
178
+ error: "SVG image warning: %s %s%s%s",
179
+ severity: 3 },
180
+ STANDOC_58: { category: "Images",
181
+ error: "Corrupt SVG image detected, fix attempted: %s %s: %s %s, Node: %s",
182
+ severity: 2 },
183
+ STANDOC_59: { category: "Images",
184
+ error: "SVG unresolved internal reference: %s line %s",
185
+ severity: 3 },
186
+ STANDOC_60: { category: "Bibliography",
187
+ error: "Unrecognised bibliographic style: %s",
188
+ severity: 1 },
189
+ STANDOC_61: { category: "AsciiDoc Input",
190
+ error: "Improperly nested sourcecode markup: %s",
191
+ severity: 0 },
192
+ STANDOC_62: { category: "Crossreferences",
193
+ error: "Sourcecode with callout markup but no annotations",
194
+ severity: 1 },
195
+ STANDOC_63: { category: "Images",
196
+ error: "Warning on PNG image: %s",
197
+ severity: 3 },
198
+ RELATON_1: { category: "Relaton",
199
+ error: "(Error from Relaton) %s",
200
+ severity: 0 },
201
+ RELATON_2: { category: "Relaton",
202
+ error: "(Error from Relaton) %s",
203
+ severity: 1 },
204
+ RELATON_3: { category: "Relaton",
205
+ error: "(Error from Relaton) %s",
206
+ severity: 2 },
207
+ RELATON_4: { category: "Relaton",
208
+ error: "(Error from Relaton) %s",
209
+ severity: 3 },
210
+ RELATON_5: { category: "Relaton",
211
+ error: "(Error from Relaton IEV) %s",
212
+ severity: 0 },
213
213
 
214
214
  }.freeze
215
215
  # rubocop:enable Naming/VariableNumber
@@ -25,13 +25,18 @@ module Metanorma
25
25
  !node.attr("type") &&
26
26
  !%w(requirement recommendation permission).include?(type) and
27
27
  node.set_attr("type", type)
28
- attrs = keep_attrs(node).merge(id_unnum_attrs(node))
29
- .merge(model: @reqt_model_name)
30
- ret = @reqt_model.requirement(node, obligation, attrs)
28
+ ret = @reqt_model.requirement(node, obligation, requirement_attrs(node))
31
29
  @reqt_model = nil unless nested
32
30
  ret
33
31
  end
34
32
 
33
+ def requirement_attrs(node)
34
+ keep_attrs(node).merge(id_unnum_attrs(node))
35
+ .merge({ model: @reqt_model_name,
36
+ render: node.attr("render") || @default_requirement_render }
37
+ .compact)
38
+ end
39
+
35
40
  def requirement_validate(docxml)
36
41
  docxml.xpath("//requirement | //recommendation | //permission")
37
42
  .each do |r|
@@ -4,6 +4,7 @@ require "htmlentities"
4
4
  require "json"
5
5
  require "pathname"
6
6
  require "uuidtools"
7
+ require "metanorma-core"
7
8
  require_relative "../../nokogiri/xml/builder"
8
9
  require_relative "date_utils"
9
10
  require_relative "isolated_converter"
@@ -91,14 +92,9 @@ module Metanorma
91
92
 
92
93
  def isodoc(lang, script, locale, i18nyaml = nil)
93
94
  conv = presentation_xml_converter(EmptyAttr.new)
94
- conv.init_i18n({ i18nyaml:, language: lang, script:, locale: })
95
- i18n = conv.i18n_init(lang, script, locale, i18nyaml)
96
- conv.metadata_init(lang, script, locale, i18n)
97
- conv.meta.localdir = @localdir
98
- conv.xref_init(lang, script, nil, i18n, {})
99
- conv.xrefs.klass.meta = conv.meta
100
- conv.xrefs.klass.localdir = @localdir
101
- conv
95
+ Metanorma::Core::Isodoc.init(conv, lang: lang, script: script,
96
+ locale: locale, i18nyaml: i18nyaml,
97
+ localdir: @localdir)
102
98
  end
103
99
 
104
100
  def dl_to_attrs(elem, dlist, name)
@@ -199,7 +195,7 @@ module Metanorma
199
195
  end
200
196
 
201
197
  def add_noko_elem(node, name, val, attrs = {})
202
- val and !val.empty? or return
198
+ (val and !val.empty?) or return
203
199
  node.send name, **attr_code(attrs) do |n|
204
200
  n << val
205
201
  end
@@ -211,16 +207,8 @@ module Metanorma
211
207
  text = result.flatten.map(&:rstrip) * "\n"
212
208
  text.gsub(/(?<!\s)\s+<fn /, "<fn ")
213
209
  end
214
-
215
- class EmptyAttr
216
- def attr(_any_attribute)
217
- nil
218
- end
219
-
220
- def attributes
221
- {}
222
- end
223
- end
224
210
  end
211
+
212
+ EmptyAttr = Metanorma::Core::Isodoc::EmptyNode
225
213
  end
226
214
  end
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "3.4.0".freeze
22
+ VERSION = "3.4.1".freeze
23
23
  end
24
24
  end
@@ -1,9 +1,10 @@
1
1
  require "asciidoctor" unless defined? Asciidoctor::Converter
2
+ require_relative "isodoc/standoc/presentation_xml_convert"
2
3
  require_relative "isodoc/standoc/pdf_convert"
3
4
  require_relative "metanorma/converter/converter"
4
5
  require_relative "metanorma/converter/version"
5
6
  require "asciidoctor/extensions"
6
- require "metanorma"
7
+ require "metanorma-core"
7
8
  require "vectory"
8
9
 
9
10
  if defined? Metanorma::Registry
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "crass", "~> 1.0.0"
34
34
  # spec.add_dependency "iev", "~> 0.3.5"
35
35
  spec.add_dependency "isodoc", "~> 3.5.0"
36
- spec.add_dependency "metanorma", ">= 1.6.0"
36
+ spec.add_dependency "metanorma-core", "~> 0.1.2"
37
37
  spec.add_dependency "metanorma-plugin-glossarist", "~> 0.3.0"
38
38
  spec.add_dependency "metanorma-plugin-lutaml", "~> 0.7.31"
39
39
  spec.add_dependency "metanorma-plugin-plantuml", "~> 1.0.0"
@@ -46,7 +46,7 @@ Gem::Specification.new do |spec|
46
46
  spec.add_dependency "svg_conform", "~> 0.1.0"
47
47
  spec.add_dependency "png_conform", "~> 0.1.0"
48
48
 
49
- spec.add_development_dependency "canon", "= 0.1.3"
49
+ spec.add_development_dependency "canon", "= 0.2.3"
50
50
  spec.add_development_dependency "debug"
51
51
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
52
52
  spec.add_development_dependency "guard", "~> 2.14"
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.4.0
4
+ version: 3.4.1
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-04-13 00:00:00.000000000 Z
11
+ date: 2026-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -67,19 +67,19 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.5.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: metanorma
70
+ name: metanorma-core
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.6.0
75
+ version: 0.1.2
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.6.0
82
+ version: 0.1.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: metanorma-plugin-glossarist
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -226,14 +226,14 @@ dependencies:
226
226
  requirements:
227
227
  - - '='
228
228
  - !ruby/object:Gem::Version
229
- version: 0.1.3
229
+ version: 0.2.3
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - '='
235
235
  - !ruby/object:Gem::Version
236
- version: 0.1.3
236
+ version: 0.2.3
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: debug
239
239
  requirement: !ruby/object:Gem::Requirement
@@ -444,6 +444,7 @@ files:
444
444
  - lib/isodoc/html/htmlstyle.scss
445
445
  - lib/isodoc/html/scripts.html
446
446
  - lib/isodoc/standoc/pdf_convert.rb
447
+ - lib/isodoc/standoc/presentation_xml_convert.rb
447
448
  - lib/metanorma-standoc.rb
448
449
  - lib/metanorma/cleanup/amend.rb
449
450
  - lib/metanorma/cleanup/asciibib.rb