metanorma-iec 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/asciidoctor/iec/converter.rb +42 -25
- data/lib/asciidoctor/iec/front.rb +2 -3
- data/lib/asciidoctor/iec/isodoc.rng +42 -17
- data/lib/isodoc/iec/base_convert.rb +0 -33
- data/lib/isodoc/iec/html/htmlstyle.css +3 -1
- data/lib/isodoc/iec/html/htmlstyle.scss +4 -1
- data/lib/isodoc/iec/html/isodoc.css +1 -2
- data/lib/isodoc/iec/html/isodoc.scss +1 -2
- data/lib/isodoc/iec/iec.international-standard.xsl +23 -10
- data/lib/isodoc/iec/presentation_xml_convert.rb +32 -5
- data/lib/metanorma/iec/processor.rb +15 -8
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +2 -2
- data/spec/asciidoctor/base_spec.rb +0 -4
- data/spec/asciidoctor/cleanup_spec.rb +231 -202
- data/spec/asciidoctor/iev_spec.rb +195 -190
- data/spec/isodoc/iev_spec.rb +136 -28
- data/spec/isodoc/terms_spec.rb +190 -181
- data/spec/metanorma/processor_spec.rb +139 -44
- data/spec/spec_helper.rb +10 -12
- metadata +5 -5
@@ -166,7 +166,6 @@ RSpec.describe Asciidoctor::Iec do
|
|
166
166
|
</relation>
|
167
167
|
<ext>
|
168
168
|
<doctype>article</doctype>
|
169
|
-
<horizontal>false</horizontal>
|
170
169
|
<editorialgroup>
|
171
170
|
<technical-committee number='1' type='A'>TC</technical-committee>
|
172
171
|
<technical-committee number='11' type='A1'>TC1</technical-committee>
|
@@ -675,7 +674,6 @@ RSpec.describe Asciidoctor::Iec do
|
|
675
674
|
</copyright>
|
676
675
|
<ext>
|
677
676
|
<doctype>article</doctype>
|
678
|
-
<horizontal>false</horizontal>
|
679
677
|
<editorialgroup>
|
680
678
|
<technical-committee/>
|
681
679
|
<subcommittee/>
|
@@ -879,7 +877,6 @@ RSpec.describe Asciidoctor::Iec do
|
|
879
877
|
</copyright>
|
880
878
|
<ext>
|
881
879
|
<doctype>article</doctype>
|
882
|
-
<horizontal>false</horizontal>
|
883
880
|
<editorialgroup>
|
884
881
|
<technical-committee/>
|
885
882
|
<subcommittee/>
|
@@ -947,7 +944,6 @@ RSpec.describe Asciidoctor::Iec do
|
|
947
944
|
</copyright>
|
948
945
|
<ext>
|
949
946
|
<doctype>article</doctype>
|
950
|
-
<horizontal>false</horizontal>
|
951
947
|
<editorialgroup>
|
952
948
|
<technical-committee/>
|
953
949
|
<subcommittee/>
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe Asciidoctor::Iec do
|
4
|
-
|
5
|
-
|
6
|
-
end
|
4
|
+
before(:all) do
|
5
|
+
@blank_hdr = blank_hdr_gen
|
6
|
+
end
|
7
7
|
|
8
8
|
it "moves note from TC/SC officers to metadata" do
|
9
|
-
|
9
|
+
input = <<~INPUT
|
10
10
|
#{ASCIIDOC_BLANK_HDR}
|
11
11
|
== {blank}
|
12
12
|
|
@@ -19,85 +19,90 @@ end
|
|
19
19
|
This document is also of interest for ISO/ TC114/ WG1 Requirements for Watch batteries
|
20
20
|
====
|
21
21
|
INPUT
|
22
|
-
|
23
|
-
<
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
</tc-sc-officers-note>
|
72
|
-
|
73
|
-
</bibdata>
|
74
|
-
#{boilerplate(Nokogiri::XML(BLANK_HDR +
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
22
|
+
output = <<~OUTPUT
|
23
|
+
<iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
|
24
|
+
<bibdata type="standard">
|
25
|
+
<contributor>
|
26
|
+
<role type="author"/>
|
27
|
+
<organization>
|
28
|
+
<name>International Electrotechnical Commission</name>
|
29
|
+
<abbreviation>IEC</abbreviation>
|
30
|
+
</organization>
|
31
|
+
</contributor>
|
32
|
+
<contributor>
|
33
|
+
<role type="publisher"/>
|
34
|
+
<organization>
|
35
|
+
<name>International Electrotechnical Commission</name>
|
36
|
+
<abbreviation>IEC</abbreviation>
|
37
|
+
</organization>
|
38
|
+
</contributor>
|
39
|
+
<language>en</language>
|
40
|
+
<script>Latn</script>
|
41
|
+
<status>
|
42
|
+
<stage abbreviation="PPUB">60</stage>
|
43
|
+
<substage abbreviation="PPUB">60</substage>
|
44
|
+
</status>
|
45
|
+
<copyright>
|
46
|
+
<from>#{Time.new.year}</from>
|
47
|
+
<owner>
|
48
|
+
<organization>
|
49
|
+
<name>International Electrotechnical Commission</name>
|
50
|
+
<abbreviation>IEC</abbreviation>
|
51
|
+
</organization>
|
52
|
+
</owner>
|
53
|
+
</copyright>
|
54
|
+
<ext>
|
55
|
+
<doctype>article</doctype>
|
56
|
+
<editorialgroup>
|
57
|
+
<technical-committee/>
|
58
|
+
<subcommittee/>
|
59
|
+
<workgroup/>
|
60
|
+
</editorialgroup>
|
61
|
+
<stagename>International standard</stagename>
|
62
|
+
<tc-sc-officers-note>
|
63
|
+
<p id='_'>
|
64
|
+
This FDIS is the result of the discussion between the IEC SC21A
|
65
|
+
experts WG 3 during the meeting held in Chicago (USA) on April 9th
|
66
|
+
</p>
|
67
|
+
<p id='_'>
|
68
|
+
This document is also of interest for ISO/ TC114/ WG1 Requirements for
|
69
|
+
Watch batteries
|
70
|
+
</p>
|
71
|
+
</tc-sc-officers-note>
|
72
|
+
</ext>
|
73
|
+
</bibdata>
|
74
|
+
#{boilerplate(Nokogiri::XML(BLANK_HDR + '</iec-standard>'))}
|
75
|
+
<sections>
|
76
|
+
<clause id="_" inline-header="false" obligation="normative">
|
77
|
+
|
78
|
+
</clause>
|
79
|
+
</sections>
|
80
|
+
</iec-standard>
|
81
81
|
OUTPUT
|
82
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
83
|
+
.to be_equivalent_to xmlpp(output)
|
82
84
|
end
|
83
85
|
|
84
86
|
it "removes empty text elements" do
|
85
|
-
|
87
|
+
input = <<~INPUT
|
86
88
|
#{ASCIIDOC_BLANK_HDR}
|
87
89
|
== {blank}
|
88
90
|
INPUT
|
89
|
-
|
90
|
-
|
91
|
-
|
91
|
+
output = <<~OUTPUT
|
92
|
+
#{@blank_hdr}
|
93
|
+
<sections>
|
94
|
+
<clause id="_" inline-header="false" obligation="normative">
|
92
95
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
+
</clause>
|
97
|
+
</sections>
|
98
|
+
</iec-standard>
|
96
99
|
OUTPUT
|
100
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
101
|
+
.to be_equivalent_to xmlpp(output)
|
97
102
|
end
|
98
103
|
|
99
104
|
it "keeps any initial boilerplate from terms and definitions" do
|
100
|
-
|
105
|
+
input = <<~INPUT
|
101
106
|
#{ASCIIDOC_BLANK_HDR}
|
102
107
|
== Terms and Definitions
|
103
108
|
|
@@ -109,29 +114,32 @@ end
|
|
109
114
|
|
110
115
|
This paragraph is extraneous
|
111
116
|
INPUT
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
<
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
</
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
117
|
+
output = <<~OUTPUT
|
118
|
+
#{@blank_hdr}
|
119
|
+
<sections>
|
120
|
+
<terms id="_" obligation="normative"><title>Terms and definitions</title>
|
121
|
+
<p id="_">For the purposes of this document,
|
122
|
+
the following terms and definitions apply.</p>
|
123
|
+
#{TERMS_BOILERPLATE}
|
124
|
+
<p id='_'>I am boilerplate</p>
|
125
|
+
<ul id='_'>
|
126
|
+
<li>
|
127
|
+
<p id='_'>So am I</p>
|
128
|
+
</li>
|
129
|
+
</ul>
|
130
|
+
<term id="term-time">
|
131
|
+
<preferred><expression><name>Time</name></expression></preferred>
|
132
|
+
<definition><verbal-definition><p id="_">This paragraph is extraneous</p></verbal-definition></definition>
|
133
|
+
</term></terms>
|
134
|
+
</sections>
|
135
|
+
</iec-standard>
|
130
136
|
OUTPUT
|
137
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
138
|
+
.to be_equivalent_to xmlpp(output)
|
131
139
|
end
|
132
140
|
|
133
141
|
it "strips type from xrefs" do
|
134
|
-
|
142
|
+
input = <<~INPUT
|
135
143
|
#{ASCIIDOC_BLANK_HDR}
|
136
144
|
<<iso216>>
|
137
145
|
|
@@ -139,35 +147,38 @@ end
|
|
139
147
|
== Clause
|
140
148
|
* [[[iso216,ISO 216]]], _Reference_
|
141
149
|
INPUT
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
</
|
164
|
-
</
|
165
|
-
|
150
|
+
output = <<~OUTPUT
|
151
|
+
#{@blank_hdr}
|
152
|
+
<preface>
|
153
|
+
<foreword id="_" obligation="informative">
|
154
|
+
<title>FOREWORD</title>
|
155
|
+
<p id="_">
|
156
|
+
<eref type="inline" bibitemid="iso216" citeas="ISO 216"/>
|
157
|
+
</p>
|
158
|
+
</foreword></preface><sections>
|
159
|
+
</sections><bibliography><references id="_" obligation="informative" normative="false">
|
160
|
+
<title>Bibliography</title>
|
161
|
+
<bibitem id="iso216" type="standard">
|
162
|
+
<title format="text/plain">Reference</title>
|
163
|
+
<docidentifier>ISO 216</docidentifier>
|
164
|
+
<docnumber>216</docnumber>
|
165
|
+
<contributor>
|
166
|
+
<role type="publisher"/>
|
167
|
+
<organization>
|
168
|
+
<name>International Organization for Standardization</name>
|
169
|
+
<abbreviation>ISO</abbreviation>
|
170
|
+
</organization>
|
171
|
+
</contributor>
|
172
|
+
</bibitem>
|
173
|
+
</references></bibliography>
|
174
|
+
</iec-standard>
|
166
175
|
OUTPUT
|
176
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
177
|
+
.to be_equivalent_to xmlpp(output)
|
167
178
|
end
|
168
179
|
|
169
180
|
it "removes extraneous material from Normative References" do
|
170
|
-
|
181
|
+
input = <<~INPUT
|
171
182
|
#{ASCIIDOC_BLANK_HDR}
|
172
183
|
[bibliography]
|
173
184
|
== Normative References
|
@@ -176,6 +187,7 @@ end
|
|
176
187
|
|
177
188
|
* [[[iso216,ISO 216]]], _Reference_
|
178
189
|
INPUT
|
190
|
+
output = <<~OUTPUT
|
179
191
|
#{@blank_hdr}
|
180
192
|
<sections></sections>
|
181
193
|
<bibliography><references id="_" obligation="informative" normative="true"><title>Normative references</title>
|
@@ -196,43 +208,51 @@ end
|
|
196
208
|
</bibliography>
|
197
209
|
</iec-standard>
|
198
210
|
OUTPUT
|
211
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
212
|
+
.to be_equivalent_to xmlpp(output)
|
199
213
|
end
|
200
214
|
|
201
215
|
it "inserts IDs into paragraphs" do
|
202
|
-
|
216
|
+
input = <<~INPUT
|
203
217
|
#{ASCIIDOC_BLANK_HDR}
|
204
218
|
Paragraph
|
205
219
|
INPUT
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
220
|
+
output = <<~OUTPUT
|
221
|
+
#{@blank_hdr}
|
222
|
+
<sections>
|
223
|
+
<p id="_">Paragraph</p>
|
224
|
+
</sections>
|
225
|
+
</iec-standard>
|
211
226
|
OUTPUT
|
227
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
228
|
+
.to be_equivalent_to xmlpp(output)
|
212
229
|
end
|
213
230
|
|
214
231
|
it "inserts IDs into notes" do
|
215
|
-
|
232
|
+
input = <<~INPUT
|
216
233
|
#{ASCIIDOC_BLANK_HDR}
|
217
234
|
[example]
|
218
235
|
====
|
219
236
|
NOTE: This note has no ID
|
220
237
|
====
|
221
238
|
INPUT
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
239
|
+
output = <<~OUTPUT
|
240
|
+
#{@blank_hdr}
|
241
|
+
<sections>
|
242
|
+
<example id="_">
|
243
|
+
<note id="_">
|
244
|
+
<p id="_">This note has no ID</p>
|
245
|
+
</note>
|
246
|
+
</example>
|
247
|
+
</sections>
|
248
|
+
</iec-standard>
|
231
249
|
OUTPUT
|
250
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
251
|
+
.to be_equivalent_to xmlpp(output)
|
232
252
|
end
|
233
253
|
|
234
254
|
it "moves footnotes inside figures" do
|
235
|
-
|
255
|
+
input = <<~INPUT
|
236
256
|
#{ASCIIDOC_BLANK_HDR}
|
237
257
|
image::spec/examples/rice_images/rice_image1.png[]
|
238
258
|
|
@@ -240,23 +260,26 @@ end
|
|
240
260
|
|
241
261
|
footnote:[This is another footnote to a figure]
|
242
262
|
INPUT
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
263
|
+
output = <<~OUTPUT
|
264
|
+
#{@blank_hdr}
|
265
|
+
<sections><figure id="_">
|
266
|
+
<image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
|
267
|
+
<fn reference="a">
|
268
|
+
<p id="_">This is a footnote to a figure</p>
|
269
|
+
</fn><fn reference="b">
|
270
|
+
<p id="_">This is another footnote to a figure</p>
|
271
|
+
</fn></figure>
|
272
|
+
|
273
|
+
</sections>
|
274
|
+
|
275
|
+
</iec-standard>
|
255
276
|
OUTPUT
|
277
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
278
|
+
.to be_equivalent_to xmlpp(output)
|
256
279
|
end
|
257
280
|
|
258
281
|
it "defaults section obligations" do
|
259
|
-
|
282
|
+
input = <<~INPUT
|
260
283
|
#{ASCIIDOC_BLANK_HDR}
|
261
284
|
|
262
285
|
== Clause
|
@@ -267,79 +290,85 @@ end
|
|
267
290
|
|
268
291
|
Text
|
269
292
|
INPUT
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
293
|
+
output = <<~OUTPUT
|
294
|
+
#{@blank_hdr}
|
295
|
+
<sections><clause id="_" inline-header="false" obligation="normative">
|
296
|
+
<title>Clause</title>
|
297
|
+
<p id="_">Text</p>
|
298
|
+
</clause>
|
299
|
+
</sections><annex id="_" inline-header="false" obligation="normative">
|
300
|
+
<title>Clause</title>
|
301
|
+
<p id="_">Text</p>
|
302
|
+
</annex>
|
303
|
+
</iec-standard>
|
280
304
|
OUTPUT
|
305
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
306
|
+
.to be_equivalent_to xmlpp(output)
|
281
307
|
end
|
282
308
|
|
283
309
|
it "extends clause levels past 5" do
|
284
|
-
|
285
|
-
|
310
|
+
input = <<~INPUT
|
311
|
+
#{ASCIIDOC_BLANK_HDR}
|
286
312
|
|
287
|
-
|
313
|
+
== Clause1
|
288
314
|
|
289
|
-
|
315
|
+
=== Clause2
|
290
316
|
|
291
|
-
|
317
|
+
==== Clause3
|
292
318
|
|
293
|
-
|
319
|
+
===== Clause4
|
294
320
|
|
295
|
-
|
321
|
+
====== Clause 5
|
296
322
|
|
297
|
-
|
298
|
-
|
323
|
+
[level=6]
|
324
|
+
====== Clause 6
|
299
325
|
|
300
|
-
|
301
|
-
|
326
|
+
[level=7]
|
327
|
+
====== Clause 7A
|
302
328
|
|
303
|
-
|
304
|
-
|
329
|
+
[level=7]
|
330
|
+
====== Clause 7B
|
305
331
|
|
306
|
-
|
307
|
-
|
332
|
+
[level=6]
|
333
|
+
====== Clause 6B
|
308
334
|
|
309
|
-
|
335
|
+
====== Clause 5B
|
310
336
|
|
311
337
|
INPUT
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
<
|
323
|
-
|
324
|
-
<
|
325
|
-
|
326
|
-
</
|
327
|
-
|
328
|
-
</
|
329
|
-
|
330
|
-
</
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
</
|
338
|
-
</clause>
|
339
|
-
</clause>
|
340
|
-
</clause>
|
341
|
-
</
|
342
|
-
</
|
338
|
+
output = <<~OUTPUT
|
339
|
+
#{@blank_hdr}
|
340
|
+
<sections>
|
341
|
+
<clause id="_" inline-header="false" obligation="normative">
|
342
|
+
<title>Clause1</title>
|
343
|
+
<clause id="_" inline-header="false" obligation="normative">
|
344
|
+
<title>Clause2</title>
|
345
|
+
<clause id="_" inline-header="false" obligation="normative">
|
346
|
+
<title>Clause3</title>
|
347
|
+
<clause id="_" inline-header="false" obligation="normative"><title>Clause4</title><clause id="_" inline-header="false" obligation="normative">
|
348
|
+
<title>Clause 5</title>
|
349
|
+
<clause id="_" inline-header="false" obligation="normative">
|
350
|
+
<title>Clause 6</title>
|
351
|
+
<clause id="_" inline-header="false" obligation="normative">
|
352
|
+
<title>Clause 7A</title>
|
353
|
+
</clause><clause id="_" inline-header="false" obligation="normative">
|
354
|
+
<title>Clause 7B</title>
|
355
|
+
</clause></clause><clause id="_" inline-header="false" obligation="normative">
|
356
|
+
<title>Clause 6B</title>
|
357
|
+
</clause></clause>
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
<clause id="_" inline-header="false" obligation="normative">
|
363
|
+
<title>Clause 5B</title>
|
364
|
+
</clause></clause>
|
365
|
+
</clause>
|
366
|
+
</clause>
|
367
|
+
</clause>
|
368
|
+
</sections>
|
369
|
+
</iec-standard>
|
343
370
|
OUTPUT
|
371
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
372
|
+
.to be_equivalent_to xmlpp(output)
|
344
373
|
end
|
345
374
|
end
|