metanorma-cc 2.8.9 → 2.8.10

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.
@@ -1,16 +1,47 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!--
3
- This is the Mathematical Markup Language (MathML) 3.0, an XML
4
- application for describing mathematical notation and capturing
5
- both its structure and content.
6
-
7
- Copyright 1998-2014 W3C (MIT, ERCIM, Keio, Beihang)
3
+ MathML 4 (Strict Content)
4
+ #########################
5
+ -->
6
+ <!--
7
+ Copyright 1998-2026 W3C (MIT, ERCIM, Keio, Beihang)
8
8
 
9
9
  Use and distribution of this code are permitted under the terms
10
10
  W3C Software Notice and License
11
11
  http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
12
12
  -->
13
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
+ -->
14
45
  <define name="ContExp">
15
46
  <choice>
16
47
  <ref name="semantics-contexp"/>
@@ -47,7 +78,7 @@
47
78
  </define>
48
79
  <define name="semantics-ci">
49
80
  <element name="semantics">
50
- <ref name="semantics.attributes"/>
81
+ <ref name="CommonAtt"/>
51
82
  <choice>
52
83
  <ref name="ci"/>
53
84
  <ref name="semantics-ci"/>
@@ -62,8 +93,8 @@
62
93
  </define>
63
94
  <define name="semantics-contexp">
64
95
  <element name="semantics">
65
- <ref name="semantics.attributes"/>
66
- <ref name="ContExp"/>
96
+ <ref name="CommonAtt"/>
97
+ <ref name="MathExpression"/>
67
98
  <zeroOrMore>
68
99
  <choice>
69
100
  <ref name="annotation"/>
@@ -72,6 +103,42 @@
72
103
  </zeroOrMore>
73
104
  </element>
74
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
+ -->
75
142
  <define name="ci">
76
143
  <element name="ci">
77
144
  <ref name="ci.attributes"/>
@@ -121,6 +188,23 @@
121
188
  <define name="csymbol.content">
122
189
  <ref name="SymbolName"/>
123
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>
124
208
  <define name="BvarQ">
125
209
  <zeroOrMore>
126
210
  <ref name="bvar"/>
@@ -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>
@@ -1,18 +1,21 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns="http://relaxng.org/ns/structure/1.0">
3
3
  <!--
4
- Metanorma wrapper around the vendored W3C MathML 3.0 RelaxNG grammar.
5
- Includes the unmodified W3C grammar (start = math) and augments it with
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
6
7
  metanorma's owned extension attributes. Referenced from basicdoc.rnc via:
7
8
  mathml = external "mathml/metanorma-mathml.rnc"
8
9
  Authoritative param list for data-metanorma-numberformat lives in plurimath
9
10
  (Formatter::Standard::DEFAULT_OPTIONS); see metanorma/basicdoc-models#35.
11
+ MathML 3 -> 4 migration: metanorma/basicdoc-models#39 /
12
+ metanorma/metanorma#585.
10
13
  -->
11
- <include href="mathml3.rng"/>
14
+ <include href="mathml4.rng"/>
12
15
  <!--
13
16
  metanorma number-formatting hint on <mn>; opaque comma-separated option
14
17
  string parsed at presentation time (no-namespace data- attribute, which
15
- the W3C CommonAtt/NonMathMLAtt does not otherwise permit).
18
+ the W3C MathMLPGlobalAttributes/NonMathMLAtt does not otherwise permit).
16
19
  -->
17
20
  <define name="mn.attributes" combine="interleave">
18
21
  <optional>
@@ -24,13 +27,14 @@
24
27
  serialiser emits no foreign markup, so the W3C annotation-xml escape hatch
25
28
  (and its anyElement wildcard) is forbidden in the MathML we process. This
26
29
  also removes the untyped `id` attribute the wildcard permits, which clashes
27
- with xsd:ID under RELAX NG ID-type consistency (the callout-annotation error).
28
- metanorma only emits presentation MathML; pre-empting the escape hatch before
29
- semantic MathML is ever wired. Text-only <annotation> is retained.
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.
30
34
 
31
35
  Expressed via `combine` (interleave with notAllowed) rather than an
32
36
  include-override: annotation-xml/anyElement are defined in the transitively
33
- included mathml3-common, and libxml2's RelaxNG (used by Nokogiri for fragment
37
+ included mathml4-core, and libxml2's RelaxNG (used by Nokogiri for fragment
34
38
  / passthrough validation) cannot override a define from a nested include - -
35
39
  it demands the combine attribute and otherwise fails to compile the whole
36
40
  grammar (every passthrough then wrongly reports "Invalid passthrough
@@ -43,3 +47,13 @@
43
47
  <notAllowed/>
44
48
  </define>
45
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
+ -->
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Cc
3
- VERSION = "2.8.9".freeze
3
+ VERSION = "2.8.10".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.9
4
+ version: 2.8.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -204,7 +204,6 @@ extensions: []
204
204
  extra_rdoc_files: []
205
205
  files:
206
206
  - ".gitignore"
207
- - ".hound.yml"
208
207
  - ".rubocop.yml"
209
208
  - CODE_OF_CONDUCT.md
210
209
  - Gemfile
@@ -247,11 +246,11 @@ files:
247
246
  - lib/metanorma/cc/converter.rb
248
247
  - lib/metanorma/cc/isodoc.rng
249
248
  - lib/metanorma/cc/log.rb
250
- - lib/metanorma/cc/mathml3-common.rng
251
- - lib/metanorma/cc/mathml3-content.rng
252
- - lib/metanorma/cc/mathml3-presentation.rng
253
- - lib/metanorma/cc/mathml3-strict-content.rng
254
- - lib/metanorma/cc/mathml3.rng
249
+ - lib/metanorma/cc/mathml4-content.rng
250
+ - lib/metanorma/cc/mathml4-core.rng
251
+ - lib/metanorma/cc/mathml4-presentation.rng
252
+ - lib/metanorma/cc/mathml4-strict-content.rng
253
+ - lib/metanorma/cc/mathml4.rng
255
254
  - lib/metanorma/cc/metanorma-mathml.rng
256
255
  - lib/metanorma/cc/processor.rb
257
256
  - lib/metanorma/cc/relaton-cc.rng
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
@@ -1,257 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- This is the Mathematical Markup Language (MathML) 3.0, an XML
4
- application for describing mathematical notation and capturing
5
- both its structure and content.
6
-
7
- Copyright 1998-2014 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>
15
- <ref name="math"/>
16
- </start>
17
- <define name="math">
18
- <element name="math">
19
- <ref name="math.attributes"/>
20
- <zeroOrMore>
21
- <ref name="MathExpression"/>
22
- </zeroOrMore>
23
- </element>
24
- </define>
25
- <define name="MathExpression">
26
- <ref name="semantics"/>
27
- </define>
28
- <define name="NonMathMLAtt">
29
- <attribute>
30
- <anyName>
31
- <except>
32
- <nsName ns=""/>
33
- <nsName/>
34
- </except>
35
- </anyName>
36
- <data type="string"/>
37
- </attribute>
38
- </define>
39
- <define name="CommonDeprecatedAtt">
40
- <optional>
41
- <attribute name="other"/>
42
- </optional>
43
- </define>
44
- <define name="CommonAtt">
45
- <optional>
46
- <attribute name="id">
47
- <data type="ID"/>
48
- </attribute>
49
- </optional>
50
- <optional>
51
- <attribute name="xref"/>
52
- </optional>
53
- <optional>
54
- <attribute name="class">
55
- <data type="NMTOKENS"/>
56
- </attribute>
57
- </optional>
58
- <optional>
59
- <attribute name="style">
60
- <data type="string"/>
61
- </attribute>
62
- </optional>
63
- <optional>
64
- <attribute name="href">
65
- <data type="anyURI"/>
66
- </attribute>
67
- </optional>
68
- <ref name="CommonDeprecatedAtt"/>
69
- <zeroOrMore>
70
- <ref name="NonMathMLAtt"/>
71
- </zeroOrMore>
72
- </define>
73
- <define name="math.attributes">
74
- <ref name="CommonAtt"/>
75
- <optional>
76
- <attribute name="display">
77
- <choice>
78
- <value>block</value>
79
- <value>inline</value>
80
- </choice>
81
- </attribute>
82
- </optional>
83
- <optional>
84
- <attribute name="maxwidth">
85
- <ref name="length"/>
86
- </attribute>
87
- </optional>
88
- <optional>
89
- <attribute name="overflow">
90
- <choice>
91
- <value>linebreak</value>
92
- <value>scroll</value>
93
- <value>elide</value>
94
- <value>truncate</value>
95
- <value>scale</value>
96
- </choice>
97
- </attribute>
98
- </optional>
99
- <optional>
100
- <attribute name="altimg">
101
- <data type="anyURI"/>
102
- </attribute>
103
- </optional>
104
- <optional>
105
- <attribute name="altimg-width">
106
- <ref name="length"/>
107
- </attribute>
108
- </optional>
109
- <optional>
110
- <attribute name="altimg-height">
111
- <ref name="length"/>
112
- </attribute>
113
- </optional>
114
- <optional>
115
- <attribute name="altimg-valign">
116
- <choice>
117
- <ref name="length"/>
118
- <value>top</value>
119
- <value>middle</value>
120
- <value>bottom</value>
121
- </choice>
122
- </attribute>
123
- </optional>
124
- <optional>
125
- <attribute name="alttext"/>
126
- </optional>
127
- <optional>
128
- <attribute name="cdgroup">
129
- <data type="anyURI"/>
130
- </attribute>
131
- </optional>
132
- <ref name="math.deprecatedattributes"/>
133
- </define>
134
- <!--
135
- the mathml3-presentation schema adds additional attributes
136
- to the math element, all those valid on mstyle
137
- -->
138
- <define name="math.deprecatedattributes">
139
- <optional>
140
- <attribute name="mode">
141
- <data type="string"/>
142
- </attribute>
143
- </optional>
144
- <optional>
145
- <attribute name="macros">
146
- <data type="string"/>
147
- </attribute>
148
- </optional>
149
- </define>
150
- <define name="name">
151
- <attribute name="name">
152
- <data type="NCName"/>
153
- </attribute>
154
- </define>
155
- <define name="cd">
156
- <attribute name="cd">
157
- <data type="NCName"/>
158
- </attribute>
159
- </define>
160
- <define name="src">
161
- <optional>
162
- <attribute name="src">
163
- <data type="anyURI"/>
164
- </attribute>
165
- </optional>
166
- </define>
167
- <define name="annotation">
168
- <element name="annotation">
169
- <ref name="annotation.attributes"/>
170
- <text/>
171
- </element>
172
- </define>
173
- <define name="annotation-xml.model">
174
- <zeroOrMore>
175
- <choice>
176
- <ref name="MathExpression"/>
177
- <ref name="anyElement"/>
178
- </choice>
179
- </zeroOrMore>
180
- </define>
181
- <define name="anyElement">
182
- <element>
183
- <anyName>
184
- <except>
185
- <nsName/>
186
- </except>
187
- </anyName>
188
- <zeroOrMore>
189
- <choice>
190
- <attribute>
191
- <anyName/>
192
- </attribute>
193
- <text/>
194
- <ref name="anyElement"/>
195
- </choice>
196
- </zeroOrMore>
197
- </element>
198
- </define>
199
- <define name="annotation-xml">
200
- <element name="annotation-xml">
201
- <ref name="annotation.attributes"/>
202
- <ref name="annotation-xml.model"/>
203
- </element>
204
- </define>
205
- <define name="annotation.attributes">
206
- <ref name="CommonAtt"/>
207
- <optional>
208
- <ref name="cd"/>
209
- </optional>
210
- <optional>
211
- <ref name="name"/>
212
- </optional>
213
- <ref name="DefEncAtt"/>
214
- <optional>
215
- <ref name="src"/>
216
- </optional>
217
- </define>
218
- <define name="DefEncAtt">
219
- <optional>
220
- <attribute name="encoding">
221
- <data type="string"/>
222
- </attribute>
223
- </optional>
224
- <optional>
225
- <attribute name="definitionURL">
226
- <data type="anyURI"/>
227
- </attribute>
228
- </optional>
229
- </define>
230
- <define name="semantics">
231
- <element name="semantics">
232
- <ref name="semantics.attributes"/>
233
- <ref name="MathExpression"/>
234
- <zeroOrMore>
235
- <choice>
236
- <ref name="annotation"/>
237
- <ref name="annotation-xml"/>
238
- </choice>
239
- </zeroOrMore>
240
- </element>
241
- </define>
242
- <define name="semantics.attributes">
243
- <ref name="CommonAtt"/>
244
- <ref name="DefEncAtt"/>
245
- <optional>
246
- <ref name="cd"/>
247
- </optional>
248
- <optional>
249
- <ref name="name"/>
250
- </optional>
251
- </define>
252
- <define name="length">
253
- <data type="string">
254
- <param name="pattern">\s*((-?[0-9]*([0-9]\.?|\.[0-9])[0-9]*(e[mx]|in|cm|mm|p[xtc]|%)?)|(negative)?((very){0,2}thi(n|ck)|medium)mathspace)\s*</param>
255
- </data>
256
- </define>
257
- </grammar>
@@ -1,23 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- This is the Mathematical Markup Language (MathML) 3.0, an XML
4
- application for describing mathematical notation and capturing
5
- both its structure and content.
6
-
7
- Copyright 1998-2010 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:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns="http://relaxng.org/ns/structure/1.0">
14
- <include href="mathml3-content.rng">
15
- <a:documentation>Content MathML</a:documentation>
16
- </include>
17
- <include href="mathml3-presentation.rng">
18
- <a:documentation>Presentation MathML</a:documentation>
19
- </include>
20
- <include href="mathml3-common.rng">
21
- <a:documentation>math and semantics common to both Content and Presentation</a:documentation>
22
- </include>
23
- </grammar>