metanorma-iso 2.2.0 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/automerge.yml +31 -0
- data/lib/isodoc/iso/html/style-human.css +1 -1
- data/lib/isodoc/iso/html/style-iso.css +1 -1
- data/lib/isodoc/iso/i18n-en.yaml +9 -2
- data/lib/isodoc/iso/i18n-fr.yaml +9 -2
- data/lib/isodoc/iso/i18n-ru.yaml +9 -2
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -2
- data/lib/isodoc/iso/iso.amendment.xsl +54 -4
- data/lib/isodoc/iso/iso.international-standard.xsl +54 -4
- data/lib/isodoc/iso/presentation_xref.rb +10 -7
- data/lib/isodoc/iso/sections.rb +1 -1
- data/lib/isodoc/iso/xref.rb +37 -88
- data/lib/isodoc/iso/xref_section.rb +79 -0
- data/lib/metanorma/iso/basicdoc.rng +0 -27
- data/lib/metanorma/iso/biblio-standoc.rng +164 -0
- data/lib/metanorma/iso/biblio.rng +45 -18
- data/lib/metanorma/iso/isodoc.rng +31 -194
- data/lib/metanorma/iso/isostandard-amd.rng +3 -54
- data/lib/metanorma/iso/isostandard-compile.rng +7 -0
- data/lib/metanorma/iso/isostandard.rng +1 -192
- data/lib/metanorma/iso/relaton-iso.rng +225 -0
- data/lib/metanorma/iso/validate.rb +7 -7
- data/lib/metanorma/iso/version.rb +1 -1
- data/lib/metanorma/requirements/modspec.rb +26 -39
- data/spec/isodoc/inline_spec.rb +1 -1
- data/spec/metanorma/base_spec.rb +3 -3
- data/spec/metanorma/refs_spec.rb +7 -7
- data/spec/metanorma/validate_spec.rb +55 -55
- data/spec/requirements/requirement_components_spec.rb +53 -65
- data/spec/requirements/requirements_spec.rb +178 -263
- data/spec/requirements/xref_spec.rb +35 -35
- data/spec/vcr_cassettes/docrels.yml +32 -32
- data/spec/vcr_cassettes/withdrawn_iso.yml +30 -30
- metadata +7 -2
@@ -1,90 +1,10 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<grammar
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
3
|
<!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
|
4
4
|
<include href="isodoc.rng">
|
5
5
|
<start>
|
6
6
|
<ref name="iso-standard"/>
|
7
7
|
</start>
|
8
|
-
<define name="organization">
|
9
|
-
<element name="organization">
|
10
|
-
<oneOrMore>
|
11
|
-
<ref name="orgname"/>
|
12
|
-
</oneOrMore>
|
13
|
-
<optional>
|
14
|
-
<ref name="abbreviation"/>
|
15
|
-
</optional>
|
16
|
-
<optional>
|
17
|
-
<ref name="uri"/>
|
18
|
-
</optional>
|
19
|
-
<zeroOrMore>
|
20
|
-
<ref name="org-identifier"/>
|
21
|
-
</zeroOrMore>
|
22
|
-
<zeroOrMore>
|
23
|
-
<ref name="contact"/>
|
24
|
-
</zeroOrMore>
|
25
|
-
<optional>
|
26
|
-
<ref name="technical-committee"/>
|
27
|
-
</optional>
|
28
|
-
<optional>
|
29
|
-
<ref name="subcommittee"/>
|
30
|
-
</optional>
|
31
|
-
<optional>
|
32
|
-
<ref name="workgroup"/>
|
33
|
-
</optional>
|
34
|
-
<optional>
|
35
|
-
<ref name="secretariat"/>
|
36
|
-
</optional>
|
37
|
-
</element>
|
38
|
-
</define>
|
39
|
-
<define name="BibDataExtensionType">
|
40
|
-
<ref name="doctype"/>
|
41
|
-
<optional>
|
42
|
-
<ref name="docsubtype"/>
|
43
|
-
</optional>
|
44
|
-
<optional>
|
45
|
-
<ref name="horizontal"/>
|
46
|
-
</optional>
|
47
|
-
<ref name="editorialgroup"/>
|
48
|
-
<optional>
|
49
|
-
<ref name="approvalgroup"/>
|
50
|
-
</optional>
|
51
|
-
<zeroOrMore>
|
52
|
-
<ref name="ics"/>
|
53
|
-
</zeroOrMore>
|
54
|
-
<ref name="structuredidentifier"/>
|
55
|
-
<optional>
|
56
|
-
<ref name="stagename"/>
|
57
|
-
</optional>
|
58
|
-
</define>
|
59
|
-
<define name="bdate">
|
60
|
-
<element name="date">
|
61
|
-
<attribute name="type">
|
62
|
-
<choice>
|
63
|
-
<ref name="BibliographicDateType"/>
|
64
|
-
<text/>
|
65
|
-
</choice>
|
66
|
-
</attribute>
|
67
|
-
<choice>
|
68
|
-
<group>
|
69
|
-
<element name="from">
|
70
|
-
<ref name="ISO8601Date"/>
|
71
|
-
</element>
|
72
|
-
<optional>
|
73
|
-
<element name="to">
|
74
|
-
<ref name="ISO8601Date"/>
|
75
|
-
</element>
|
76
|
-
</optional>
|
77
|
-
</group>
|
78
|
-
<element name="on">
|
79
|
-
<choice>
|
80
|
-
<ref name="ISO8601Date"/>
|
81
|
-
<value>--</value>
|
82
|
-
<value>–</value>
|
83
|
-
</choice>
|
84
|
-
</element>
|
85
|
-
</choice>
|
86
|
-
</element>
|
87
|
-
</define>
|
88
8
|
<define name="sections">
|
89
9
|
<element name="sections">
|
90
10
|
<zeroOrMore>
|
@@ -266,40 +186,6 @@
|
|
266
186
|
</optional>
|
267
187
|
</element>
|
268
188
|
</define>
|
269
|
-
<define name="DocumentType">
|
270
|
-
<choice>
|
271
|
-
<value>international-standard</value>
|
272
|
-
<value>technical-specification</value>
|
273
|
-
<value>technical-report</value>
|
274
|
-
<value>publicly-available-specification</value>
|
275
|
-
<value>international-workshop-agreement</value>
|
276
|
-
<value>guide</value>
|
277
|
-
<value>amendment</value>
|
278
|
-
<value>technical-corrigendum</value>
|
279
|
-
<value>directive</value>
|
280
|
-
</choice>
|
281
|
-
</define>
|
282
|
-
<define name="DocumentSubtype">
|
283
|
-
<choice>
|
284
|
-
<value>specification</value>
|
285
|
-
<value>method-of-test</value>
|
286
|
-
<value>vocabulary</value>
|
287
|
-
<value>code-of-practice</value>
|
288
|
-
</choice>
|
289
|
-
</define>
|
290
|
-
<define name="structuredidentifier">
|
291
|
-
<element name="structuredidentifier">
|
292
|
-
<optional>
|
293
|
-
<attribute name="type"/>
|
294
|
-
</optional>
|
295
|
-
<group>
|
296
|
-
<ref name="documentnumber"/>
|
297
|
-
<optional>
|
298
|
-
<ref name="tc-documentnumber"/>
|
299
|
-
</optional>
|
300
|
-
</group>
|
301
|
-
</element>
|
302
|
-
</define>
|
303
189
|
<define name="foreword">
|
304
190
|
<element name="foreword">
|
305
191
|
<ref name="Basic-Section"/>
|
@@ -310,11 +196,6 @@
|
|
310
196
|
<ref name="Content-Section"/>
|
311
197
|
</element>
|
312
198
|
</define>
|
313
|
-
<define name="editorialgroup">
|
314
|
-
<element name="editorialgroup">
|
315
|
-
<ref name="ISOProjectGroup"/>
|
316
|
-
</element>
|
317
|
-
</define>
|
318
199
|
<define name="Content-Section">
|
319
200
|
<optional>
|
320
201
|
<attribute name="id">
|
@@ -360,33 +241,6 @@
|
|
360
241
|
</define>
|
361
242
|
</include>
|
362
243
|
<!-- end overrides -->
|
363
|
-
<define name="ISOProjectGroup">
|
364
|
-
<zeroOrMore>
|
365
|
-
<ref name="agency"/>
|
366
|
-
</zeroOrMore>
|
367
|
-
<oneOrMore>
|
368
|
-
<ref name="technical-committee"/>
|
369
|
-
</oneOrMore>
|
370
|
-
<zeroOrMore>
|
371
|
-
<ref name="subcommittee"/>
|
372
|
-
</zeroOrMore>
|
373
|
-
<zeroOrMore>
|
374
|
-
<ref name="workgroup"/>
|
375
|
-
</zeroOrMore>
|
376
|
-
<optional>
|
377
|
-
<ref name="secretariat"/>
|
378
|
-
</optional>
|
379
|
-
</define>
|
380
|
-
<define name="approvalgroup">
|
381
|
-
<element name="approvalgroup">
|
382
|
-
<ref name="ISOProjectGroup"/>
|
383
|
-
</element>
|
384
|
-
</define>
|
385
|
-
<define name="agency">
|
386
|
-
<element name="agency">
|
387
|
-
<text/>
|
388
|
-
</element>
|
389
|
-
</define>
|
390
244
|
<!--
|
391
245
|
We display the Normative References between scope and terms; but to keep the
|
392
246
|
grammar simple, we keep the references together
|
@@ -423,46 +277,6 @@
|
|
423
277
|
</zeroOrMore>
|
424
278
|
</element>
|
425
279
|
</define>
|
426
|
-
<define name="horizontal">
|
427
|
-
<element name="horizontal">
|
428
|
-
<data type="boolean"/>
|
429
|
-
</element>
|
430
|
-
</define>
|
431
|
-
<define name="documentnumber">
|
432
|
-
<element name="project-number">
|
433
|
-
<optional>
|
434
|
-
<attribute name="part">
|
435
|
-
<data type="int"/>
|
436
|
-
</attribute>
|
437
|
-
</optional>
|
438
|
-
<optional>
|
439
|
-
<attribute name="subpart">
|
440
|
-
<data type="int"/>
|
441
|
-
</attribute>
|
442
|
-
</optional>
|
443
|
-
<text/>
|
444
|
-
</element>
|
445
|
-
</define>
|
446
|
-
<define name="tc-documentnumber">
|
447
|
-
<element name="tc-document-number">
|
448
|
-
<data type="int"/>
|
449
|
-
</element>
|
450
|
-
</define>
|
451
|
-
<define name="subcommittee">
|
452
|
-
<element name="subcommittee">
|
453
|
-
<ref name="IsoWorkgroup"/>
|
454
|
-
</element>
|
455
|
-
</define>
|
456
|
-
<define name="workgroup">
|
457
|
-
<element name="workgroup">
|
458
|
-
<ref name="IsoWorkgroup"/>
|
459
|
-
</element>
|
460
|
-
</define>
|
461
|
-
<define name="secretariat">
|
462
|
-
<element name="secretariat">
|
463
|
-
<text/>
|
464
|
-
</element>
|
465
|
-
</define>
|
466
280
|
<define name="clause-hanging-paragraph-with-footnote">
|
467
281
|
<element name="clause">
|
468
282
|
<optional>
|
@@ -506,9 +320,4 @@
|
|
506
320
|
<ref name="Clause-Section"/>
|
507
321
|
</element>
|
508
322
|
</define>
|
509
|
-
<define name="stagename">
|
510
|
-
<element name="stagename">
|
511
|
-
<text/>
|
512
|
-
</element>
|
513
|
-
</define>
|
514
323
|
</grammar>
|
@@ -0,0 +1,225 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
|
+
<include href="biblio-standoc.rng">
|
4
|
+
<define name="BibDataExtensionType">
|
5
|
+
<optional>
|
6
|
+
<attribute name="schema-version"/>
|
7
|
+
</optional>
|
8
|
+
<ref name="doctype"/>
|
9
|
+
<optional>
|
10
|
+
<ref name="docsubtype"/>
|
11
|
+
</optional>
|
12
|
+
<optional>
|
13
|
+
<ref name="horizontal"/>
|
14
|
+
</optional>
|
15
|
+
<ref name="editorialgroup"/>
|
16
|
+
<optional>
|
17
|
+
<ref name="approvalgroup"/>
|
18
|
+
</optional>
|
19
|
+
<zeroOrMore>
|
20
|
+
<ref name="ics"/>
|
21
|
+
</zeroOrMore>
|
22
|
+
<ref name="structuredidentifier"/>
|
23
|
+
<optional>
|
24
|
+
<ref name="stagename"/>
|
25
|
+
</optional>
|
26
|
+
<optional>
|
27
|
+
<ref name="updates_document_type"/>
|
28
|
+
</optional>
|
29
|
+
</define>
|
30
|
+
<define name="bdate">
|
31
|
+
<element name="date">
|
32
|
+
<attribute name="type">
|
33
|
+
<choice>
|
34
|
+
<ref name="BibliographicDateType"/>
|
35
|
+
<text/>
|
36
|
+
</choice>
|
37
|
+
</attribute>
|
38
|
+
<choice>
|
39
|
+
<group>
|
40
|
+
<element name="from">
|
41
|
+
<ref name="ISO8601Date"/>
|
42
|
+
</element>
|
43
|
+
<optional>
|
44
|
+
<element name="to">
|
45
|
+
<ref name="ISO8601Date"/>
|
46
|
+
</element>
|
47
|
+
</optional>
|
48
|
+
</group>
|
49
|
+
<element name="on">
|
50
|
+
<choice>
|
51
|
+
<ref name="ISO8601Date"/>
|
52
|
+
<value>--</value>
|
53
|
+
<value>–</value>
|
54
|
+
</choice>
|
55
|
+
</element>
|
56
|
+
</choice>
|
57
|
+
</element>
|
58
|
+
</define>
|
59
|
+
<define name="organization">
|
60
|
+
<element name="organization">
|
61
|
+
<oneOrMore>
|
62
|
+
<ref name="orgname"/>
|
63
|
+
</oneOrMore>
|
64
|
+
<optional>
|
65
|
+
<ref name="abbreviation"/>
|
66
|
+
</optional>
|
67
|
+
<optional>
|
68
|
+
<ref name="uri"/>
|
69
|
+
</optional>
|
70
|
+
<zeroOrMore>
|
71
|
+
<ref name="org-identifier"/>
|
72
|
+
</zeroOrMore>
|
73
|
+
<zeroOrMore>
|
74
|
+
<ref name="contact"/>
|
75
|
+
</zeroOrMore>
|
76
|
+
<optional>
|
77
|
+
<ref name="technical-committee"/>
|
78
|
+
</optional>
|
79
|
+
<optional>
|
80
|
+
<ref name="subcommittee"/>
|
81
|
+
</optional>
|
82
|
+
<optional>
|
83
|
+
<ref name="workgroup"/>
|
84
|
+
</optional>
|
85
|
+
<optional>
|
86
|
+
<ref name="secretariat"/>
|
87
|
+
</optional>
|
88
|
+
</element>
|
89
|
+
</define>
|
90
|
+
<define name="DocumentType">
|
91
|
+
<choice>
|
92
|
+
<value>international-standard</value>
|
93
|
+
<value>technical-specification</value>
|
94
|
+
<value>technical-report</value>
|
95
|
+
<value>publicly-available-specification</value>
|
96
|
+
<value>international-workshop-agreement</value>
|
97
|
+
<value>guide</value>
|
98
|
+
<value>amendment</value>
|
99
|
+
<value>technical-corrigendum</value>
|
100
|
+
<value>directive</value>
|
101
|
+
</choice>
|
102
|
+
</define>
|
103
|
+
<define name="DocumentSubtype">
|
104
|
+
<choice>
|
105
|
+
<value>specification</value>
|
106
|
+
<value>method-of-test</value>
|
107
|
+
<value>vocabulary</value>
|
108
|
+
<value>code-of-practice</value>
|
109
|
+
</choice>
|
110
|
+
</define>
|
111
|
+
<define name="structuredidentifier">
|
112
|
+
<element name="structuredidentifier">
|
113
|
+
<optional>
|
114
|
+
<attribute name="type"/>
|
115
|
+
</optional>
|
116
|
+
<group>
|
117
|
+
<ref name="documentnumber"/>
|
118
|
+
<optional>
|
119
|
+
<ref name="tc-documentnumber"/>
|
120
|
+
</optional>
|
121
|
+
</group>
|
122
|
+
</element>
|
123
|
+
</define>
|
124
|
+
<define name="editorialgroup">
|
125
|
+
<element name="editorialgroup">
|
126
|
+
<ref name="ISOProjectGroup"/>
|
127
|
+
</element>
|
128
|
+
</define>
|
129
|
+
</include>
|
130
|
+
<define name="updates_document_type">
|
131
|
+
<element name="updates-document-type">
|
132
|
+
<ref name="DocumentType"/>
|
133
|
+
</element>
|
134
|
+
</define>
|
135
|
+
<define name="ISOProjectGroup">
|
136
|
+
<zeroOrMore>
|
137
|
+
<ref name="agency"/>
|
138
|
+
</zeroOrMore>
|
139
|
+
<oneOrMore>
|
140
|
+
<ref name="technical-committee"/>
|
141
|
+
</oneOrMore>
|
142
|
+
<zeroOrMore>
|
143
|
+
<ref name="subcommittee"/>
|
144
|
+
</zeroOrMore>
|
145
|
+
<zeroOrMore>
|
146
|
+
<ref name="workgroup"/>
|
147
|
+
</zeroOrMore>
|
148
|
+
<optional>
|
149
|
+
<ref name="secretariat"/>
|
150
|
+
</optional>
|
151
|
+
</define>
|
152
|
+
<define name="approvalgroup">
|
153
|
+
<element name="approvalgroup">
|
154
|
+
<ref name="ISOProjectGroup"/>
|
155
|
+
</element>
|
156
|
+
</define>
|
157
|
+
<define name="agency">
|
158
|
+
<element name="agency">
|
159
|
+
<text/>
|
160
|
+
</element>
|
161
|
+
</define>
|
162
|
+
<define name="horizontal">
|
163
|
+
<element name="horizontal">
|
164
|
+
<data type="boolean"/>
|
165
|
+
</element>
|
166
|
+
</define>
|
167
|
+
<define name="documentnumber">
|
168
|
+
<element name="project-number">
|
169
|
+
<optional>
|
170
|
+
<attribute name="part">
|
171
|
+
<data type="int"/>
|
172
|
+
</attribute>
|
173
|
+
</optional>
|
174
|
+
<optional>
|
175
|
+
<attribute name="subpart">
|
176
|
+
<data type="int"/>
|
177
|
+
</attribute>
|
178
|
+
</optional>
|
179
|
+
<optional>
|
180
|
+
<attribute name="amendment">
|
181
|
+
<data type="int"/>
|
182
|
+
</attribute>
|
183
|
+
</optional>
|
184
|
+
<optional>
|
185
|
+
<attribute name="corrigendum">
|
186
|
+
<data type="int"/>
|
187
|
+
</attribute>
|
188
|
+
</optional>
|
189
|
+
<optional>
|
190
|
+
<attribute name="origyr">
|
191
|
+
<ref name="ISO8601Date"/>
|
192
|
+
</attribute>
|
193
|
+
</optional>
|
194
|
+
<text/>
|
195
|
+
</element>
|
196
|
+
</define>
|
197
|
+
<define name="tc-documentnumber">
|
198
|
+
<element name="tc-document-number">
|
199
|
+
<data type="int"/>
|
200
|
+
</element>
|
201
|
+
</define>
|
202
|
+
<define name="subcommittee">
|
203
|
+
<element name="subcommittee">
|
204
|
+
<ref name="IsoWorkgroup"/>
|
205
|
+
</element>
|
206
|
+
</define>
|
207
|
+
<define name="workgroup">
|
208
|
+
<element name="workgroup">
|
209
|
+
<ref name="IsoWorkgroup"/>
|
210
|
+
</element>
|
211
|
+
</define>
|
212
|
+
<define name="secretariat">
|
213
|
+
<element name="secretariat">
|
214
|
+
<text/>
|
215
|
+
</element>
|
216
|
+
</define>
|
217
|
+
<define name="stagename">
|
218
|
+
<element name="stagename">
|
219
|
+
<optional>
|
220
|
+
<attribute name="abbreviation"/>
|
221
|
+
</optional>
|
222
|
+
<text/>
|
223
|
+
</element>
|
224
|
+
</define>
|
225
|
+
</grammar>
|
@@ -27,7 +27,7 @@ module Metanorma
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
# ISO/IEC DIR 2, 15.5.3
|
30
|
+
# ISO/IEC DIR 2, 15.5.3, 20.2
|
31
31
|
# does not deal with preceding text marked up
|
32
32
|
def see_xrefs_validate(root)
|
33
33
|
root.xpath("//xref").each do |t|
|
@@ -66,7 +66,7 @@ module Metanorma
|
|
66
66
|
if /^(ISO|IEC)/.match?(t["citeas"]) &&
|
67
67
|
!/: ?(\d+{4}|–)$/.match?(t["citeas"])
|
68
68
|
@log.add("Style", t,
|
69
|
-
"undated reference #{t['citeas']} should not contain "\
|
69
|
+
"undated reference #{t['citeas']} should not contain " \
|
70
70
|
"specific elements")
|
71
71
|
end
|
72
72
|
end
|
@@ -79,7 +79,7 @@ module Metanorma
|
|
79
79
|
# https://www.iso.org/ISO-house-style.html#iso-hs-s-text-r-r-ref_clause3
|
80
80
|
def term_xrefs_validate(xmldoc)
|
81
81
|
termids = xmldoc
|
82
|
-
.xpath("//sections/terms | //sections/clause[.//terms] | "\
|
82
|
+
.xpath("//sections/terms | //sections/clause[.//terms] | " \
|
83
83
|
"//annex[.//terms]").each_with_object({}) do |t, m|
|
84
84
|
t.xpath(".//*/@id").each { |a| m[a.text] = true }
|
85
85
|
t.name == "terms" and m[t["id"]] = true
|
@@ -93,11 +93,11 @@ module Metanorma
|
|
93
93
|
closest_id = xref.xpath("./ancestor::*[@id]")&.last or return
|
94
94
|
(termids[xref["target"]] && !termids[closest_id["id"]]) and
|
95
95
|
@log.add("Style", xref,
|
96
|
-
"only terms clauses can cross-reference terms clause "\
|
96
|
+
"only terms clauses can cross-reference terms clause " \
|
97
97
|
"(#{xref['target']})")
|
98
98
|
(!termids[xref["target"]] && termids[closest_id["id"]]) and
|
99
99
|
@log.add("Style", xref,
|
100
|
-
"non-terms clauses cannot cross-reference terms clause "\
|
100
|
+
"non-terms clauses cannot cross-reference terms clause " \
|
101
101
|
"(#{xref['target']})")
|
102
102
|
end
|
103
103
|
|
@@ -179,7 +179,7 @@ module Metanorma
|
|
179
179
|
xmldoc.xpath("//bibitem[date/on = '–']").each do |b|
|
180
180
|
b.at("./note[@type = 'Unpublished-Status']") or
|
181
181
|
@log.add("Style", b,
|
182
|
-
"Reference #{b&.at('./@id')&.text} does not have an "\
|
182
|
+
"Reference #{b&.at('./@id')&.text} does not have an " \
|
183
183
|
"associated footnote indicating unpublished status")
|
184
184
|
end
|
185
185
|
end
|
@@ -191,7 +191,7 @@ module Metanorma
|
|
191
191
|
when "amendment", "technical-corrigendum" # @amd
|
192
192
|
"isostandard-amd.rng"
|
193
193
|
else
|
194
|
-
"isostandard.rng"
|
194
|
+
"isostandard-compile.rng"
|
195
195
|
end
|
196
196
|
schema_validate(formattedstr_strip(doc.dup),
|
197
197
|
File.join(File.dirname(__FILE__), schema))
|
@@ -18,9 +18,9 @@ module Metanorma
|
|
18
18
|
return lbl unless title &&
|
19
19
|
elem.ancestors("requirement, recommendation, permission").empty?
|
20
20
|
|
21
|
-
lbl +=
|
21
|
+
lbl += ": " if lbl
|
22
22
|
lbl += title.children.to_xml
|
23
|
-
lbl
|
23
|
+
l10n(lbl)
|
24
24
|
end
|
25
25
|
|
26
26
|
# ISO labels modspec reqt as table, with reqt label as title
|
@@ -29,46 +29,36 @@ module Metanorma
|
|
29
29
|
out
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
33
|
-
|
34
|
-
out.add_child("<tr><td>#{@labels['modspec']['identifier']}</td>"\
|
35
|
-
"<td><tt>#{label.children.to_xml}</tt></td>")
|
36
|
-
end
|
37
|
-
|
38
|
-
def requirement_component_parse(node, out)
|
39
|
-
if node["exclude"] != "true" && node.name == "description"
|
40
|
-
lbl = "statement"
|
41
|
-
lbl = "description" if recommend_class(node.parent) == "recommendclass"
|
42
|
-
out << "<tr><td>#{@labels['modspec'][lbl]}</td>"\
|
43
|
-
"<td>#{node.children.to_xml}</td></tr>"
|
44
|
-
else
|
45
|
-
super
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def requirement_table_cleanup(table)
|
50
|
-
return table unless table["type"] == "recommendclass"
|
51
|
-
|
32
|
+
def requirement_table_nested_cleanup(node, table)
|
33
|
+
table["type"] == "recommendclass" or return table
|
52
34
|
ins = table.at(ns("./tbody/tr[td/table]")) or return table
|
53
|
-
ins.replace(
|
54
|
-
"<td>#{nested_tables_names(table)}</td></tr>")
|
35
|
+
ins.replace(requirement_table_cleanup_nested_replacement(node, table))
|
55
36
|
table.xpath(ns("./tbody/tr[td/table]")).each(&:remove)
|
56
37
|
table
|
57
38
|
end
|
58
39
|
|
40
|
+
def requirement_table_cleanup_nested_replacement(node, table)
|
41
|
+
label = "provision"
|
42
|
+
node["type"] == "conformanceclass" and label = "conformancetest"
|
43
|
+
n = nested_tables_names(table)
|
44
|
+
hdr = @i18n.inflect(@labels["modspec"][label],
|
45
|
+
number: n.size == 1 ? "sg" : "pl")
|
46
|
+
"<tr><th>#{hdr}</th><td>#{n.join('<br/>')}</td></tr>"
|
47
|
+
end
|
48
|
+
|
59
49
|
def nested_tables_names(table)
|
60
50
|
table.xpath(ns("./tbody/tr/td/table"))
|
61
51
|
.each_with_object([]) do |t, m|
|
62
52
|
m << t.at(ns("./name")).children.to_xml
|
63
|
-
end
|
53
|
+
end
|
64
54
|
end
|
65
55
|
|
66
56
|
def postprocess_anchor_struct(block, anchor)
|
67
57
|
super
|
68
58
|
anchor[:xref_reqt2reqt] = anchor[:xref_bare]
|
69
59
|
if l = block.at(ns("./title"))
|
70
|
-
anchor[:xref_reqt2reqt]
|
71
|
-
l10n(":
|
60
|
+
anchor[:xref_reqt2reqt] =
|
61
|
+
l10n("#{anchor[:xref_reqt2reqt]}: #{l.children.to_xml.strip}")
|
72
62
|
end
|
73
63
|
anchor
|
74
64
|
end
|
@@ -83,20 +73,17 @@ module Metanorma
|
|
83
73
|
end
|
84
74
|
end
|
85
75
|
|
86
|
-
def
|
87
|
-
|
88
|
-
|
89
|
-
next unless %w(conformanceclass
|
90
|
-
verification).include?(r["type"])
|
76
|
+
def reqt_links_test1(reqt, acc)
|
77
|
+
return unless %w(conformanceclass
|
78
|
+
verification).include?(reqt["type"])
|
91
79
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
80
|
+
subj = reqt_extract_target(reqt)
|
81
|
+
id = reqt.at(ns("./identifier")) or return
|
82
|
+
lbl = @xrefs.anchor(@reqt_ids[id.text.strip][:id], :xref_reqt2reqt,
|
83
|
+
false)
|
84
|
+
return unless subj
|
97
85
|
|
98
|
-
|
99
|
-
end
|
86
|
+
acc[subj.text] = { lbl: lbl, id: reqt["id"] }
|
100
87
|
end
|
101
88
|
|
102
89
|
def reqt_links_class(docxml)
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -118,7 +118,7 @@ RSpec.describe IsoDoc do
|
|
118
118
|
|
119
119
|
it "processes AsciiMath and MathML" do
|
120
120
|
output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
|
121
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
121
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" xmlns:m="http://www.w3.org/1998/Math/MathML">
|
122
122
|
<preface>
|
123
123
|
<foreword>
|
124
124
|
<p>
|
data/spec/metanorma/base_spec.rb
CHANGED
@@ -1005,7 +1005,7 @@ RSpec.describe Metanorma::ISO do
|
|
1005
1005
|
<uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
|
1006
1006
|
<uri type='rss'>https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
|
1007
1007
|
<docidentifier type='ISO' primary="true">ISO 123:2001</docidentifier>
|
1008
|
-
<docidentifier type='URN'>urn:iso:std:iso:123:
|
1008
|
+
<docidentifier type='URN'>urn:iso:std:iso:123:ed-3</docidentifier>
|
1009
1009
|
<docnumber>123</docnumber>
|
1010
1010
|
<date type='published'><on>2001-05</on></date>
|
1011
1011
|
<contributor>
|
@@ -1078,7 +1078,7 @@ RSpec.describe Metanorma::ISO do
|
|
1078
1078
|
<uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:72849:en</uri>
|
1079
1079
|
<uri type='rss'>https://www.iso.org/contents/data/standard/07/28/72849.detail.rss</uri>
|
1080
1080
|
<docidentifier type='ISO' primary="true">ISO 125</docidentifier>
|
1081
|
-
<docidentifier type='URN'>urn:iso:std:iso:125:
|
1081
|
+
<docidentifier type='URN'>urn:iso:std:iso:125:ed-7</docidentifier>
|
1082
1082
|
<docnumber>125</docnumber>
|
1083
1083
|
<contributor>
|
1084
1084
|
<role type='publisher'/>
|
@@ -1130,7 +1130,7 @@ RSpec.describe Metanorma::ISO do
|
|
1130
1130
|
<uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:72849:en</uri>
|
1131
1131
|
<uri type='rss'>https://www.iso.org/contents/data/standard/07/28/72849.detail.rss</uri>
|
1132
1132
|
<docidentifier type='ISO' primary="true">ISO 125:2020</docidentifier>
|
1133
|
-
<docidentifier type='URN'>urn:iso:std:iso:125:
|
1133
|
+
<docidentifier type='URN'>urn:iso:std:iso:125:ed-7</docidentifier>
|
1134
1134
|
<docnumber>125</docnumber>
|
1135
1135
|
<date type='published'>
|
1136
1136
|
<on>2020-02</on>
|