metanorma-generic 3.4.2 → 3.4.3

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: edea86377ca867a3e249d9f5ff441448a6d049d9505744e4dd6a0795cad4ad1d
4
- data.tar.gz: c7bf6e739b48a19c0e9f329d109a30ba90139d59ad309b1a2d03bdc6990a883d
3
+ metadata.gz: cc693024c1d1f0ec1b1123bb5e8ff37e06a832f06e96b5b50d9cfbc2653ff008
4
+ data.tar.gz: e32f6f58c01a1d7ac7c026e5aca062275434a6c18fbc0090cfcb053ea400bd3b
5
5
  SHA512:
6
- metadata.gz: 0eb3f37ae4c629a897a6ebdbb7e844b0cabc796dabd149e35ccce40385cbbed9c1d8aa5a5dbe816420c4640c14a7902cb1feeefefc064441a87d9ecb8e7f2264
7
- data.tar.gz: f932912f5ed48ede677b79ea9368c256d62631d235298991d952454508d02bd46775406f36b1867cb9e347c2d6d21ab96344b00adfb57a9893500eb12180ab37
6
+ metadata.gz: 7b052ae43f0047fb153677ef53dc7613e4a1b265ed7015124426c424b77a4e3d2b9c86858b9864bcdcd9e4b4e36d22ffe15cd34d4f3684d3665b5b0f0f1aafad
7
+ data.tar.gz: 9bd6aeff29714b725dc15e4335bd390afdab8298d964d692d28e98c627b7641f5fb14757df3415b18c77c0a1ace0a05880dddca0b884a15c19d25d5c671b8c66
data/.rubocop.yml CHANGED
@@ -2,6 +2,15 @@
2
2
  # See https://github.com/metanorma/cimas
3
3
  inherit_from:
4
4
  - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
+ # .rubocop_todo.yml MUST be the last entry. inherit_from is last-wins:
6
+ # if listed before oss-guides, the shared config's stricter Metrics/
7
+ # (MethodLength, BlockLength, etc.) rules override the todo's per-file
8
+ # grandfathering, and the todo becomes inert on those cops. Empirically
9
+ # verified on suma 2026-07-06: with todo listed first, 34 Metrics/* offenses
10
+ # remained; moved last, cleared. Every gem in the metanorma-org fleet
11
+ # already ships a `.rubocop_todo.yml` on its live tree (audited 2026-07-06,
12
+ # 54/54 have it), so this reference is safe to emit unconditionally.
13
+ - .rubocop_todo.yml
5
14
 
6
15
  # Rubocop plugins enabled centrally so every metanorma-org gem picks them up
7
16
  # on cimas sync — best practice belongs at the shared-template layer, not
@@ -38,7 +38,7 @@ module IsoDoc
38
38
  klass._file = caller_locations(1..1).first.absolute_path
39
39
  end
40
40
 
41
- def images(isoxml, out)
41
+ def images(_isoxml, _out)
42
42
  default_logo_path =
43
43
  File.expand_path(File.join(File.dirname(__FILE__), "html",
44
44
  "logo.jpg"))
@@ -1931,7 +1931,7 @@ or as the string "auto"</a:documentation>
1931
1931
  </element>
1932
1932
  </define>
1933
1933
  <define name="mathml">
1934
- <a:documentation>Encoding of MathML: the official W3C MathML 3.0 grammar (namespace
1934
+ <a:documentation>Encoding of MathML: the official W3C MathML 4 grammar (namespace
1935
1935
  http://www.w3.org/1998/Math/MathML), via the metanorma wrapper in
1936
1936
  grammars/mathml/. See grammars/mathml/README.adoc and basicdoc-models#35.</a:documentation>
1937
1937
  <externalRef href="metanorma-mathml.rng"/>
@@ -15,47 +15,10 @@ module Metanorma
15
15
  Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
16
16
  conv.meta.set(a, configuration.send(a))
17
17
  end
18
- conv.meta.set(:bibdata, bibdata_hash(xmldoc))
19
18
  @isodoc = conv
20
19
  @isodoc
21
20
  end
22
21
 
23
- def bibdata_hash(xmldoc)
24
- b = xmldoc.at("//bibdata") || xmldoc.at("//xmlns:bibdata") or return nil
25
- stripped = Nokogiri::XML(b.to_xml)
26
- stripped.remove_namespaces!
27
- # Drop @boilerplate="true" docidentifiers before handing the
28
- # bibdata to Relaton::Cli.parse_xml: their content is an
29
- # unresolved Liquid template, and recent relaton-iho /
30
- # relaton-cc / etc. eagerly call pubid in their docidentifier
31
- # content= setter, which crashes on raw Liquid syntax. The
32
- # template variables for substitution come from other bibdata
33
- # fields (seriesabbr, docnumeric, …), not from the
34
- # docidentifier itself, so dropping it here does not affect
35
- # what we feed back into isodoc.meta. Substitution still runs
36
- # on the original xmldoc via standoc's
37
- # docidentifier_boilerplate_isodoc; afterwards
38
- # refresh_isodoc_bibdata re-calls bibdata_hash to seed
39
- # isodoc.meta with the resolved docidentifier.
40
- # See https://github.com/metanorma/metanorma/issues/558.
41
- stripped.xpath("//docidentifier[@boilerplate = 'true']").each(&:remove)
42
- bib = BibdataConfig.from_xml(
43
- "<metanorma>#{stripped.root.to_xml}</metanorma>",
44
- ).bibdata or return nil
45
- YAML.safe_load(bib.to_yaml, permitted_classes: [Date, Symbol],
46
- symbolize_names: true)
47
- end
48
-
49
- # Override standoc's hook: in addition to re-running
50
- # isodoc_bibdata_parse, refresh conv.meta[:bibdata] with the
51
- # bibdata_hash now that docidentifiers have been substituted, so
52
- # downstream consumers (boilerplate Liquid expansion, coverpage
53
- # interpolation, etc.) see the resolved values.
54
- def refresh_isodoc_bibdata(xmldoc, conv)
55
- super
56
- conv.meta.set(:bibdata, bibdata_hash(xmldoc))
57
- end
58
-
59
22
  def boilerplate_file(xmldoc)
60
23
  f = configuration.boilerplate
61
24
  f.nil? and return super
@@ -2,7 +2,6 @@ require "asciidoctor"
2
2
  require "metanorma-standoc"
3
3
  require "fileutils"
4
4
  require_relative "front"
5
- require_relative "bibdata_config"
6
5
  require "metanorma-core"
7
6
  require "pathname"
8
7
 
@@ -1,22 +1,21 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!--
4
- This is the Mathematical Markup Language (MathML) 3.0, an XML
5
- application for describing mathematical notation and capturing
6
- both its structure and content.
7
-
8
- Copyright 1998-2014 W3C (MIT, ERCIM, Keio, Beihang)
9
-
10
- Use and distribution of this code are permitted under the terms
11
- W3C Software Notice and License
12
- http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
13
- -->
14
- <include href="mathml3-strict-content.rng">
2
+ <!--
3
+ MathML 4 (Content)
4
+ ##################
5
+ -->
6
+ <!--
7
+ Copyright 1998-2026 W3C (MIT, ERCIM, Keio, Beihang)
8
+
9
+ Use and distribution of this code are permitted under the terms
10
+ W3C Software Notice and License
11
+ http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
12
+ -->
13
+ <grammar ns="http://www.w3.org/1998/Math/MathML" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
14
+ <include href="mathml4-strict-content.rng">
15
15
  <define name="cn.content">
16
16
  <zeroOrMore>
17
17
  <choice>
18
18
  <text/>
19
- <ref name="mglyph"/>
20
19
  <ref name="sep"/>
21
20
  <ref name="PresentationExpression"/>
22
21
  </choice>
@@ -46,7 +45,6 @@
46
45
  <zeroOrMore>
47
46
  <choice>
48
47
  <text/>
49
- <ref name="mglyph"/>
50
48
  <ref name="PresentationExpression"/>
51
49
  </choice>
52
50
  </zeroOrMore>
@@ -65,11 +63,22 @@
65
63
  <zeroOrMore>
66
64
  <choice>
67
65
  <text/>
68
- <ref name="mglyph"/>
69
66
  <ref name="PresentationExpression"/>
70
67
  </choice>
71
68
  </zeroOrMore>
72
69
  </define>
70
+ <define name="annotation-xml.attributes" combine="choice">
71
+ <ref name="CommonAtt"/>
72
+ <optional>
73
+ <ref name="cd"/>
74
+ </optional>
75
+ <optional>
76
+ <ref name="name"/>
77
+ </optional>
78
+ <optional>
79
+ <ref name="encoding"/>
80
+ </optional>
81
+ </define>
73
82
  <define name="bvar">
74
83
  <element name="bvar">
75
84
  <ref name="CommonAtt"/>
@@ -113,6 +122,63 @@
113
122
  <ref name="apply.content"/>
114
123
  </define>
115
124
  </include>
125
+ <define name="NonMathMLAtt" combine="choice">
126
+ <attribute>
127
+ <anyName>
128
+ <except>
129
+ <nsName ns=""/>
130
+ <nsName/>
131
+ </except>
132
+ </anyName>
133
+ <data type="string"/>
134
+ </attribute>
135
+ </define>
136
+ <!--
137
+ METANORMA MODIFICATION (basicdoc-models#39): upstream re-adds
138
+ `attribute alttext` to math.attributes here, but mathml4-core.rnc already
139
+ defines it on math; RELAX NG's duplicate-attribute restriction rejects the
140
+ composed grammar (jing: 'duplicate attribute "alttext"').
141
+ Upstream text was:
142
+ math.attributes &=
143
+ attribute alttext {text}?
144
+ -->
145
+ <!--
146
+ METANORMA MODIFICATION (basicdoc-models#39): upstream re-adds the
147
+ `data-other` placeholder to MathMLDataAttributes here; dropped for the
148
+ same reason as the core placeholder (see mathml4-core.rnc modification).
149
+ Upstream text was:
150
+ MathMLDataAttributes &=
151
+ attribute data-other {text}?
152
+ -->
153
+ <define name="CommonAtt" combine="interleave">
154
+ <zeroOrMore>
155
+ <ref name="NonMathMLAtt"/>
156
+ </zeroOrMore>
157
+ <ref name="MathMLDataAttributes"/>
158
+ <optional>
159
+ <attribute name="class">
160
+ <data type="NCName"/>
161
+ </attribute>
162
+ </optional>
163
+ <optional>
164
+ <attribute name="style">
165
+ <data type="string"/>
166
+ </attribute>
167
+ </optional>
168
+ <optional>
169
+ <attribute name="href">
170
+ <data type="anyURI"/>
171
+ </attribute>
172
+ </optional>
173
+ <optional>
174
+ <attribute name="intent"/>
175
+ </optional>
176
+ <optional>
177
+ <attribute name="arg">
178
+ <data type="NCName"/>
179
+ </attribute>
180
+ </optional>
181
+ </define>
116
182
  <define name="base">
117
183
  <attribute name="base"/>
118
184
  </define>
@@ -124,6 +190,18 @@
124
190
  <define name="PresentationExpression" combine="choice">
125
191
  <notAllowed/>
126
192
  </define>
193
+ <define name="DefEncAtt">
194
+ <optional>
195
+ <attribute name="encoding">
196
+ <data type="string"/>
197
+ </attribute>
198
+ </optional>
199
+ <optional>
200
+ <attribute name="definitionURL">
201
+ <data type="anyURI"/>
202
+ </attribute>
203
+ </optional>
204
+ </define>
127
205
  <define name="DomainQ">
128
206
  <zeroOrMore>
129
207
  <choice>
@@ -228,60 +306,6 @@
228
306
  <ref name="ContExp"/>
229
307
  </element>
230
308
  </define>
231
- <define name="DeprecatedContExp">
232
- <choice>
233
- <ref name="reln"/>
234
- <ref name="fn"/>
235
- <ref name="declare"/>
236
- </choice>
237
- </define>
238
- <define name="ContExp" combine="choice">
239
- <ref name="DeprecatedContExp"/>
240
- </define>
241
- <define name="reln">
242
- <element name="reln">
243
- <zeroOrMore>
244
- <ref name="ContExp"/>
245
- </zeroOrMore>
246
- </element>
247
- </define>
248
- <define name="fn">
249
- <element name="fn">
250
- <ref name="ContExp"/>
251
- </element>
252
- </define>
253
- <define name="declare">
254
- <element name="declare">
255
- <optional>
256
- <attribute name="type">
257
- <data type="string"/>
258
- </attribute>
259
- </optional>
260
- <optional>
261
- <attribute name="scope">
262
- <data type="string"/>
263
- </attribute>
264
- </optional>
265
- <optional>
266
- <attribute name="nargs">
267
- <data type="nonNegativeInteger"/>
268
- </attribute>
269
- </optional>
270
- <optional>
271
- <attribute name="occurrence">
272
- <choice>
273
- <value>prefix</value>
274
- <value>infix</value>
275
- <value>function-model</value>
276
- </choice>
277
- </attribute>
278
- </optional>
279
- <ref name="DefEncAtt"/>
280
- <oneOrMore>
281
- <ref name="ContExp"/>
282
- </oneOrMore>
283
- </element>
284
- </define>
285
309
  <define name="interval.class">
286
310
  <ref name="interval"/>
287
311
  </define>
@@ -1253,10 +1277,10 @@
1253
1277
  <define name="nary-stats.class">
1254
1278
  <choice>
1255
1279
  <ref name="mean"/>
1256
- <ref name="sdev"/>
1257
- <ref name="variance"/>
1258
1280
  <ref name="median"/>
1259
1281
  <ref name="mode"/>
1282
+ <ref name="sdev"/>
1283
+ <ref name="variance"/>
1260
1284
  </choice>
1261
1285
  </define>
1262
1286
  <define name="ContExp" combine="choice">
@@ -1269,29 +1293,29 @@
1269
1293
  <empty/>
1270
1294
  </element>
1271
1295
  </define>
1272
- <define name="sdev">
1273
- <element name="sdev">
1296
+ <define name="median">
1297
+ <element name="median">
1274
1298
  <ref name="CommonAtt"/>
1275
1299
  <ref name="DefEncAtt"/>
1276
1300
  <empty/>
1277
1301
  </element>
1278
1302
  </define>
1279
- <define name="variance">
1280
- <element name="variance">
1303
+ <define name="mode">
1304
+ <element name="mode">
1281
1305
  <ref name="CommonAtt"/>
1282
1306
  <ref name="DefEncAtt"/>
1283
1307
  <empty/>
1284
1308
  </element>
1285
1309
  </define>
1286
- <define name="median">
1287
- <element name="median">
1310
+ <define name="sdev">
1311
+ <element name="sdev">
1288
1312
  <ref name="CommonAtt"/>
1289
1313
  <ref name="DefEncAtt"/>
1290
1314
  <empty/>
1291
1315
  </element>
1292
1316
  </define>
1293
- <define name="mode">
1294
- <element name="mode">
1317
+ <define name="variance">
1318
+ <element name="variance">
1295
1319
  <ref name="CommonAtt"/>
1296
1320
  <ref name="DefEncAtt"/>
1297
1321
  <empty/>