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.
@@ -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
- before(:all) do
5
- @blank_hdr = blank_hdr_gen
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
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
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
- <iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
23
- <bibdata type="standard">
24
- <contributor>
25
- <role type="author"/>
26
- <organization>
27
- <name>International Electrotechnical Commission</name>
28
- <abbreviation>IEC</abbreviation>
29
- </organization>
30
- </contributor>
31
- <contributor>
32
- <role type="publisher"/>
33
- <organization>
34
- <name>International Electrotechnical Commission</name>
35
- <abbreviation>IEC</abbreviation>
36
- </organization>
37
- </contributor>
38
- <language>en</language>
39
- <script>Latn</script>
40
- <status>
41
- <stage abbreviation="PPUB">60</stage>
42
- <substage abbreviation="PPUB">60</substage>
43
- </status>
44
- <copyright>
45
- <from>#{Time.new.year}</from>
46
- <owner>
47
- <organization>
48
- <name>International Electrotechnical Commission</name>
49
- <abbreviation>IEC</abbreviation>
50
- </organization>
51
- </owner>
52
- </copyright>
53
- <ext>
54
- <doctype>article</doctype>
55
- <horizontal>false</horizontal>
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>
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
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
87
+ input = <<~INPUT
86
88
  #{ASCIIDOC_BLANK_HDR}
87
89
  == {blank}
88
90
  INPUT
89
- #{@blank_hdr}
90
- <sections>
91
- <clause id="_" inline-header="false" obligation="normative">
91
+ output = <<~OUTPUT
92
+ #{@blank_hdr}
93
+ <sections>
94
+ <clause id="_" inline-header="false" obligation="normative">
92
95
 
93
- </clause>
94
- </sections>
95
- </iec-standard>
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
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
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
- #{@blank_hdr}
113
- <sections>
114
- <terms id="_" obligation="normative"><title>Terms and definitions</title>
115
- <p id="_">For the purposes of this document,
116
- the following terms and definitions apply.</p>
117
- #{TERMS_BOILERPLATE}
118
- <p id='_'>I am boilerplate</p>
119
- <ul id='_'>
120
- <li>
121
- <p id='_'>So am I</p>
122
- </li>
123
- </ul>
124
- <term id="term-time">
125
- <preferred><expression><name>Time</name></expression></preferred>
126
- <definition><verbaldefinition><p id="_">This paragraph is extraneous</p></verbaldefinition></definition>
127
- </term></terms>
128
- </sections>
129
- </iec-standard>
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
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
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
- #{@blank_hdr}
143
- <preface>
144
- <foreword id="_" obligation="informative">
145
- <title>FOREWORD</title>
146
- <p id="_">
147
- <eref type="inline" bibitemid="iso216" citeas="ISO 216"/>
148
- </p>
149
- </foreword></preface><sections>
150
- </sections><bibliography><references id="_" obligation="informative" normative="false">
151
- <title>Bibliography</title>
152
- <bibitem id="iso216" type="standard">
153
- <title format="text/plain">Reference</title>
154
- <docidentifier>ISO 216</docidentifier>
155
- <docnumber>216</docnumber>
156
- <contributor>
157
- <role type="publisher"/>
158
- <organization>
159
- <name>International Organization for Standardization</name>
160
- <abbreviation>ISO</abbreviation>
161
- </organization>
162
- </contributor>
163
- </bibitem>
164
- </references></bibliography>
165
- </iec-standard>
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
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
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
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
216
+ input = <<~INPUT
203
217
  #{ASCIIDOC_BLANK_HDR}
204
218
  Paragraph
205
219
  INPUT
206
- #{@blank_hdr}
207
- <sections>
208
- <p id="_">Paragraph</p>
209
- </sections>
210
- </iec-standard>
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
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
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
- #{@blank_hdr}
223
- <sections>
224
- <example id="_">
225
- <note id="_">
226
- <p id="_">This note has no ID</p>
227
- </note>
228
- </example>
229
- </sections>
230
- </iec-standard>
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
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
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
- #{@blank_hdr}
244
- <sections><figure id="_">
245
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
246
- <fn reference="a">
247
- <p id="_">This is a footnote to a figure</p>
248
- </fn><fn reference="b">
249
- <p id="_">This is another footnote to a figure</p>
250
- </fn></figure>
251
-
252
- </sections>
253
-
254
- </iec-standard>
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
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
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
- #{@blank_hdr}
271
- <sections><clause id="_" inline-header="false" obligation="normative">
272
- <title>Clause</title>
273
- <p id="_">Text</p>
274
- </clause>
275
- </sections><annex id="_" inline-header="false" obligation="normative">
276
- <title>Clause</title>
277
- <p id="_">Text</p>
278
- </annex>
279
- </iec-standard>
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
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
285
- #{ASCIIDOC_BLANK_HDR}
310
+ input = <<~INPUT
311
+ #{ASCIIDOC_BLANK_HDR}
286
312
 
287
- == Clause1
313
+ == Clause1
288
314
 
289
- === Clause2
315
+ === Clause2
290
316
 
291
- ==== Clause3
317
+ ==== Clause3
292
318
 
293
- ===== Clause4
319
+ ===== Clause4
294
320
 
295
- ====== Clause 5
321
+ ====== Clause 5
296
322
 
297
- [level=6]
298
- ====== Clause 6
323
+ [level=6]
324
+ ====== Clause 6
299
325
 
300
- [level=7]
301
- ====== Clause 7A
326
+ [level=7]
327
+ ====== Clause 7A
302
328
 
303
- [level=7]
304
- ====== Clause 7B
329
+ [level=7]
330
+ ====== Clause 7B
305
331
 
306
- [level=6]
307
- ====== Clause 6B
332
+ [level=6]
333
+ ====== Clause 6B
308
334
 
309
- ====== Clause 5B
335
+ ====== Clause 5B
310
336
 
311
337
  INPUT
312
- #{@blank_hdr}
313
- <sections>
314
- <clause id="_" inline-header="false" obligation="normative">
315
- <title>Clause1</title>
316
- <clause id="_" inline-header="false" obligation="normative">
317
- <title>Clause2</title>
318
- <clause id="_" inline-header="false" obligation="normative">
319
- <title>Clause3</title>
320
- <clause id="_" inline-header="false" obligation="normative"><title>Clause4</title><clause id="_" inline-header="false" obligation="normative">
321
- <title>Clause 5</title>
322
- <clause id="_" inline-header="false" obligation="normative">
323
- <title>Clause 6</title>
324
- <clause id="_" inline-header="false" obligation="normative">
325
- <title>Clause 7A</title>
326
- </clause><clause id="_" inline-header="false" obligation="normative">
327
- <title>Clause 7B</title>
328
- </clause></clause><clause id="_" inline-header="false" obligation="normative">
329
- <title>Clause 6B</title>
330
- </clause></clause>
331
-
332
-
333
-
334
-
335
- <clause id="_" inline-header="false" obligation="normative">
336
- <title>Clause 5B</title>
337
- </clause></clause>
338
- </clause>
339
- </clause>
340
- </clause>
341
- </sections>
342
- </iec-standard>
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