metanorma-standoc 3.4.7 → 3.4.8

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,205 @@
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
+ <define name="ContExp">
15
+ <choice>
16
+ <ref name="semantics-contexp"/>
17
+ <ref name="cn"/>
18
+ <ref name="ci"/>
19
+ <ref name="csymbol"/>
20
+ <ref name="apply"/>
21
+ <ref name="bind"/>
22
+ <ref name="share"/>
23
+ <ref name="cerror"/>
24
+ <ref name="cbytes"/>
25
+ <ref name="cs"/>
26
+ </choice>
27
+ </define>
28
+ <define name="cn">
29
+ <element name="cn">
30
+ <ref name="cn.attributes"/>
31
+ <ref name="cn.content"/>
32
+ </element>
33
+ </define>
34
+ <define name="cn.content">
35
+ <text/>
36
+ </define>
37
+ <define name="cn.attributes">
38
+ <ref name="CommonAtt"/>
39
+ <attribute name="type">
40
+ <choice>
41
+ <value>integer</value>
42
+ <value>real</value>
43
+ <value>double</value>
44
+ <value>hexdouble</value>
45
+ </choice>
46
+ </attribute>
47
+ </define>
48
+ <define name="semantics-ci">
49
+ <element name="semantics">
50
+ <ref name="semantics.attributes"/>
51
+ <choice>
52
+ <ref name="ci"/>
53
+ <ref name="semantics-ci"/>
54
+ </choice>
55
+ <zeroOrMore>
56
+ <choice>
57
+ <ref name="annotation"/>
58
+ <ref name="annotation-xml"/>
59
+ </choice>
60
+ </zeroOrMore>
61
+ </element>
62
+ </define>
63
+ <define name="semantics-contexp">
64
+ <element name="semantics">
65
+ <ref name="semantics.attributes"/>
66
+ <ref name="ContExp"/>
67
+ <zeroOrMore>
68
+ <choice>
69
+ <ref name="annotation"/>
70
+ <ref name="annotation-xml"/>
71
+ </choice>
72
+ </zeroOrMore>
73
+ </element>
74
+ </define>
75
+ <define name="ci">
76
+ <element name="ci">
77
+ <ref name="ci.attributes"/>
78
+ <ref name="ci.content"/>
79
+ </element>
80
+ </define>
81
+ <define name="ci.attributes">
82
+ <ref name="CommonAtt"/>
83
+ <optional>
84
+ <ref name="ci.type"/>
85
+ </optional>
86
+ </define>
87
+ <define name="ci.type">
88
+ <attribute name="type">
89
+ <choice>
90
+ <value>integer</value>
91
+ <value>rational</value>
92
+ <value>real</value>
93
+ <value>complex</value>
94
+ <value>complex-polar</value>
95
+ <value>complex-cartesian</value>
96
+ <value>constant</value>
97
+ <value>function</value>
98
+ <value>vector</value>
99
+ <value>list</value>
100
+ <value>set</value>
101
+ <value>matrix</value>
102
+ </choice>
103
+ </attribute>
104
+ </define>
105
+ <define name="ci.content">
106
+ <text/>
107
+ </define>
108
+ <define name="csymbol">
109
+ <element name="csymbol">
110
+ <ref name="csymbol.attributes"/>
111
+ <ref name="csymbol.content"/>
112
+ </element>
113
+ </define>
114
+ <define name="SymbolName">
115
+ <data type="NCName"/>
116
+ </define>
117
+ <define name="csymbol.attributes">
118
+ <ref name="CommonAtt"/>
119
+ <ref name="cd"/>
120
+ </define>
121
+ <define name="csymbol.content">
122
+ <ref name="SymbolName"/>
123
+ </define>
124
+ <define name="BvarQ">
125
+ <zeroOrMore>
126
+ <ref name="bvar"/>
127
+ </zeroOrMore>
128
+ </define>
129
+ <define name="bvar">
130
+ <element name="bvar">
131
+ <ref name="CommonAtt"/>
132
+ <choice>
133
+ <ref name="ci"/>
134
+ <ref name="semantics-ci"/>
135
+ </choice>
136
+ </element>
137
+ </define>
138
+ <define name="apply">
139
+ <element name="apply">
140
+ <ref name="CommonAtt"/>
141
+ <ref name="apply.content"/>
142
+ </element>
143
+ </define>
144
+ <define name="apply.content">
145
+ <oneOrMore>
146
+ <ref name="ContExp"/>
147
+ </oneOrMore>
148
+ </define>
149
+ <define name="bind">
150
+ <element name="bind">
151
+ <ref name="CommonAtt"/>
152
+ <ref name="bind.content"/>
153
+ </element>
154
+ </define>
155
+ <define name="bind.content">
156
+ <ref name="ContExp"/>
157
+ <zeroOrMore>
158
+ <ref name="bvar"/>
159
+ </zeroOrMore>
160
+ <ref name="ContExp"/>
161
+ </define>
162
+ <define name="share">
163
+ <element name="share">
164
+ <ref name="CommonAtt"/>
165
+ <ref name="src"/>
166
+ <empty/>
167
+ </element>
168
+ </define>
169
+ <define name="cerror">
170
+ <element name="cerror">
171
+ <ref name="cerror.attributes"/>
172
+ <ref name="csymbol"/>
173
+ <zeroOrMore>
174
+ <ref name="ContExp"/>
175
+ </zeroOrMore>
176
+ </element>
177
+ </define>
178
+ <define name="cerror.attributes">
179
+ <ref name="CommonAtt"/>
180
+ </define>
181
+ <define name="cbytes">
182
+ <element name="cbytes">
183
+ <ref name="cbytes.attributes"/>
184
+ <ref name="base64"/>
185
+ </element>
186
+ </define>
187
+ <define name="cbytes.attributes">
188
+ <ref name="CommonAtt"/>
189
+ </define>
190
+ <define name="base64">
191
+ <data type="base64Binary"/>
192
+ </define>
193
+ <define name="cs">
194
+ <element name="cs">
195
+ <ref name="cs.attributes"/>
196
+ <text/>
197
+ </element>
198
+ </define>
199
+ <define name="cs.attributes">
200
+ <ref name="CommonAtt"/>
201
+ </define>
202
+ <define name="MathExpression" combine="choice">
203
+ <ref name="ContExp"/>
204
+ </define>
205
+ </grammar>
@@ -0,0 +1,23 @@
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>
@@ -0,0 +1,45 @@
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 3.0 RelaxNG grammar.
5
+ Includes the unmodified W3C grammar (start = math) and augments it with
6
+ metanorma's owned extension attributes. Referenced from basicdoc.rnc via:
7
+ mathml = external "mathml/metanorma-mathml.rnc"
8
+ Authoritative param list for data-metanorma-numberformat lives in plurimath
9
+ (Formatter::Standard::DEFAULT_OPTIONS); see metanorma/basicdoc-models#35.
10
+ -->
11
+ <include href="mathml3.rng"/>
12
+ <!--
13
+ metanorma number-formatting hint on <mn>; opaque comma-separated option
14
+ string parsed at presentation time (no-namespace data- attribute, which
15
+ the W3C CommonAtt/NonMathMLAtt does not otherwise permit).
16
+ -->
17
+ <define name="mn.attributes" combine="interleave">
18
+ <optional>
19
+ <attribute name="data-metanorma-numberformat"/>
20
+ </optional>
21
+ </define>
22
+ <!--
23
+ Foreign annotation-xml considered harmful: the metanorma lutaml-model
24
+ serialiser emits no foreign markup, so the W3C annotation-xml escape hatch
25
+ (and its anyElement wildcard) is forbidden in the MathML we process. This
26
+ 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
+
31
+ Expressed via `combine` (interleave with notAllowed) rather than an
32
+ include-override: annotation-xml/anyElement are defined in the transitively
33
+ included mathml3-common, and libxml2's RelaxNG (used by Nokogiri for fragment
34
+ / passthrough validation) cannot override a define from a nested include - -
35
+ it demands the combine attribute and otherwise fails to compile the whole
36
+ grammar (every passthrough then wrongly reports "Invalid passthrough
37
+ content"). jing accepts both forms; combine satisfies both. basicdoc-models#35
38
+ -->
39
+ <define name="annotation-xml" combine="interleave">
40
+ <notAllowed/>
41
+ </define>
42
+ <define name="anyElement" combine="interleave">
43
+ <notAllowed/>
44
+ </define>
45
+ </grammar>
@@ -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
@@ -26,7 +26,7 @@ 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"
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.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -530,6 +530,12 @@ files:
530
530
  - lib/metanorma/validate/image.rb
531
531
  - lib/metanorma/validate/isodoc-compile.rng
532
532
  - lib/metanorma/validate/isodoc.rng
533
+ - lib/metanorma/validate/mathml3-common.rng
534
+ - lib/metanorma/validate/mathml3-content.rng
535
+ - lib/metanorma/validate/mathml3-presentation.rng
536
+ - lib/metanorma/validate/mathml3-strict-content.rng
537
+ - lib/metanorma/validate/mathml3.rng
538
+ - lib/metanorma/validate/metanorma-mathml.rng
533
539
  - lib/metanorma/validate/reqt.rng
534
540
  - lib/metanorma/validate/schema.rb
535
541
  - lib/metanorma/validate/section.rb
@@ -550,7 +556,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
550
556
  requirements:
551
557
  - - ">="
552
558
  - !ruby/object:Gem::Version
553
- version: 3.1.0
559
+ version: 3.3.0
554
560
  required_rubygems_version: !ruby/object:Gem::Requirement
555
561
  requirements:
556
562
  - - ">="