metanorma-iec 1.3.4 → 1.3.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.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/.rubocop.yml +1 -1
- data/lib/asciidoctor/iec/front.rb +64 -46
- data/lib/asciidoctor/iec/isodoc.rng +62 -8
- data/lib/asciidoctor/iec/isostandard.rng +7 -3
- data/lib/isodoc/iec/base_convert.rb +20 -14
- data/lib/isodoc/iec/html_convert.rb +6 -6
- data/lib/isodoc/iec/iec.international-standard.xsl +576 -66
- data/lib/isodoc/iec/metadata.rb +1 -1
- data/lib/isodoc/iec/pdf_convert.rb +1 -1
- data/lib/isodoc/iec/presentation_xml_convert.rb +17 -17
- data/lib/isodoc/iec/word_convert.rb +69 -19
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +2 -2
- data/spec/asciidoctor/blocks_spec.rb +3 -5
- data/spec/isodoc/blocks_spec.rb +2 -2
- data/spec/isodoc/i18n_spec.rb +346 -432
- data/spec/isodoc/iev_spec.rb +508 -519
- data/spec/isodoc/inline_spec.rb +2 -2
- data/spec/isodoc/postproc_spec.rb +221 -192
- data/spec/isodoc/ref_spec.rb +6 -6
- data/spec/isodoc/section_spec.rb +334 -339
- data/spec/isodoc/terms_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a58308f35d7e4b796b1366d05f48f1d3227e343f52f08a9a756da7567259cb7f
|
4
|
+
data.tar.gz: 4e5c5fb98a4178e2d03f6ea74e2b14c5cfd93bf8648496f8c6ad559d6d4b2bfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7798dd9aa810e75f931a7bbf408a216107a461d00709c6072b159479a5b7f82eab70bd06d6502e773c1ceb5887f845b29fd70e484c75375ff2526603c1917c0
|
7
|
+
data.tar.gz: fb83d221f49cb8ac9b20832dd1bdffa4f7e6d0cd00affde41b18fc99f247e5db46ff0ee3adc8ec3c0d3164060165d916c09afd77fd28802e212385c4f20c270c
|
data/.github/workflows/rake.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -6,7 +6,9 @@ module Asciidoctor
|
|
6
6
|
csv_split(publishers)&.each do |p|
|
7
7
|
xml.contributor do |c|
|
8
8
|
c.role **{ type: "author" }
|
9
|
-
c.organization
|
9
|
+
c.organization do |a|
|
10
|
+
organization(a, p, false, node, !node.attr("publisher"))
|
11
|
+
end
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
@@ -16,7 +18,9 @@ module Asciidoctor
|
|
16
18
|
csv_split(publishers)&.each do |p|
|
17
19
|
xml.contributor do |c|
|
18
20
|
c.role **{ type: "publisher" }
|
19
|
-
c.organization
|
21
|
+
c.organization do |a|
|
22
|
+
organization(a, p, true, node, !node.attr("publisher"))
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
@@ -47,24 +51,29 @@ module Asciidoctor
|
|
47
51
|
xml.docidentifier dn, **attr_code(type: "ISO")
|
48
52
|
end
|
49
53
|
|
50
|
-
def id_edition_suffix(
|
54
|
+
def id_edition_suffix(docnum, node)
|
51
55
|
ed = node.attr("edition") || 1
|
52
|
-
|
53
|
-
|
56
|
+
docnum += " ED #{ed}"
|
57
|
+
docnum
|
54
58
|
end
|
55
59
|
|
56
60
|
STAGE_CODES = {
|
57
|
-
"PNW" => "1000", "ANW" => "2000", "CAN" => "2098", "ACD" => "2099",
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"
|
63
|
-
"
|
64
|
-
"
|
65
|
-
"
|
66
|
-
"
|
67
|
-
"
|
61
|
+
"PNW" => "1000", "ANW" => "2000", "CAN" => "2098", "ACD" => "2099",
|
62
|
+
"CD" => "3020", "BWG" => "3092", "A2CD" => "3099", "2CD" => "3520",
|
63
|
+
"3CD" => "3520", "4CD" => "3520", "5CD" => "3520", "6CD" => "3520",
|
64
|
+
"7CD" => "3520", "8CD" => "3520", "9CD" => "3520", "CDM" => "3591",
|
65
|
+
"A3CD" => "3592", "A4CD" => "3592", "A5CD" => "3592", "A6CD" => "3592",
|
66
|
+
"A7CD" => "3592", "A8CD" => "3592", "A9CD" => "3592", "ACDV" => "3599",
|
67
|
+
"CCDV" => "4020", "CDVM" => "4091", "NCDV" => "4092",
|
68
|
+
"NADIS" => "4093", "ADIS" => "4099", "ADTR" => "4099",
|
69
|
+
"ADTS" => "4099", "RDISH" => "5000", "RFDIS" => "5000",
|
70
|
+
"CDISH" => "5020", "CDPAS" => "5020", "CDTR" => "5020",
|
71
|
+
"CDTS" => "5020", "CFDIS" => "5020", "DTRM" => "5092",
|
72
|
+
"DTSM" => "5092", "NDTR" => "5092", "NDTS" => "5092",
|
73
|
+
"NFDIS" => "5092", "APUB" => "5099", "BPUB" => "6000",
|
74
|
+
"PPUB" => "6060", "RR" => "9092", "AMW" => "9220", "WPUB" => "9599",
|
75
|
+
"DELPUB" => "9960", "PWI" => "0000", "NWIP" => "1000", "WD" => "2000",
|
76
|
+
"CDV" => "4000", "FDIS" => "5000"
|
68
77
|
}.freeze
|
69
78
|
|
70
79
|
DOC_STAGE = {
|
@@ -82,19 +91,23 @@ module Asciidoctor
|
|
82
91
|
}.freeze
|
83
92
|
|
84
93
|
STAGE_ABBRS = {
|
85
|
-
"00" => {"00" => "PWI"},
|
86
|
-
"10" => {"00" => "PNW"},
|
87
|
-
"20" => {"00" => "ANW", "98" => "CAN", "99" => "ACD"},
|
88
|
-
"30" => {"00" => "CD", "20" => "CD", "92" => "BWG", "97" => "MERGED",
|
89
|
-
|
90
|
-
"
|
91
|
-
|
92
|
-
"
|
93
|
-
|
94
|
-
|
95
|
-
"
|
96
|
-
|
97
|
-
"
|
94
|
+
"00" => { "00" => "PWI" },
|
95
|
+
"10" => { "00" => "PNW" },
|
96
|
+
"20" => { "00" => "ANW", "98" => "CAN", "99" => "ACD" },
|
97
|
+
"30" => { "00" => "CD", "20" => "CD", "92" => "BWG", "97" => "MERGED",
|
98
|
+
"98" => "DREJ", "99" => "A2CD" },
|
99
|
+
"35" => { "00" => "CD", "20" => "CD", "91" => "CDM", "92" => "ACD",
|
100
|
+
"99" => "ACDV" },
|
101
|
+
"40" => { "00" => "CCDV", "20" => "CCDV", "91" => "CDVM",
|
102
|
+
"92" => "NCDV", "93" => "NADIS",
|
103
|
+
"95" => "ADISSB", "99" => "ADIS" },
|
104
|
+
"50" => { "00" => "RFDIS", "20" => "CFDIS", "92" => "NFDIS",
|
105
|
+
"95" => "APUBSB", "99" => "APUB" },
|
106
|
+
"60" => { "00" => "BPUB", "60" => "PPUB" },
|
107
|
+
"90" => { "00" => "RR", "92" => "RR" },
|
108
|
+
"92" => { "00" => "AMW", "20" => "AMW" },
|
109
|
+
"95" => { "00" => "WPUB", "99" => "WPUB" },
|
110
|
+
"99" => { "00" => "DELPUB", "60" => "DELPUB" },
|
98
111
|
}.freeze
|
99
112
|
|
100
113
|
STAGE_NAMES = {
|
@@ -112,7 +125,7 @@ module Asciidoctor
|
|
112
125
|
"99": "Deleted",
|
113
126
|
}.freeze
|
114
127
|
|
115
|
-
def status_abbrev1(stage, substage, iter, doctype,
|
128
|
+
def status_abbrev1(stage, substage, iter, doctype, _draft)
|
116
129
|
return "" unless stage
|
117
130
|
|
118
131
|
abbr = STAGE_ABBRS.dig(stage, substage) || "??"
|
@@ -121,30 +134,30 @@ module Asciidoctor
|
|
121
134
|
end
|
122
135
|
case doctype
|
123
136
|
when "technical-report"
|
124
|
-
|
125
|
-
|
126
|
-
|
137
|
+
abbr = "ADTR" if stage == "40" && substage == "99"
|
138
|
+
abbr = "CDTR" if stage == "50" && substage == "20"
|
139
|
+
abbr = "DTRM" if stage == "50" && substage == "92"
|
127
140
|
when "technical-specification"
|
128
|
-
|
129
|
-
|
130
|
-
|
141
|
+
abbr = "ADTS" if stage == "40" && substage == "99"
|
142
|
+
abbr = "CDTS" if stage == "50" && substage == "20"
|
143
|
+
abbr = "DTSM" if stage == "50" && substage == "92"
|
131
144
|
when "interpretation-sheet"
|
132
|
-
|
133
|
-
|
145
|
+
abbr = "RDISH" if stage == "50" && substage == "00"
|
146
|
+
abbr = "CDISH" if stage == "50" && substage == "20"
|
134
147
|
when "publicly-available-specification"
|
135
|
-
|
148
|
+
abbr = "CDPAS" if stage == "50" && substage == "20"
|
136
149
|
end
|
137
150
|
abbr = abbr.sub(/CD$/, "#{iter}CD") if iter
|
138
151
|
abbr
|
139
152
|
end
|
140
153
|
|
141
|
-
def stage_abbr(stage,
|
154
|
+
def stage_abbr(stage, _substage)
|
142
155
|
return "PPUB" if stage == "60"
|
143
156
|
|
144
157
|
DOC_STAGE[stage.to_sym] || "??"
|
145
158
|
end
|
146
159
|
|
147
|
-
def stage_name(stage,
|
160
|
+
def stage_name(stage, _substage, _doctype, _iteration)
|
148
161
|
STAGE_NAMES[stage.to_sym]
|
149
162
|
end
|
150
163
|
|
@@ -159,11 +172,16 @@ module Asciidoctor
|
|
159
172
|
st = node.attr("status") || node.attr("docstage")
|
160
173
|
stage = get_stage(node)
|
161
174
|
node.attr("docsubstage") ||
|
162
|
-
( stage == "60"
|
175
|
+
(if stage == "60"
|
176
|
+
"60"
|
177
|
+
else
|
178
|
+
STAGE_CODES[st] ? STAGE_CODES[st][2..3] : "00"
|
179
|
+
end)
|
163
180
|
end
|
164
181
|
|
165
|
-
def id_stage_abbr(stage,
|
182
|
+
def id_stage_abbr(stage, _substage, node)
|
166
183
|
return "" if stage == "60"
|
184
|
+
|
167
185
|
abbr = DOC_STAGE[stage.to_sym] || ""
|
168
186
|
abbr = node.attr("iteration") + abbr if node.attr("iteration")
|
169
187
|
abbr
|
@@ -174,9 +192,9 @@ module Asciidoctor
|
|
174
192
|
substage = get_substage(node)
|
175
193
|
xml.status do |s|
|
176
194
|
s.stage stage, **attr_code(abbreviation: stage_abbr(stage, substage))
|
177
|
-
|
178
|
-
|
179
|
-
|
195
|
+
subst = status_abbrev1(stage, substage, node.attr("iteration"),
|
196
|
+
doctype(node), node.attr("draft"))
|
197
|
+
s.substage substage, **attr_code(abbreviation: subst)
|
180
198
|
node.attr("iteration") && (s.iteration node.attr("iteration"))
|
181
199
|
end
|
182
200
|
end
|
@@ -204,6 +204,18 @@
|
|
204
204
|
</zeroOrMore>
|
205
205
|
</element>
|
206
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>
|
207
219
|
<define name="example">
|
208
220
|
<element name="example">
|
209
221
|
<attribute name="id">
|
@@ -899,7 +911,7 @@
|
|
899
911
|
</include>
|
900
912
|
<!-- end overrides -->
|
901
913
|
<define name="docsubtype">
|
902
|
-
<element name="
|
914
|
+
<element name="subdoctype">
|
903
915
|
<ref name="DocumentSubtype"/>
|
904
916
|
</element>
|
905
917
|
</define>
|
@@ -955,7 +967,34 @@
|
|
955
967
|
<define name="concept">
|
956
968
|
<element name="concept">
|
957
969
|
<optional>
|
958
|
-
<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>
|
959
998
|
</optional>
|
960
999
|
<choice>
|
961
1000
|
<ref name="eref"/>
|
@@ -972,8 +1011,14 @@
|
|
972
1011
|
<ref name="imagemap"/>
|
973
1012
|
<ref name="svgmap"/>
|
974
1013
|
<ref name="inputform"/>
|
1014
|
+
<ref name="toc"/>
|
975
1015
|
</choice>
|
976
1016
|
</define>
|
1017
|
+
<define name="toc">
|
1018
|
+
<element name="toc">
|
1019
|
+
<ref name="ul"/>
|
1020
|
+
</element>
|
1021
|
+
</define>
|
977
1022
|
<define name="inputform">
|
978
1023
|
<element name="form">
|
979
1024
|
<attribute name="id">
|
@@ -981,6 +1026,9 @@
|
|
981
1026
|
</attribute>
|
982
1027
|
<attribute name="name"/>
|
983
1028
|
<attribute name="action"/>
|
1029
|
+
<optional>
|
1030
|
+
<attribute name="class"/>
|
1031
|
+
</optional>
|
984
1032
|
<zeroOrMore>
|
985
1033
|
<choice>
|
986
1034
|
<ref name="TextElement"/>
|
@@ -1212,6 +1260,12 @@
|
|
1212
1260
|
<optional>
|
1213
1261
|
<attribute name="type"/>
|
1214
1262
|
</optional>
|
1263
|
+
<optional>
|
1264
|
+
<attribute name="identifier"/>
|
1265
|
+
</optional>
|
1266
|
+
<optional>
|
1267
|
+
<attribute name="prefix"/>
|
1268
|
+
</optional>
|
1215
1269
|
<text/>
|
1216
1270
|
</define>
|
1217
1271
|
<define name="ics">
|
@@ -1473,26 +1527,26 @@
|
|
1473
1527
|
<optional>
|
1474
1528
|
<ref name="section-title"/>
|
1475
1529
|
</optional>
|
1476
|
-
<
|
1530
|
+
<choice>
|
1477
1531
|
<choice>
|
1478
1532
|
<group>
|
1479
|
-
<
|
1533
|
+
<oneOrMore>
|
1480
1534
|
<ref name="BasicBlock"/>
|
1481
|
-
</
|
1535
|
+
</oneOrMore>
|
1482
1536
|
<zeroOrMore>
|
1483
1537
|
<ref name="note"/>
|
1484
1538
|
</zeroOrMore>
|
1485
1539
|
</group>
|
1486
1540
|
<ref name="amend"/>
|
1487
1541
|
</choice>
|
1488
|
-
<
|
1542
|
+
<oneOrMore>
|
1489
1543
|
<choice>
|
1490
1544
|
<ref name="clause-subsection"/>
|
1491
1545
|
<ref name="terms"/>
|
1492
1546
|
<ref name="definitions"/>
|
1493
1547
|
</choice>
|
1494
|
-
</
|
1495
|
-
</
|
1548
|
+
</oneOrMore>
|
1549
|
+
</choice>
|
1496
1550
|
</define>
|
1497
1551
|
<define name="Annex-Section">
|
1498
1552
|
<optional>
|
@@ -101,7 +101,11 @@
|
|
101
101
|
<ref name="definitions"/>
|
102
102
|
</optional>
|
103
103
|
<oneOrMore>
|
104
|
-
<
|
104
|
+
<choice>
|
105
|
+
<ref name="clause"/>
|
106
|
+
<ref name="term-clause"/>
|
107
|
+
<ref name="terms"/>
|
108
|
+
</choice>
|
105
109
|
</oneOrMore>
|
106
110
|
</element>
|
107
111
|
</define>
|
@@ -136,7 +140,7 @@
|
|
136
140
|
<optional>
|
137
141
|
<ref name="section-title"/>
|
138
142
|
</optional>
|
139
|
-
<
|
143
|
+
<choice>
|
140
144
|
<choice>
|
141
145
|
<group>
|
142
146
|
<oneOrMore>
|
@@ -151,7 +155,7 @@
|
|
151
155
|
<oneOrMore>
|
152
156
|
<ref name="clause-subsection"/>
|
153
157
|
</oneOrMore>
|
154
|
-
</
|
158
|
+
</choice>
|
155
159
|
</define>
|
156
160
|
<define name="term">
|
157
161
|
<element name="term">
|
@@ -18,8 +18,8 @@ module IsoDoc
|
|
18
18
|
s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @i18n.foreword }
|
19
19
|
@meta.get[:doctype] == "Amendment" or
|
20
20
|
s.div **attr_code(class: "boilerplate_legal") do |s1|
|
21
|
-
|
22
|
-
|
21
|
+
b&.elements&.each { |e| parse(e, s1) }
|
22
|
+
end
|
23
23
|
f&.elements&.each { |e| parse(e, s) unless e.name == "title" }
|
24
24
|
end
|
25
25
|
end
|
@@ -40,12 +40,12 @@ module IsoDoc
|
|
40
40
|
@meta.get[:doctitlepartlabel] and
|
41
41
|
title2 = "#{@meta.get[:doctitlepartlabel]}: #{title2}"
|
42
42
|
end
|
43
|
-
out.p(**{ class: "zzSTDTitle1" }) do |p|
|
43
|
+
out.p(**{ class: "zzSTDTitle1" }) do |p|
|
44
44
|
p.b { |b| b << title1 }
|
45
45
|
end
|
46
46
|
if @meta.get[:doctitlepart]
|
47
47
|
out.p(**{ class: "zzSTDTitle1" }) { |p| p << " " }
|
48
|
-
out.p(**{ class: "zzSTDTitle2" }) do |p|
|
48
|
+
out.p(**{ class: "zzSTDTitle2" }) do |p|
|
49
49
|
p.b { |b| b << title2 }
|
50
50
|
end
|
51
51
|
end
|
@@ -58,7 +58,7 @@ module IsoDoc
|
|
58
58
|
|
59
59
|
def biblio_list(f, div, biblio)
|
60
60
|
return super unless @is_iev
|
61
|
-
|
61
|
+
|
62
62
|
f.children.each do |b|
|
63
63
|
parse(b, div) unless %w(title bibitem).include? b.name
|
64
64
|
end
|
@@ -66,6 +66,7 @@ module IsoDoc
|
|
66
66
|
|
67
67
|
def terms_parse(node, out)
|
68
68
|
return super unless @is_iev
|
69
|
+
|
69
70
|
page_break(out)
|
70
71
|
out.div **attr_code(id: node["id"]) do |div|
|
71
72
|
out.p(**{ class: "zzSTDTitle2" }) do |p|
|
@@ -81,12 +82,14 @@ module IsoDoc
|
|
81
82
|
|
82
83
|
def termref_cleanup(docxml)
|
83
84
|
return super unless @is_iev
|
84
|
-
|
85
|
-
|
86
|
-
gsub(
|
87
|
-
gsub(/\
|
88
|
-
gsub(/\s*\[\/TERMREF\]
|
89
|
-
|
85
|
+
|
86
|
+
docxml
|
87
|
+
.gsub(%r{\s*\[/TERMREF\]\s*</p>\s*<p>\s*\[TERMREF\]}, "; ")
|
88
|
+
.gsub(/\[TERMREF\]\s*/, l10n("#{@i18n.source}: "))
|
89
|
+
.gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/,
|
90
|
+
l10n(", #{@i18n.modified} [/TERMREF]"))
|
91
|
+
.gsub(/\s*\[\/TERMREF\]\s*/, l10n(""))
|
92
|
+
.gsub(/\s*\[MODIFICATION\]/, l10n(", #{@i18n.modified} — "))
|
90
93
|
end
|
91
94
|
|
92
95
|
def set_termdomain(termdomain)
|
@@ -95,13 +98,15 @@ module IsoDoc
|
|
95
98
|
|
96
99
|
def term_suffix(node, out)
|
97
100
|
return unless @is_iev
|
101
|
+
|
98
102
|
domain = node&.at(ns("../domain"))&.text
|
99
103
|
return unless domain
|
104
|
+
|
100
105
|
out << ", <#{domain}>"
|
101
106
|
end
|
102
107
|
|
103
108
|
def deprecated_term_parse(node, out)
|
104
|
-
out.p **{ class: "DeprecatedTerms", style:"text-align:left;" } do |p|
|
109
|
+
out.p **{ class: "DeprecatedTerms", style: "text-align:left;" } do |p|
|
105
110
|
p << l10n("#{@i18n.deprecated}: ")
|
106
111
|
node.children.each { |c| parse(c, p) }
|
107
112
|
term_suffix(node, p)
|
@@ -109,7 +114,7 @@ module IsoDoc
|
|
109
114
|
end
|
110
115
|
|
111
116
|
def admitted_term_parse(node, out)
|
112
|
-
out.p **{ class: "AltTerms", style:"text-align:left;" } do |p|
|
117
|
+
out.p **{ class: "AltTerms", style: "text-align:left;" } do |p|
|
113
118
|
node.children.each { |c| parse(c, p) }
|
114
119
|
term_suffix(node, p)
|
115
120
|
end
|
@@ -117,7 +122,8 @@ module IsoDoc
|
|
117
122
|
|
118
123
|
def term_parse(node, out)
|
119
124
|
return super unless @is_iev
|
120
|
-
|
125
|
+
|
126
|
+
out.p **{ class: "Terms", style: "text-align:left;" } do |p|
|
121
127
|
node.children.each { |c| parse(c, p) }
|
122
128
|
term_suffix(node, p)
|
123
129
|
end
|