metanorma-iso 3.4.6 → 3.4.7
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 +4 -4
- data/.rubocop.yml +13 -1
- data/lib/isodoc/iso/html/style-human.css +0 -4
- data/lib/isodoc/iso/html/style-human.scss +0 -2
- data/lib/isodoc/iso/html/style-iso.css +0 -2
- data/lib/isodoc/iso/html/style-iso.scss +0 -2
- data/lib/isodoc/iso/iso.amendment.xsl +534 -74
- data/lib/isodoc/iso/iso.international-standard.xsl +534 -74
- data/lib/isodoc/iso/presentation_origin.rb +2 -6
- data/lib/isodoc/iso/presentation_xml_convert.rb +5 -1
- data/lib/isodoc/iso/word_cleanup.rb +1 -2
- data/lib/isodoc/iso/word_convert.rb +11 -0
- data/lib/metanorma/iso/basicdoc.rng +31 -6
- data/lib/metanorma/iso/cleanup_biblio.rb +53 -14
- data/lib/metanorma/iso/isodoc.rng +22 -3
- data/lib/metanorma/iso/mathml3-common.rng +257 -0
- data/lib/metanorma/iso/mathml3-content.rng +1544 -0
- data/lib/metanorma/iso/mathml3-presentation.rng +2324 -0
- data/lib/metanorma/iso/mathml3-strict-content.rng +205 -0
- data/lib/metanorma/iso/mathml3.rng +23 -0
- data/lib/metanorma/iso/metanorma-mathml.rng +45 -0
- data/lib/metanorma/iso/publisher_identity.rb +36 -0
- data/lib/metanorma/iso/reqt.rng +10 -2
- data/lib/metanorma/iso/validate_section.rb +1 -5
- data/lib/metanorma/iso/version.rb +1 -1
- data/lib/metanorma-iso.rb +1 -0
- data/metanorma-iso.gemspec +1 -1
- metadata +9 -2
|
@@ -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>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module Metanorma
|
|
2
|
+
module Iso
|
|
3
|
+
# Canonical "is this node published by ISO / IEC?" check, shared across the
|
|
4
|
+
# metanorma-converter layer (bare xpath) and the isodoc layer (namespaced
|
|
5
|
+
# xpath). Pass the converter's #ns as the `ns:` resolver in the isodoc layer;
|
|
6
|
+
# the default identity resolver is correct for the un-namespaced Semantic XML
|
|
7
|
+
# of the cleanup layer. Deliberately NOT pub_class, which is sort-oriented and
|
|
8
|
+
# overridden per flavour.
|
|
9
|
+
module PublisherIdentity
|
|
10
|
+
PUBLISHER = "./contributor[role/@type = 'publisher']/organization".freeze
|
|
11
|
+
ISO_NAME = "International Organization for Standardization".freeze
|
|
12
|
+
IEC_NAME = "International Electrotechnical Commission".freeze
|
|
13
|
+
IDENTITY_NS = ->(xpath) { xpath }
|
|
14
|
+
|
|
15
|
+
module_function
|
|
16
|
+
|
|
17
|
+
def iso_publisher?(node, ns: IDENTITY_NS)
|
|
18
|
+
publisher_match?(node, ns, "ISO", ISO_NAME)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def iec_publisher?(node, ns: IDENTITY_NS)
|
|
22
|
+
publisher_match?(node, ns, "IEC", IEC_NAME)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def iso_iec_publisher?(node, ns: IDENTITY_NS)
|
|
26
|
+
iso_publisher?(node, ns: ns) || iec_publisher?(node, ns: ns)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def publisher_match?(node, ns, abbr, name)
|
|
30
|
+
node or return false
|
|
31
|
+
!!(node.at(ns.call("#{PUBLISHER}[abbreviation = '#{abbr}']")) ||
|
|
32
|
+
node.at(ns.call("#{PUBLISHER}[name = '#{name}']")))
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
data/lib/metanorma/iso/reqt.rng
CHANGED
|
@@ -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="
|
|
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="
|
|
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>
|
|
@@ -177,14 +177,10 @@ module Metanorma
|
|
|
177
177
|
NORM_BIBITEMS =
|
|
178
178
|
"//references[@normative = 'true']/bibitem".freeze
|
|
179
179
|
|
|
180
|
-
ISO_PUBLISHER_XPATH = <<~XPATH.freeze
|
|
181
|
-
./contributor[role/@type = 'publisher']/organization[abbreviation = 'ISO' or abbreviation = 'IEC' or name = 'International Organization for Standardization' or name = 'International Electrotechnical Commission']
|
|
182
|
-
XPATH
|
|
183
|
-
|
|
184
180
|
# ISO/IEC DIR 2, 10.2
|
|
185
181
|
def norm_bibitem_style(root)
|
|
186
182
|
root.xpath(NORM_BIBITEMS).each do |b|
|
|
187
|
-
|
|
183
|
+
unless PublisherIdentity.iso_iec_publisher?(b)
|
|
188
184
|
@log.add("ISO_42", b, params: [b.text])
|
|
189
185
|
end
|
|
190
186
|
end
|
data/lib/metanorma-iso.rb
CHANGED
data/metanorma-iso.gemspec
CHANGED
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
|| f.match(%r{Rakefile|bin/rspec})
|
|
31
31
|
end
|
|
32
32
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
|
33
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.
|
|
33
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.3.0")
|
|
34
34
|
|
|
35
35
|
spec.add_dependency "metanorma-standoc", "~> 3.4.2"
|
|
36
36
|
spec.add_dependency "mnconvert", "~> 1.14"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma-iso
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.4.
|
|
4
|
+
version: 3.4.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -388,7 +388,14 @@ files:
|
|
|
388
388
|
- lib/metanorma/iso/isostandard.rnc
|
|
389
389
|
- lib/metanorma/iso/isostandard.rng
|
|
390
390
|
- lib/metanorma/iso/log.rb
|
|
391
|
+
- lib/metanorma/iso/mathml3-common.rng
|
|
392
|
+
- lib/metanorma/iso/mathml3-content.rng
|
|
393
|
+
- lib/metanorma/iso/mathml3-presentation.rng
|
|
394
|
+
- lib/metanorma/iso/mathml3-strict-content.rng
|
|
395
|
+
- lib/metanorma/iso/mathml3.rng
|
|
396
|
+
- lib/metanorma/iso/metanorma-mathml.rng
|
|
391
397
|
- lib/metanorma/iso/processor.rb
|
|
398
|
+
- lib/metanorma/iso/publisher_identity.rb
|
|
392
399
|
- lib/metanorma/iso/relaton-iso.rng
|
|
393
400
|
- lib/metanorma/iso/reqt.rng
|
|
394
401
|
- lib/metanorma/iso/section.rb
|
|
@@ -419,7 +426,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
419
426
|
requirements:
|
|
420
427
|
- - ">="
|
|
421
428
|
- !ruby/object:Gem::Version
|
|
422
|
-
version: 3.
|
|
429
|
+
version: 3.3.0
|
|
423
430
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
424
431
|
requirements:
|
|
425
432
|
- - ">="
|