metanorma-generic 3.4.0 → 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.
@@ -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>
@@ -47,7 +51,15 @@ the tag name of the top level containers</a:documentation>
47
51
  </optional>
48
52
  <optional>
49
53
  <attribute name="model">
50
- <a:documentation>Model of requirements realised by this requirement, e.g. "ogc" for Modspec</a:documentation>
54
+ <a:documentation>Model of requirements realised by this requirement, e.g. "ogc" for Modspec.
55
+ Current legal values: ogc, default</a:documentation>
56
+ </attribute>
57
+ </optional>
58
+ <optional>
59
+ <attribute name="render">
60
+ <a:documentation>Rendering of requirements realised by this requirement. Current legal values:
61
+ default:: default, inline
62
+ ogc:: default</a:documentation>
51
63
  </attribute>
52
64
  </optional>
53
65
  <optional>
@@ -217,7 +229,11 @@ machine-readable, and is not to be rendered as document output</a:documentation>
217
229
  <data type="boolean"/>
218
230
  </attribute>
219
231
  </optional>
220
- <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>
221
237
  <oneOrMore>
222
238
  <choice>
223
239
  <a:documentation>Content of subpart: blocks, rather than provisions</a:documentation>
@@ -21,13 +21,27 @@ module Metanorma
21
21
  end
22
22
 
23
23
  def stage_validate(xmldoc)
24
- stages = configuration.stage_abbreviations&.keys || return
25
- stages.empty? and return
24
+ stages = recognised_stages
25
+ stages.nil? || stages.empty? and return
26
26
  stage = xmldoc.at("//bibdata/status/stage")&.text
27
27
  stages.include? stage or
28
28
  @log.add("GENERIC_2", nil, params: [stage])
29
29
  end
30
30
 
31
+ # The stage repertoire of a taste layered on this flavour
32
+ # (:docstage-valid:, populated with the base stages the taste maps
33
+ # its own stages to) supersedes the flavour's own repertoire.
34
+ # The flavour's repertoire is not just the stages needing
35
+ # abbreviations: published stages and the default stage are
36
+ # recognised too.
37
+ def recognised_stages
38
+ @docstage_valid and return @docstage_valid
39
+ keys = configuration.stage_abbreviations&.keys or return
40
+ (keys.map(&:to_s) +
41
+ Array(configuration.published_stages).map(&:to_s) +
42
+ [configuration.default_stage]).compact.uniq
43
+ end
44
+
31
45
  def committee_validate(xmldoc)
32
46
  committees = Array(configuration&.committees) || return
33
47
  committees.empty? and return
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Generic
3
- VERSION = "3.4.0".freeze
3
+ VERSION = "3.4.3".freeze
4
4
  end
5
5
  end
@@ -25,9 +25,9 @@ Gem::Specification.new do |spec|
25
25
  spec.bindir = "exe"
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ["lib"]
28
- spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
28
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.3.0")
29
29
 
30
- spec.add_dependency "metanorma-standoc", "~> 3.4.2"
30
+ spec.add_dependency "metanorma-standoc", "~> 3.4.9"
31
31
 
32
32
  spec.add_development_dependency "debug"
33
33
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-generic
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-05-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: metanorma-standoc
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: 3.4.2
18
+ version: 3.4.9
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: 3.4.2
25
+ version: 3.4.9
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: debug
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -217,7 +216,6 @@ extensions: []
217
216
  extra_rdoc_files: []
218
217
  files:
219
218
  - ".gitignore"
220
- - ".hound.yml"
221
219
  - ".rubocop.yml"
222
220
  - CODE_OF_CONDUCT.md
223
221
  - Gemfile
@@ -248,7 +246,6 @@ files:
248
246
  - lib/metanorma-generic.rb
249
247
  - lib/metanorma/generic.rb
250
248
  - lib/metanorma/generic/basicdoc.rng
251
- - lib/metanorma/generic/bibdata_config.rb
252
249
  - lib/metanorma/generic/biblio-standoc.rng
253
250
  - lib/metanorma/generic/biblio.rng
254
251
  - lib/metanorma/generic/cleanup.rb
@@ -258,6 +255,12 @@ files:
258
255
  - lib/metanorma/generic/generic.rng
259
256
  - lib/metanorma/generic/isodoc.rng
260
257
  - lib/metanorma/generic/log.rb
258
+ - lib/metanorma/generic/mathml4-content.rng
259
+ - lib/metanorma/generic/mathml4-core.rng
260
+ - lib/metanorma/generic/mathml4-presentation.rng
261
+ - lib/metanorma/generic/mathml4-strict-content.rng
262
+ - lib/metanorma/generic/mathml4.rng
263
+ - lib/metanorma/generic/metanorma-mathml.rng
261
264
  - lib/metanorma/generic/processor.rb
262
265
  - lib/metanorma/generic/reqt.rng
263
266
  - lib/metanorma/generic/rsd.rng
@@ -269,7 +272,6 @@ homepage: https://github.com/metanorma/metanorma-generic
269
272
  licenses:
270
273
  - BSD-2-Clause
271
274
  metadata: {}
272
- post_install_message:
273
275
  rdoc_options: []
274
276
  require_paths:
275
277
  - lib
@@ -277,15 +279,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
277
279
  requirements:
278
280
  - - ">="
279
281
  - !ruby/object:Gem::Version
280
- version: 3.1.0
282
+ version: 3.3.0
281
283
  required_rubygems_version: !ruby/object:Gem::Requirement
282
284
  requirements:
283
285
  - - ">="
284
286
  - !ruby/object:Gem::Version
285
287
  version: '0'
286
288
  requirements: []
287
- rubygems_version: 3.5.22
288
- signing_key:
289
+ rubygems_version: 4.0.10
289
290
  specification_version: 4
290
291
  summary: Metanorma template gem for customisation.
291
292
  test_files: []
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,26 +0,0 @@
1
- require "relaton-cli"
2
-
3
- module Metanorma
4
- module Generic
5
- class BibdataConfig < ::Lutaml::Model::Serializable
6
- class Bibdata < ::Lutaml::Model::Serializable
7
- model ::Relaton::Bib::ItemData
8
- end
9
-
10
- attribute :bibdata, Bibdata
11
-
12
- xml do
13
- root "metanorma"
14
- map_element "bibdata", to: :bibdata, with: { from: :bibdata_from_xml,
15
- to: :bibdata_to_xml }
16
- end
17
-
18
- def bibdata_from_xml(model, node)
19
- node or return
20
- model.bibdata = Relaton::Cli.parse_xml(node.adapter_node.native)
21
- end
22
-
23
- def bibdata_to_xml(model, parent, doc); end
24
- end
25
- end
26
- end