metanorma-standoc 3.4.7 → 3.4.9

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.
@@ -0,0 +1,289 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ MathML 4 (Strict 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
+ <start combine="choice">
15
+ <ref name="math.strict"/>
16
+ </start>
17
+ <define name="CommonAtt">
18
+ <optional>
19
+ <attribute name="id">
20
+ <data type="ID"/>
21
+ </attribute>
22
+ </optional>
23
+ <optional>
24
+ <attribute name="xref"/>
25
+ </optional>
26
+ </define>
27
+ <define name="math.strict">
28
+ <element name="math">
29
+ <ref name="math.attributes"/>
30
+ <zeroOrMore>
31
+ <ref name="ContExp"/>
32
+ </zeroOrMore>
33
+ </element>
34
+ </define>
35
+ <!--
36
+ METANORMA MODIFICATION (basicdoc-models#39): upstream combines CommonAtt
37
+ (id, xref) into math.attributes here; in the full-MathML composition the
38
+ math element already carries `id` via MathMLPGlobalAttributes
39
+ (mathml4-core.rnc) and `xref` via the presentation augmentation
40
+ (mathml4-presentation.rnc), so RELAX NG's duplicate-attribute restriction
41
+ rejects the composed grammar (jing: 'duplicate attribute "id"').
42
+ Upstream text was:
43
+ math.attributes &= CommonAtt
44
+ -->
45
+ <define name="ContExp">
46
+ <choice>
47
+ <ref name="semantics-contexp"/>
48
+ <ref name="cn"/>
49
+ <ref name="ci"/>
50
+ <ref name="csymbol"/>
51
+ <ref name="apply"/>
52
+ <ref name="bind"/>
53
+ <ref name="share"/>
54
+ <ref name="cerror"/>
55
+ <ref name="cbytes"/>
56
+ <ref name="cs"/>
57
+ </choice>
58
+ </define>
59
+ <define name="cn">
60
+ <element name="cn">
61
+ <ref name="cn.attributes"/>
62
+ <ref name="cn.content"/>
63
+ </element>
64
+ </define>
65
+ <define name="cn.content">
66
+ <text/>
67
+ </define>
68
+ <define name="cn.attributes">
69
+ <ref name="CommonAtt"/>
70
+ <attribute name="type">
71
+ <choice>
72
+ <value>integer</value>
73
+ <value>real</value>
74
+ <value>double</value>
75
+ <value>hexdouble</value>
76
+ </choice>
77
+ </attribute>
78
+ </define>
79
+ <define name="semantics-ci">
80
+ <element name="semantics">
81
+ <ref name="CommonAtt"/>
82
+ <choice>
83
+ <ref name="ci"/>
84
+ <ref name="semantics-ci"/>
85
+ </choice>
86
+ <zeroOrMore>
87
+ <choice>
88
+ <ref name="annotation"/>
89
+ <ref name="annotation-xml"/>
90
+ </choice>
91
+ </zeroOrMore>
92
+ </element>
93
+ </define>
94
+ <define name="semantics-contexp">
95
+ <element name="semantics">
96
+ <ref name="CommonAtt"/>
97
+ <ref name="MathExpression"/>
98
+ <zeroOrMore>
99
+ <choice>
100
+ <ref name="annotation"/>
101
+ <ref name="annotation-xml"/>
102
+ </choice>
103
+ </zeroOrMore>
104
+ </element>
105
+ </define>
106
+ <define name="annotation" combine="choice">
107
+ <element name="annotation">
108
+ <ref name="CommonAtt"/>
109
+ <text/>
110
+ </element>
111
+ </define>
112
+ <!--
113
+ METANORMA MODIFICATION (basicdoc-models#39): upstream re-opens
114
+ `anyElement` and `annotation-xml` here with combine=choice (|=). RELAX NG
115
+ permits only one combine method per name, which blocks the metanorma
116
+ wrapper's `&= notAllowed` bans (metanorma-mathml.rnc) of these foreign
117
+ markup escape hatches. The re-opens are dropped: the base definitions in
118
+ mathml4-core.rnc remain, and the wrapper forbids them outright anyway.
119
+ Upstream text was:
120
+ anyElement |= element (* - m:*) {(attribute * {text}|text| anyElement)*}
121
+ annotation-xml |= element annotation-xml {annotation-xml.attributes,
122
+ (MathExpression*|anyElement*)}
123
+ -->
124
+ <define name="annotation-xml.attributes" combine="interleave">
125
+ <ref name="CommonAtt"/>
126
+ <optional>
127
+ <ref name="cd"/>
128
+ </optional>
129
+ <optional>
130
+ <ref name="encoding"/>
131
+ </optional>
132
+ </define>
133
+ <!--
134
+ METANORMA MODIFICATION (basicdoc-models#39): upstream combines a second
135
+ `attribute encoding` into the `encoding` define (already defined in
136
+ mathml4-core.rnc); the interleave yields the same attribute twice wherever
137
+ the define is used, which RELAX NG forbids (jing: 'duplicate attribute
138
+ "encoding"').
139
+ Upstream text was:
140
+ encoding &= attribute encoding {xsd:string}
141
+ -->
142
+ <define name="ci">
143
+ <element name="ci">
144
+ <ref name="ci.attributes"/>
145
+ <ref name="ci.content"/>
146
+ </element>
147
+ </define>
148
+ <define name="ci.attributes">
149
+ <ref name="CommonAtt"/>
150
+ <optional>
151
+ <ref name="ci.type"/>
152
+ </optional>
153
+ </define>
154
+ <define name="ci.type">
155
+ <attribute name="type">
156
+ <choice>
157
+ <value>integer</value>
158
+ <value>rational</value>
159
+ <value>real</value>
160
+ <value>complex</value>
161
+ <value>complex-polar</value>
162
+ <value>complex-cartesian</value>
163
+ <value>constant</value>
164
+ <value>function</value>
165
+ <value>vector</value>
166
+ <value>list</value>
167
+ <value>set</value>
168
+ <value>matrix</value>
169
+ </choice>
170
+ </attribute>
171
+ </define>
172
+ <define name="ci.content">
173
+ <text/>
174
+ </define>
175
+ <define name="csymbol">
176
+ <element name="csymbol">
177
+ <ref name="csymbol.attributes"/>
178
+ <ref name="csymbol.content"/>
179
+ </element>
180
+ </define>
181
+ <define name="SymbolName">
182
+ <data type="NCName"/>
183
+ </define>
184
+ <define name="csymbol.attributes">
185
+ <ref name="CommonAtt"/>
186
+ <ref name="cd"/>
187
+ </define>
188
+ <define name="csymbol.content">
189
+ <ref name="SymbolName"/>
190
+ </define>
191
+ <define name="cd">
192
+ <attribute name="cd">
193
+ <data type="NCName"/>
194
+ </attribute>
195
+ </define>
196
+ <define name="name">
197
+ <attribute name="name">
198
+ <data type="NCName"/>
199
+ </attribute>
200
+ </define>
201
+ <define name="src">
202
+ <optional>
203
+ <attribute name="src">
204
+ <data type="anyURI"/>
205
+ </attribute>
206
+ </optional>
207
+ </define>
208
+ <define name="BvarQ">
209
+ <zeroOrMore>
210
+ <ref name="bvar"/>
211
+ </zeroOrMore>
212
+ </define>
213
+ <define name="bvar">
214
+ <element name="bvar">
215
+ <ref name="CommonAtt"/>
216
+ <choice>
217
+ <ref name="ci"/>
218
+ <ref name="semantics-ci"/>
219
+ </choice>
220
+ </element>
221
+ </define>
222
+ <define name="apply">
223
+ <element name="apply">
224
+ <ref name="CommonAtt"/>
225
+ <ref name="apply.content"/>
226
+ </element>
227
+ </define>
228
+ <define name="apply.content">
229
+ <oneOrMore>
230
+ <ref name="ContExp"/>
231
+ </oneOrMore>
232
+ </define>
233
+ <define name="bind">
234
+ <element name="bind">
235
+ <ref name="CommonAtt"/>
236
+ <ref name="bind.content"/>
237
+ </element>
238
+ </define>
239
+ <define name="bind.content">
240
+ <ref name="ContExp"/>
241
+ <zeroOrMore>
242
+ <ref name="bvar"/>
243
+ </zeroOrMore>
244
+ <ref name="ContExp"/>
245
+ </define>
246
+ <define name="share">
247
+ <element name="share">
248
+ <ref name="CommonAtt"/>
249
+ <ref name="src"/>
250
+ <empty/>
251
+ </element>
252
+ </define>
253
+ <define name="cerror">
254
+ <element name="cerror">
255
+ <ref name="cerror.attributes"/>
256
+ <ref name="csymbol"/>
257
+ <zeroOrMore>
258
+ <ref name="ContExp"/>
259
+ </zeroOrMore>
260
+ </element>
261
+ </define>
262
+ <define name="cerror.attributes">
263
+ <ref name="CommonAtt"/>
264
+ </define>
265
+ <define name="cbytes">
266
+ <element name="cbytes">
267
+ <ref name="cbytes.attributes"/>
268
+ <ref name="base64"/>
269
+ </element>
270
+ </define>
271
+ <define name="cbytes.attributes">
272
+ <ref name="CommonAtt"/>
273
+ </define>
274
+ <define name="base64">
275
+ <data type="base64Binary"/>
276
+ </define>
277
+ <define name="cs">
278
+ <element name="cs">
279
+ <ref name="cs.attributes"/>
280
+ <text/>
281
+ </element>
282
+ </define>
283
+ <define name="cs.attributes">
284
+ <ref name="CommonAtt"/>
285
+ </define>
286
+ <define name="MathExpression" combine="choice">
287
+ <ref name="ContExp"/>
288
+ </define>
289
+ </grammar>
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ MathML 4 (full)
4
+ ##############
5
+ -->
6
+ <!--
7
+ Copyright 1998-2026 W3C (MIT, ERCIM, Keio)
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">
14
+ <!--
15
+ Presentation MathML
16
+ METANORMA MODIFICATION (basicdoc-models#39): upstream overrides
17
+ `anyElement` inside this include, but `anyElement` is defined in
18
+ mathml4-core.rnc, i.e. an include nested below mathml4-presentation.rnc;
19
+ libxml2's RELAX NG cannot override a define from a nested include (the
20
+ same constraint documented in metanorma-mathml.rnc). The override is
21
+ redundant for metanorma, whose wrapper bans anyElement outright.
22
+ Upstream text was:
23
+ include "mathml4-presentation.rnc" {
24
+ anyElement = element (* - m:*) {(attribute * {text}|text| anyElement)*}
25
+ }
26
+ -->
27
+ <include href="mathml4-presentation.rng"/>
28
+ <!-- Content MathML -->
29
+ <include href="mathml4-content.rng"/>
30
+ </grammar>
@@ -0,0 +1,59 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0">
3
+ <!--
4
+ Metanorma wrapper around the vendored W3C MathML 4 RelaxNG grammar
5
+ (vendored with marked modifications - - see README.adoc).
6
+ Includes the W3C grammar (start = math) and augments it with
7
+ metanorma's owned extension attributes. Referenced from basicdoc.rnc via:
8
+ mathml = external "mathml/metanorma-mathml.rnc"
9
+ Authoritative param list for data-metanorma-numberformat lives in plurimath
10
+ (Formatter::Standard::DEFAULT_OPTIONS); see metanorma/basicdoc-models#35.
11
+ MathML 3 -> 4 migration: metanorma/basicdoc-models#39 /
12
+ metanorma/metanorma#585.
13
+ -->
14
+ <include href="mathml4.rng"/>
15
+ <!--
16
+ metanorma number-formatting hint on <mn>; opaque comma-separated option
17
+ string parsed at presentation time (no-namespace data- attribute, which
18
+ the W3C MathMLPGlobalAttributes/NonMathMLAtt does not otherwise permit).
19
+ -->
20
+ <define name="mn.attributes" combine="interleave">
21
+ <optional>
22
+ <attribute name="data-metanorma-numberformat"/>
23
+ </optional>
24
+ </define>
25
+ <!--
26
+ Foreign annotation-xml considered harmful: the metanorma lutaml-model
27
+ serialiser emits no foreign markup, so the W3C annotation-xml escape hatch
28
+ (and its anyElement wildcard) is forbidden in the MathML we process. This
29
+ also removes the untyped `id` attribute the wildcard permits, which clashes
30
+ with xsd:ID under RELAX NG ID-type consistency (the callout-annotation
31
+ error). metanorma only emits presentation MathML; pre-empting the escape
32
+ hatch before semantic MathML is ever wired. Text-only <annotation> is
33
+ retained.
34
+
35
+ Expressed via `combine` (interleave with notAllowed) rather than an
36
+ include-override: annotation-xml/anyElement are defined in the transitively
37
+ included mathml4-core, and libxml2's RelaxNG (used by Nokogiri for fragment
38
+ / passthrough validation) cannot override a define from a nested include - -
39
+ it demands the combine attribute and otherwise fails to compile the whole
40
+ grammar (every passthrough then wrongly reports "Invalid passthrough
41
+ content"). jing accepts both forms; combine satisfies both. basicdoc-models#35
42
+ -->
43
+ <define name="annotation-xml" combine="interleave">
44
+ <notAllowed/>
45
+ </define>
46
+ <define name="anyElement" combine="interleave">
47
+ <notAllowed/>
48
+ </define>
49
+ </grammar>
50
+ <!--
51
+ NOTE on MathML 4's token content model: upstream `textorHTML`
52
+ (mathml4-core.rnc) admits embedded XHTML/SVG inside token elements
53
+ (mi/mn/mo/mtext/ms). That loosening is removed as a marked modification in
54
+ the vendored core file itself: libxml2's RELAX NG rejects the compiled svg
55
+ branch outright (breaking all passthrough validation), and metanorma's
56
+ serialiser never emits embedded HTML/SVG in math tokens. See the
57
+ METANORMA MODIFICATION comment in mathml4-core.rnc and
58
+ metanorma/basicdoc-models#39.
59
+ -->
@@ -39,7 +39,11 @@ the tag name of the top level containers</a:documentation>
39
39
  <data type="ID"/>
40
40
  </attribute>
41
41
  <ref name="NumberingAttributes"/>
42
- <ref name="BlockAttributes"/>
42
+ <ref name="BlockAttributesCore">
43
+ <a:documentation>requirement carries its own semantic `class` (provision class, below), so
44
+ it uses BlockAttributesCore to avoid duplicating the custom-class slot now
45
+ in BlockAttributes. See metanorma/metanorma-standoc#1197</a:documentation>
46
+ </ref>
43
47
  <optional>
44
48
  <attribute name="filename">
45
49
  <a:documentation>File name of the requirement model when exported</a:documentation>
@@ -225,7 +229,11 @@ machine-readable, and is not to be rendered as document output</a:documentation>
225
229
  <data type="boolean"/>
226
230
  </attribute>
227
231
  </optional>
228
- <ref name="BlockAttributes"/>
232
+ <ref name="BlockAttributesCore">
233
+ <a:documentation>component (a RequirementSubpart) carries its own semantic `class`, so this
234
+ uses BlockAttributesCore to avoid duplicating the custom-class slot in
235
+ BlockAttributes. See metanorma/metanorma-standoc#1197</a:documentation>
236
+ </ref>
229
237
  <oneOrMore>
230
238
  <choice>
231
239
  <a:documentation>Content of subpart: blocks, rather than provisions</a:documentation>
@@ -60,7 +60,16 @@ module Metanorma
60
60
  def schema_validate_with_retry(schema, file_path, max_retries: 3)
61
61
  retries = 0
62
62
  begin
63
- Jing.new(schema, encoding: "UTF-8").validate(file_path)
63
+ # id_check: false disables jing's DTD-compatibility ID/IDREF check
64
+ # (emits -i). That check is namespace-blind and falsely reports
65
+ # "conflicting ID-types for id" once the embedded W3C MathML grammar
66
+ # (CommonAtt types id as xsd:ID) coexists with standoc's own xsd:ID
67
+ # id (basicdoc-models#35). Safe to disable: id/anchor uniqueness is
68
+ # enforced by content_validate (repeat_id_validate1 /
69
+ # repeat_anchor_validate1 -> STANDOC_36) and IDREF is text in
70
+ # Semantic XML (isodoc.rng). NB ruby-jing 0.0.3 polarity is inverted:
71
+ # id_check: false is what emits -i (verified against validate_spec).
72
+ Jing.new(schema, encoding: "UTF-8", id_check: false).validate(file_path)
64
73
  rescue Jing::ExecutionError => e
65
74
  # Check if this is a "Too many open files" error
66
75
  if e.message.include?("Too many open files") && retries < max_retries
@@ -125,7 +134,11 @@ module Metanorma
125
134
 
126
135
  SVG_NS = "http://www.w3.org/2000/svg".freeze
127
136
 
128
- WILDCARD_ATTRS = "//stem | //metanorma-extension".freeze
137
+ # <stem> is no longer stripped: MathML is now explicitly defined in the
138
+ # grammar (basicdoc-models#35), so its attributes (incl.
139
+ # data-metanorma-numberformat) validate directly. metanorma-extension
140
+ # (UnitsML etc.) and <svg> remain any-element and are still stripped.
141
+ WILDCARD_ATTRS = "//metanorma-extension".freeze
129
142
 
130
143
  # RelaxNG cannot cope well with wildcard attributes. So we strip
131
144
  # any attributes from FormattedString instances (which can contain
@@ -25,7 +25,7 @@ module Metanorma
25
25
  # Instance variables to copy from converter
26
26
  def copied_instance_variables
27
27
  %i[localdir dataurimaxsize svg_conform_profile no_isobib iev_globalname
28
- iev_localname c lang script locale i18n doctype]
28
+ iev_localname c lang script locale i18n doctype docstage_valid]
29
29
  end
30
30
 
31
31
  def initialize(converter)
@@ -26,13 +26,13 @@ Gem::Specification.new do |spec|
26
26
  f.match(%r{^(test|spec|features|bin|.github)/}) \
27
27
  || f.match(%r{Rakefile|bin/rspec})
28
28
  end
29
- spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
29
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.3.0")
30
30
 
31
31
  spec.add_dependency "addressable", "~> 2.8"
32
32
  spec.add_dependency "asciidoctor", "~> 2.0.0"
33
33
  spec.add_dependency "crass", "~> 1.0.0"
34
34
  # spec.add_dependency "iev", "~> 0.3.5"
35
- spec.add_dependency "isodoc", "~> 3.6.0"
35
+ spec.add_dependency "isodoc", "~> 3.7.0"
36
36
  spec.add_dependency "metanorma-core", "~> 0.2.0"
37
37
  spec.add_dependency "metanorma-plugin-glossarist", "~> 0.3.0"
38
38
  spec.add_dependency "metanorma-plugin-lutaml", "~> 0.7.31"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-standoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.7
4
+ version: 3.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 3.6.0
60
+ version: 3.7.0
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 3.6.0
67
+ version: 3.7.0
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: metanorma-core
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -427,7 +427,6 @@ extra_rdoc_files: []
427
427
  files:
428
428
  - ".gitattributes"
429
429
  - ".gitignore"
430
- - ".hound.yml"
431
430
  - ".oss-guides.rubocop.yml"
432
431
  - ".rubocop.yml"
433
432
  - ".tex"
@@ -530,6 +529,12 @@ files:
530
529
  - lib/metanorma/validate/image.rb
531
530
  - lib/metanorma/validate/isodoc-compile.rng
532
531
  - lib/metanorma/validate/isodoc.rng
532
+ - lib/metanorma/validate/mathml4-content.rng
533
+ - lib/metanorma/validate/mathml4-core.rng
534
+ - lib/metanorma/validate/mathml4-presentation.rng
535
+ - lib/metanorma/validate/mathml4-strict-content.rng
536
+ - lib/metanorma/validate/mathml4.rng
537
+ - lib/metanorma/validate/metanorma-mathml.rng
533
538
  - lib/metanorma/validate/reqt.rng
534
539
  - lib/metanorma/validate/schema.rb
535
540
  - lib/metanorma/validate/section.rb
@@ -550,7 +555,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
550
555
  requirements:
551
556
  - - ">="
552
557
  - !ruby/object:Gem::Version
553
- version: 3.1.0
558
+ version: 3.3.0
554
559
  required_rubygems_version: !ruby/object:Gem::Requirement
555
560
  requirements:
556
561
  - - ">="
data/.hound.yml DELETED
@@ -1,5 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- ruby:
4
- enabled: true
5
- config_file: .rubocop.yml