metanorma-iso 1.8.3 → 1.9.0
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/.github/workflows/rake.yml +3 -13
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -6
- data/lib/asciidoctor/iso/cleanup.rb +0 -1
- data/lib/asciidoctor/iso/isodoc.rng +65 -7
- data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
- data/lib/asciidoctor/iso/isostandard.rng +18 -3
- data/lib/asciidoctor/iso/section.rb +3 -0
- data/lib/asciidoctor/iso/validate.rb +4 -17
- data/lib/asciidoctor/iso/validate_section.rb +50 -34
- data/lib/asciidoctor/iso/validate_style.rb +3 -3
- data/lib/isodoc/iso/base_convert.rb +41 -16
- data/lib/isodoc/iso/html/isodoc.css +475 -20
- data/lib/isodoc/iso/html/isodoc.scss +456 -23
- data/lib/isodoc/iso/html/wordstyle.css +202 -31
- data/lib/isodoc/iso/html/wordstyle.scss +194 -32
- data/lib/isodoc/iso/iso.amendment.xsl +524 -400
- data/lib/isodoc/iso/iso.international-standard.xsl +524 -400
- data/lib/isodoc/iso/isosts_convert.rb +12 -13
- data/lib/isodoc/iso/metadata.rb +2 -2
- data/lib/isodoc/iso/presentation_xml_convert.rb +62 -9
- data/lib/isodoc/iso/sts_convert.rb +4 -5
- data/lib/isodoc/iso/word_convert.rb +153 -39
- data/lib/isodoc/iso/xref.rb +27 -10
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -4
- data/spec/asciidoctor/section_spec.rb +128 -7
- data/spec/asciidoctor/validate_spec.rb +15 -15
- data/spec/isodoc/amd_spec.rb +193 -201
- data/spec/isodoc/blocks_spec.rb +100 -88
- data/spec/isodoc/i18n_spec.rb +36 -36
- data/spec/isodoc/inline_spec.rb +472 -2
- data/spec/isodoc/iso_spec.rb +86 -138
- data/spec/isodoc/postproc_spec.rb +19 -10
- data/spec/isodoc/ref_spec.rb +6 -6
- data/spec/isodoc/section_spec.rb +394 -276
- data/spec/isodoc/table_spec.rb +166 -231
- data/spec/isodoc/terms_spec.rb +11 -8
- data/spec/isodoc/xref_spec.rb +147 -118
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fc50a5631e4815038d720b3f8b01551c824df300760d7d5c01e0fa57adf37a0
|
4
|
+
data.tar.gz: 7f2b4cad47277b4b1b0ab49d12f873e9a008b511fbd5db2a3925b96c9f504875
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfb9d4ca6d29cdd964118d3d7810cd71acfbe4b6d9c5c1edb3b14bfbadddbc004e73755e5495ebf91fa51670a373dc02d6b37ea4e1bac8df5d097bb3214adb44
|
7
|
+
data.tar.gz: 28b0407e858ff7ea5b8a7911b9c7bf2b82c7a9d45e9035029bd510a78a7e16016175fdfa03dbf04599d4254e2eabce2178f36b671141e833587f02d3298b008a
|
data/.github/workflows/rake.yml
CHANGED
@@ -4,7 +4,7 @@ name: rake
|
|
4
4
|
|
5
5
|
on:
|
6
6
|
push:
|
7
|
-
branches: [ master, main
|
7
|
+
branches: [ master, main ]
|
8
8
|
tags: [ v* ]
|
9
9
|
pull_request:
|
10
10
|
|
@@ -16,19 +16,9 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [ '
|
19
|
+
ruby: [ '3.0', '2.7', '2.6', '2.5' ]
|
20
20
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
21
|
experimental: [ false ]
|
22
|
-
include:
|
23
|
-
- ruby: '3.0'
|
24
|
-
os: 'ubuntu-latest'
|
25
|
-
experimental: true
|
26
|
-
- ruby: '3.0'
|
27
|
-
os: 'windows-latest'
|
28
|
-
experimental: true
|
29
|
-
- ruby: '3.0'
|
30
|
-
os: 'macos-latest'
|
31
|
-
experimental: true
|
32
22
|
steps:
|
33
23
|
- uses: actions/checkout@master
|
34
24
|
|
@@ -49,5 +39,5 @@ jobs:
|
|
49
39
|
with:
|
50
40
|
token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
|
51
41
|
repository: ${{ github.repository }}
|
52
|
-
event-type:
|
42
|
+
event-type: tests-passed
|
53
43
|
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
|
data/.hound.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
#
|
2
|
-
# https://github.com/
|
3
|
-
# All project-specific additions and overrides should be specified in this file.
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
4
3
|
inherit_from:
|
5
4
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
6
5
|
|
7
6
|
# local repo-specific modifications
|
7
|
+
# ...
|
8
8
|
|
9
9
|
AllCops:
|
10
|
-
|
11
|
-
StyleGuideCopsOnly: false
|
12
|
-
TargetRubyVersion: 2.4
|
10
|
+
TargetRubyVersion: 2.5
|
@@ -45,6 +45,11 @@
|
|
45
45
|
<optional>
|
46
46
|
<attribute name="alt"/>
|
47
47
|
</optional>
|
48
|
+
<optional>
|
49
|
+
<attribute name="updatetype">
|
50
|
+
<data type="boolean"/>
|
51
|
+
</attribute>
|
52
|
+
</optional>
|
48
53
|
<text/>
|
49
54
|
</element>
|
50
55
|
</define>
|
@@ -199,6 +204,18 @@
|
|
199
204
|
</zeroOrMore>
|
200
205
|
</element>
|
201
206
|
</define>
|
207
|
+
<define name="dt">
|
208
|
+
<element name="dt">
|
209
|
+
<optional>
|
210
|
+
<attribute name="id">
|
211
|
+
<data type="ID"/>
|
212
|
+
</attribute>
|
213
|
+
</optional>
|
214
|
+
<zeroOrMore>
|
215
|
+
<ref name="TextElement"/>
|
216
|
+
</zeroOrMore>
|
217
|
+
</element>
|
218
|
+
</define>
|
202
219
|
<define name="example">
|
203
220
|
<element name="example">
|
204
221
|
<attribute name="id">
|
@@ -543,6 +560,9 @@
|
|
543
560
|
</define>
|
544
561
|
<define name="BibDataExtensionType">
|
545
562
|
<ref name="doctype"/>
|
563
|
+
<optional>
|
564
|
+
<ref name="docsubtype"/>
|
565
|
+
</optional>
|
546
566
|
<optional>
|
547
567
|
<ref name="editorialgroup"/>
|
548
568
|
</optional>
|
@@ -890,6 +910,14 @@
|
|
890
910
|
</define>
|
891
911
|
</include>
|
892
912
|
<!-- end overrides -->
|
913
|
+
<define name="docsubtype">
|
914
|
+
<element name="subdoctype">
|
915
|
+
<ref name="DocumentSubtype"/>
|
916
|
+
</element>
|
917
|
+
</define>
|
918
|
+
<define name="DocumentSubtype">
|
919
|
+
<text/>
|
920
|
+
</define>
|
893
921
|
<define name="colgroup">
|
894
922
|
<element name="colgroup">
|
895
923
|
<oneOrMore>
|
@@ -939,7 +967,34 @@
|
|
939
967
|
<define name="concept">
|
940
968
|
<element name="concept">
|
941
969
|
<optional>
|
942
|
-
<attribute name="
|
970
|
+
<attribute name="ital">
|
971
|
+
<data type="boolean"/>
|
972
|
+
</attribute>
|
973
|
+
</optional>
|
974
|
+
<optional>
|
975
|
+
<attribute name="ref">
|
976
|
+
<data type="boolean"/>
|
977
|
+
</attribute>
|
978
|
+
</optional>
|
979
|
+
<optional>
|
980
|
+
<element name="refterm">
|
981
|
+
<zeroOrMore>
|
982
|
+
<choice>
|
983
|
+
<ref name="PureTextElement"/>
|
984
|
+
<ref name="stem"/>
|
985
|
+
</choice>
|
986
|
+
</zeroOrMore>
|
987
|
+
</element>
|
988
|
+
</optional>
|
989
|
+
<optional>
|
990
|
+
<element name="renderterm">
|
991
|
+
<zeroOrMore>
|
992
|
+
<choice>
|
993
|
+
<ref name="PureTextElement"/>
|
994
|
+
<ref name="stem"/>
|
995
|
+
</choice>
|
996
|
+
</zeroOrMore>
|
997
|
+
</element>
|
943
998
|
</optional>
|
944
999
|
<choice>
|
945
1000
|
<ref name="eref"/>
|
@@ -965,6 +1020,9 @@
|
|
965
1020
|
</attribute>
|
966
1021
|
<attribute name="name"/>
|
967
1022
|
<attribute name="action"/>
|
1023
|
+
<optional>
|
1024
|
+
<attribute name="class"/>
|
1025
|
+
</optional>
|
968
1026
|
<zeroOrMore>
|
969
1027
|
<choice>
|
970
1028
|
<ref name="TextElement"/>
|
@@ -1457,26 +1515,26 @@
|
|
1457
1515
|
<optional>
|
1458
1516
|
<ref name="section-title"/>
|
1459
1517
|
</optional>
|
1460
|
-
<
|
1518
|
+
<choice>
|
1461
1519
|
<choice>
|
1462
1520
|
<group>
|
1463
|
-
<
|
1521
|
+
<oneOrMore>
|
1464
1522
|
<ref name="BasicBlock"/>
|
1465
|
-
</
|
1523
|
+
</oneOrMore>
|
1466
1524
|
<zeroOrMore>
|
1467
1525
|
<ref name="note"/>
|
1468
1526
|
</zeroOrMore>
|
1469
1527
|
</group>
|
1470
1528
|
<ref name="amend"/>
|
1471
1529
|
</choice>
|
1472
|
-
<
|
1530
|
+
<oneOrMore>
|
1473
1531
|
<choice>
|
1474
1532
|
<ref name="clause-subsection"/>
|
1475
1533
|
<ref name="terms"/>
|
1476
1534
|
<ref name="definitions"/>
|
1477
1535
|
</choice>
|
1478
|
-
</
|
1479
|
-
</
|
1536
|
+
</oneOrMore>
|
1537
|
+
</choice>
|
1480
1538
|
</define>
|
1481
1539
|
<define name="Annex-Section">
|
1482
1540
|
<optional>
|
@@ -38,6 +38,9 @@
|
|
38
38
|
</define>
|
39
39
|
<define name="BibDataExtensionType">
|
40
40
|
<ref name="doctype"/>
|
41
|
+
<optional>
|
42
|
+
<ref name="docsubtype"/>
|
43
|
+
</optional>
|
41
44
|
<optional>
|
42
45
|
<ref name="horizontal"/>
|
43
46
|
</optional>
|
@@ -98,7 +101,11 @@
|
|
98
101
|
<ref name="definitions"/>
|
99
102
|
</optional>
|
100
103
|
<oneOrMore>
|
101
|
-
<
|
104
|
+
<choice>
|
105
|
+
<ref name="clause"/>
|
106
|
+
<ref name="term-clause"/>
|
107
|
+
<ref name="terms"/>
|
108
|
+
</choice>
|
102
109
|
</oneOrMore>
|
103
110
|
</element>
|
104
111
|
</define>
|
@@ -133,7 +140,7 @@
|
|
133
140
|
<optional>
|
134
141
|
<ref name="section-title"/>
|
135
142
|
</optional>
|
136
|
-
<
|
143
|
+
<choice>
|
137
144
|
<choice>
|
138
145
|
<group>
|
139
146
|
<oneOrMore>
|
@@ -148,7 +155,7 @@
|
|
148
155
|
<oneOrMore>
|
149
156
|
<ref name="clause-subsection"/>
|
150
157
|
</oneOrMore>
|
151
|
-
</
|
158
|
+
</choice>
|
152
159
|
</define>
|
153
160
|
<define name="term">
|
154
161
|
<element name="term">
|
@@ -259,6 +266,14 @@
|
|
259
266
|
<value>directive</value>
|
260
267
|
</choice>
|
261
268
|
</define>
|
269
|
+
<define name="DocumentSubtype">
|
270
|
+
<choice>
|
271
|
+
<value>specification</value>
|
272
|
+
<value>method-of-test</value>
|
273
|
+
<value>vocabulary</value>
|
274
|
+
<value>code-of-practice</value>
|
275
|
+
</choice>
|
276
|
+
</define>
|
262
277
|
<define name="structuredidentifier">
|
263
278
|
<element name="structuredidentifier">
|
264
279
|
<optional>
|
@@ -32,7 +32,7 @@ module Asciidoctor
|
|
32
32
|
root.xpath("//xref").each do |t|
|
33
33
|
preceding = t.at("./preceding-sibling::text()[last()]")
|
34
34
|
next unless !preceding.nil? &&
|
35
|
-
/\b(see| refer to)\s
|
35
|
+
/\b(see| refer to)\s*\Z/mi.match(preceding)
|
36
36
|
|
37
37
|
(target = root.at("//*[@id = '#{t['target']}']")) || next
|
38
38
|
if target&.at("./ancestor-or-self::*[@obligation = 'normative']")
|
@@ -46,7 +46,7 @@ module Asciidoctor
|
|
46
46
|
def see_erefs_validate(root)
|
47
47
|
root.xpath("//eref").each do |t|
|
48
48
|
prec = t.at("./preceding-sibling::text()[last()]")
|
49
|
-
next unless !prec.nil? && /\b(see|refer to)\s
|
49
|
+
next unless !prec.nil? && /\b(see|refer to)\s*\Z/mi.match(prec)
|
50
50
|
|
51
51
|
unless target = root.at("//*[@id = '#{t['bibitemid']}']")
|
52
52
|
@log.add("Bibliography", t,
|
@@ -80,23 +80,11 @@ module Asciidoctor
|
|
80
80
|
xmldoc.xpath("//term").each do |t|
|
81
81
|
para = t.at("./definition") || return
|
82
82
|
term = t.at("./preferred").text
|
83
|
-
termdef_warn(para.text,
|
83
|
+
termdef_warn(para.text, /\A(the|a)\b/i, t, term,
|
84
84
|
"term definition starts with article")
|
85
|
-
termdef_warn(para.text,
|
85
|
+
termdef_warn(para.text, /\.\Z/i, t, term,
|
86
86
|
"term definition ends with period")
|
87
87
|
end
|
88
|
-
cited_term_style(xmldoc)
|
89
|
-
end
|
90
|
-
|
91
|
-
# ISO/IEC DIR 2, 16.5.10
|
92
|
-
def cited_term_style(xmldoc)
|
93
|
-
xmldoc.xpath("//term//xref").each do |x|
|
94
|
-
next unless xmldoc.at("//term[@id = '#{x['target']}']")
|
95
|
-
|
96
|
-
x&.previous&.text == " (" and x&.previous&.previous&.name == "em" or
|
97
|
-
style_warning(x, "term citation not preceded with italicised term",
|
98
|
-
x.parent.text)
|
99
|
-
end
|
100
88
|
end
|
101
89
|
|
102
90
|
def doctype_validate(xmldoc)
|
@@ -150,7 +138,6 @@ module Asciidoctor
|
|
150
138
|
isosubgroup_validate(doc.root)
|
151
139
|
onlychild_clause_validate(doc.root)
|
152
140
|
termdef_style(doc.root)
|
153
|
-
iev_validate(doc.root)
|
154
141
|
see_xrefs_validate(doc.root)
|
155
142
|
see_erefs_validate(doc.root)
|
156
143
|
locality_erefs_validate(doc.root)
|
@@ -42,7 +42,7 @@ module Asciidoctor
|
|
42
42
|
f.empty? && return
|
43
43
|
(f.size == 1) || @log.add("Style", f.first, ONE_SYMBOLS_WARNING)
|
44
44
|
f.first.elements.each do |e|
|
45
|
-
unless e.name
|
45
|
+
unless %w(title dl).include? e.name
|
46
46
|
@log.add("Style", f.first, NON_DL_SYMBOLS_WARNING)
|
47
47
|
return
|
48
48
|
end
|
@@ -99,57 +99,73 @@ module Asciidoctor
|
|
99
99
|
"//clause[descendant::references][not(parent::clause)]".freeze
|
100
100
|
|
101
101
|
def sections_sequence_validate(root)
|
102
|
-
|
102
|
+
names, n = sections_sequence_validate_start(root)
|
103
|
+
if root&.at("//bibdata/ext/subdoctype")&.text == "vocabulary"
|
104
|
+
names, n = sections_sequence_validate_body_vocab(names, n)
|
105
|
+
else
|
106
|
+
names, n = sections_sequence_validate_body(names, n)
|
107
|
+
end
|
108
|
+
sections_sequence_validate_end(names, n)
|
109
|
+
end
|
110
|
+
|
111
|
+
def sections_sequence_validate_start(root)
|
103
112
|
names = root.xpath(SECTIONS_XPATH)
|
104
113
|
names = seqcheck(names, SEQ[0][:msg], SEQ[0][:val])
|
105
114
|
n = names[0]
|
106
115
|
names = seqcheck(names, SEQ[1][:msg], SEQ[1][:val])
|
107
|
-
|
116
|
+
n&.at("./self::introduction") and
|
108
117
|
names = seqcheck(names, SEQ[2][:msg], SEQ[2][:val])
|
109
|
-
end
|
110
118
|
names = seqcheck(names, SEQ[3][:msg], SEQ[3][:val])
|
111
119
|
n = names.shift
|
112
|
-
if n&.at("./self::definitions")
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
120
|
+
n = names.shift if n&.at("./self::definitions")
|
121
|
+
[names, n]
|
122
|
+
end
|
123
|
+
|
124
|
+
def sections_sequence_validate_body(names, elem)
|
125
|
+
if elem.nil? || elem.name != "clause"
|
126
|
+
@log.add("Style", elem, "Document must contain at least one clause")
|
117
127
|
end
|
118
|
-
|
119
|
-
@log.add("Style",
|
128
|
+
elem&.at("./self::clause") ||
|
129
|
+
@log.add("Style", elem, "Document must contain clause after "\
|
120
130
|
"Terms and Definitions")
|
121
|
-
|
122
|
-
@log.add("Style",
|
123
|
-
|
124
|
-
while
|
125
|
-
|
126
|
-
@log.add("Style",
|
127
|
-
|
131
|
+
elem&.at("./self::clause[@type = 'scope']") &&
|
132
|
+
@log.add("Style", elem, "Scope must occur before Terms and Definitions")
|
133
|
+
elem = names.shift
|
134
|
+
while elem&.name == "clause"
|
135
|
+
elem&.at("./self::clause[@type = 'scope']")
|
136
|
+
@log.add("Style", elem, "Scope must occur before Terms and Definitions")
|
137
|
+
elem = names.shift
|
128
138
|
end
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
139
|
+
%w(annex references).include? elem&.name or
|
140
|
+
@log.add("Style", elem, "Only annexes and references can follow clauses")
|
141
|
+
[names, elem]
|
142
|
+
end
|
143
|
+
|
144
|
+
def sections_sequence_validate_body_vocab(names, elem)
|
145
|
+
while elem && %w(clause terms).include?(elem.name)
|
146
|
+
elem = names.shift
|
137
147
|
end
|
138
|
-
|
139
|
-
|
140
|
-
|
148
|
+
%w(annex references).include? elem&.name or
|
149
|
+
@log.add("Style", elem, "Only annexes and references can follow terms and clauses")
|
150
|
+
[names, elem]
|
151
|
+
end
|
152
|
+
|
153
|
+
def sections_sequence_validate_end(names, elem)
|
154
|
+
while elem&.name == "annex"
|
155
|
+
elem = names.shift
|
156
|
+
if elem.nil?
|
141
157
|
@log.add("Style", nil, "Document must include (references) "\
|
142
158
|
"Normative References")
|
143
159
|
end
|
144
160
|
end
|
145
|
-
|
161
|
+
elem&.at("./self::references[@normative = 'true']") ||
|
146
162
|
@log.add("Style", nil, "Document must include (references) "\
|
147
163
|
"Normative References")
|
148
|
-
|
149
|
-
|
150
|
-
@log.add("Style",
|
164
|
+
elem = names&.shift
|
165
|
+
elem&.at("./self::references[@normative = 'false']") ||
|
166
|
+
@log.add("Style", elem, "Final section must be (references) Bibliography")
|
151
167
|
names.empty? ||
|
152
|
-
@log.add("Style",
|
168
|
+
@log.add("Style", elem, "There are sections after the final Bibliography")
|
153
169
|
end
|
154
170
|
|
155
171
|
def style_warning(node, msg, text = nil)
|