metanorma-iec 1.2.11 → 1.2.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,10 @@
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
7
+
4
8
  it "processes open blocks" do
5
9
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
10
  #{ASCIIDOC_BLANK_HDR}
@@ -12,7 +16,7 @@ RSpec.describe Asciidoctor::Iec do
12
16
  z
13
17
  --
14
18
  INPUT
15
- #{BLANK_HDR}
19
+ #{@blank_hdr}
16
20
  <sections><p id="_">x</p>
17
21
  <p id="_">y</p>
18
22
  <p id="_">z</p></sections>
@@ -34,7 +38,7 @@ RSpec.describe Asciidoctor::Iec do
34
38
  <mml:math><mml:msub xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">F</mml:mi> </mml:mrow> </mml:mrow> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">&#x0391;</mml:mi> </mml:mrow> </mml:mrow> </mml:msub> </mml:math>
35
39
  ++++
36
40
  INPUT
37
- #{BLANK_HDR}
41
+ #{@blank_hdr}
38
42
  <sections>
39
43
  <formula id="_">
40
44
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi><mi>r</mi><mo>=</mo><mn>1</mn><mi>%</mi></math></stem>
@@ -62,7 +66,7 @@ RSpec.describe Asciidoctor::Iec do
62
66
  For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
63
67
  ****
64
68
  INPUT
65
- #{BLANK_HDR}
69
+ #{@blank_hdr}
66
70
  <sections><p id="foreword">Foreword</p>
67
71
  </sections>
68
72
  </iec-standard>
@@ -107,7 +111,7 @@ RSpec.describe Asciidoctor::Iec do
107
111
 
108
112
  NOTE: This is a note
109
113
  INPUT
110
- #{BLANK_HDR}
114
+ #{@blank_hdr}
111
115
  <sections>
112
116
  <terms id="_" obligation="normative">
113
117
  <title>Terms and definitions</title>
@@ -130,7 +134,7 @@ RSpec.describe Asciidoctor::Iec do
130
134
  #{ASCIIDOC_BLANK_HDR}
131
135
  NOTE: This is a note
132
136
  INPUT
133
- #{BLANK_HDR}
137
+ #{@blank_hdr}
134
138
  <sections>
135
139
  <note id="_">
136
140
  <p id="_">This is a note</p>
@@ -148,7 +152,7 @@ RSpec.describe Asciidoctor::Iec do
148
152
  LITERAL
149
153
  ....
150
154
  INPUT
151
- #{BLANK_HDR}
155
+ #{@blank_hdr}
152
156
  <sections>
153
157
  <figure id="_">
154
158
  <pre id="_">LITERAL</pre>
@@ -163,7 +167,7 @@ RSpec.describe Asciidoctor::Iec do
163
167
  #{ASCIIDOC_BLANK_HDR}
164
168
  CAUTION: Only use paddy or parboiled rice for the determination of husked rice yield.
165
169
  INPUT
166
- #{BLANK_HDR}
170
+ #{@blank_hdr}
167
171
  <sections>
168
172
  <admonition id="_" type="caution">
169
173
  <p id="_">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
@@ -188,7 +192,7 @@ RSpec.describe Asciidoctor::Iec do
188
192
  . Celery makes them sad.
189
193
  ====
190
194
  INPUT
191
- #{BLANK_HDR}
195
+ #{@blank_hdr}
192
196
  <sections>
193
197
  <admonition id="_" type="safety precautions"><name>Safety Precautions</name><p id="_">While werewolves are hardy community members, keep in mind the following dietary concerns:</p>
194
198
  <ol id="_">
@@ -218,7 +222,7 @@ RSpec.describe Asciidoctor::Iec do
218
222
  [example]
219
223
  This is an example
220
224
  INPUT
221
- #{BLANK_HDR}
225
+ #{@blank_hdr}
222
226
  <sections>
223
227
  <terms id="_" obligation="normative">
224
228
  <title>Terms and definitions</title>
@@ -247,7 +251,7 @@ RSpec.describe Asciidoctor::Iec do
247
251
  Amen
248
252
  ====
249
253
  INPUT
250
- #{BLANK_HDR}
254
+ #{@blank_hdr}
251
255
  <sections>
252
256
  <example id="_"><p id="_">This is an example</p>
253
257
  <p id="_">Amen</p></example>
@@ -263,7 +267,7 @@ RSpec.describe Asciidoctor::Iec do
263
267
 
264
268
  == Section 1
265
269
  INPUT
266
- #{BLANK_HDR}
270
+ #{@blank_hdr}
267
271
  <preface><foreword id="_" obligation="informative">
268
272
  <title>FOREWORD</title>
269
273
  <p id="_">This is a preamble</p>
@@ -282,7 +286,7 @@ RSpec.describe Asciidoctor::Iec do
282
286
  image::spec/examples/rice_images/rice_image1.png[]
283
287
 
284
288
  INPUT
285
- #{BLANK_HDR}
289
+ #{@blank_hdr}
286
290
  <sections>
287
291
  <figure id="_">
288
292
  <name>Split-it-right sample divider</name>
@@ -300,7 +304,7 @@ RSpec.describe Asciidoctor::Iec do
300
304
  image::spec/examples/rice_images/rice_image1.png[]
301
305
 
302
306
  INPUT
303
- #{BLANK_HDR}
307
+ #{@blank_hdr}
304
308
  <sections>
305
309
  <figure id="_">
306
310
  <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="4" width="3"/>
@@ -317,7 +321,7 @@ RSpec.describe Asciidoctor::Iec do
317
321
  image::spec/examples/rice_images/rice_image1.png[]
318
322
 
319
323
  INPUT
320
- #{BLANK_HDR}
324
+ #{@blank_hdr}
321
325
  <sections>
322
326
  <figure id="_">
323
327
  <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="4" width="auto"/>
@@ -333,7 +337,7 @@ RSpec.describe Asciidoctor::Iec do
333
337
  [align=right]
334
338
  This para is right-aligned.
335
339
  INPUT
336
- #{BLANK_HDR}
340
+ #{@blank_hdr}
337
341
  <sections>
338
342
  <p align="right" id="_">This para is right-aligned.</p>
339
343
  </sections>
@@ -349,7 +353,7 @@ RSpec.describe Asciidoctor::Iec do
349
353
  Block quotation
350
354
  ____
351
355
  INPUT
352
- #{BLANK_HDR}
356
+ #{@blank_hdr}
353
357
  <sections>
354
358
  <quote id="_">
355
359
  <source type="inline" bibitemid="ISO7301" citeas=""><localityStack><locality type="section"><referenceFrom>1</referenceFrom></locality></localityStack></source>
@@ -372,7 +376,7 @@ RSpec.describe Asciidoctor::Iec do
372
376
  end
373
377
  --
374
378
  INPUT
375
- #{BLANK_HDR}
379
+ #{@blank_hdr}
376
380
  <sections>
377
381
  <sourcecode lang="ruby" id="_">puts "Hello, world."
378
382
  %w{a b c}.each do |x|
@@ -396,7 +400,7 @@ RSpec.describe Asciidoctor::Iec do
396
400
  <1> This is one callout
397
401
  <2> This is another callout
398
402
  INPUT
399
- #{BLANK_HDR}
403
+ #{@blank_hdr}
400
404
  <sections><sourcecode lang="ruby" id="_">puts "Hello, world." <callout target="_">1</callout>
401
405
  %w{a b c}.each do |x|
402
406
  puts x <callout target="_">2</callout>
@@ -420,7 +424,7 @@ RSpec.describe Asciidoctor::Iec do
420
424
  [.source]
421
425
  <<ISO2191,section=1>>
422
426
  INPUT
423
- #{BLANK_HDR}
427
+ #{@blank_hdr}
424
428
  <sections>
425
429
  <terms id="_" obligation="normative">
426
430
  <title>Terms and definitions</title>
@@ -452,7 +456,7 @@ RSpec.describe Asciidoctor::Iec do
452
456
  [.source]
453
457
  <<ISO2191,section=1>>, with adjustments
454
458
  INPUT
455
- #{BLANK_HDR}
459
+ #{@blank_hdr}
456
460
  <sections>
457
461
  <terms id="_" obligation="normative">
458
462
  <title>Terms and definitions</title>
@@ -1,12 +1,92 @@
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
7
+
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")
10
+ #{ASCIIDOC_BLANK_HDR}
11
+ == {blank}
12
+
13
+ [NOTE]
14
+ .Note from TC/SC Officers
15
+ ====
16
+ This FDIS is the result of the discussion between the IEC SC21A experts WG 3 during the meeting held in
17
+ Chicago (USA) on April 9th
18
+
19
+ This document is also of interest for ISO/ TC114/ WG1 Requirements for Watch batteries
20
+ ====
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>
81
+ OUTPUT
82
+ end
83
+
4
84
  it "removes empty text elements" do
5
85
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
86
  #{ASCIIDOC_BLANK_HDR}
7
87
  == {blank}
8
88
  INPUT
9
- #{BLANK_HDR}
89
+ #{@blank_hdr}
10
90
  <sections>
11
91
  <clause id="_" inline-header="false" obligation="normative">
12
92
 
@@ -27,7 +107,7 @@ RSpec.describe Asciidoctor::Iec do
27
107
 
28
108
  Time
29
109
  INPUT
30
- #{BLANK_HDR}
110
+ #{@blank_hdr}
31
111
  <sections>
32
112
  <terms id="_" obligation="normative">
33
113
  <title>Terms and definitions</title>
@@ -75,7 +155,7 @@ RSpec.describe Asciidoctor::Iec do
75
155
 
76
156
  This paragraph is extraneous
77
157
  INPUT
78
- #{BLANK_HDR}
158
+ #{@blank_hdr}
79
159
  <sections>
80
160
  <terms id="_" obligation="normative">
81
161
  <title>Terms and definitions</title>
@@ -117,7 +197,7 @@ RSpec.describe Asciidoctor::Iec do
117
197
 
118
198
  This paragraph is extraneous
119
199
  INPUT
120
- #{BLANK_HDR}
200
+ #{@blank_hdr}
121
201
  <sections>
122
202
  <terms id="_" obligation="normative"><title>Terms and definitions</title>
123
203
  <p id="_">For the purposes of this document,
@@ -147,7 +227,7 @@ RSpec.describe Asciidoctor::Iec do
147
227
  == Clause
148
228
  * [[[iso216,ISO 216]]], _Reference_
149
229
  INPUT
150
- #{BLANK_HDR}
230
+ #{@blank_hdr}
151
231
  <preface>
152
232
  <foreword id="_" obligation="informative">
153
233
  <title>FOREWORD</title>
@@ -184,7 +264,7 @@ RSpec.describe Asciidoctor::Iec do
184
264
  [.source]
185
265
  <<ISO2191,section=1>>
186
266
  INPUT
187
- #{BLANK_HDR}
267
+ #{@blank_hdr}
188
268
  <sections>
189
269
  <terms id="_" obligation="normative">
190
270
  <title>Terms and definitions</title>
@@ -216,7 +296,7 @@ RSpec.describe Asciidoctor::Iec do
216
296
 
217
297
  * [[[iso216,ISO 216]]], _Reference_
218
298
  INPUT
219
- #{BLANK_HDR}
299
+ #{@blank_hdr}
220
300
  <sections></sections>
221
301
  <bibliography><references id="_" obligation="informative" normative="true"><title>Normative references</title>
222
302
  <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
@@ -243,7 +323,7 @@ RSpec.describe Asciidoctor::Iec do
243
323
  #{ASCIIDOC_BLANK_HDR}
244
324
  Paragraph
245
325
  INPUT
246
- #{BLANK_HDR}
326
+ #{@blank_hdr}
247
327
  <sections>
248
328
  <p id="_">Paragraph</p>
249
329
  </sections>
@@ -259,7 +339,7 @@ RSpec.describe Asciidoctor::Iec do
259
339
  NOTE: This note has no ID
260
340
  ====
261
341
  INPUT
262
- #{BLANK_HDR}
342
+ #{@blank_hdr}
263
343
  <sections>
264
344
  <example id="_">
265
345
  <note id="_">
@@ -280,7 +360,7 @@ RSpec.describe Asciidoctor::Iec do
280
360
 
281
361
  footnote:[This is another footnote to a figure]
282
362
  INPUT
283
- #{BLANK_HDR}
363
+ #{@blank_hdr}
284
364
  <sections><figure id="_">
285
365
  <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
286
366
  <fn reference="a">
@@ -307,7 +387,7 @@ RSpec.describe Asciidoctor::Iec do
307
387
 
308
388
  Text
309
389
  INPUT
310
- #{BLANK_HDR}
390
+ #{@blank_hdr}
311
391
  <sections><clause id="_" inline-header="false" obligation="normative">
312
392
  <title>Clause</title>
313
393
  <p id="_">Text</p>
@@ -349,7 +429,7 @@ RSpec.describe Asciidoctor::Iec do
349
429
  ====== Clause 5B
350
430
 
351
431
  INPUT
352
- #{BLANK_HDR}
432
+ #{@blank_hdr}
353
433
  <sections>
354
434
  <clause id="_" inline-header="false" obligation="normative">
355
435
  <title>Clause1</title>
@@ -2,6 +2,12 @@ require "spec_helper"
2
2
  require "fileutils"
3
3
 
4
4
  RSpec.describe Asciidoctor::Iec do
5
+ before(:all) do
6
+ @boilerplate = boilerplate(Nokogiri::XML(BLANK_HDR + "</iec-standard>"))
7
+ end
8
+
9
+
10
+
5
11
  it "generates reference boilerplate for IEV" do
6
12
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
7
13
  = Document title
@@ -43,7 +49,7 @@ RSpec.describe Asciidoctor::Iec do
43
49
  <substage abbreviation="PPUB">60</substage>
44
50
  </status>
45
51
  <copyright>
46
- <from>2020</from>
52
+ <from>#{Time.now.year}</from>
47
53
  <owner>
48
54
  <organization>
49
55
  <name>International Electrotechnical Commission</name>
@@ -65,7 +71,7 @@ RSpec.describe Asciidoctor::Iec do
65
71
  <stagename>International standard</stagename>
66
72
  </ext>
67
73
  </bibdata>
68
- #{BOILERPLATE}
74
+ #{@boilerplate}
69
75
  <sections> </sections>
70
76
  <bibliography>
71
77
  <references id='_' obligation='informative' normative="true">
@@ -122,7 +128,7 @@ INPUT
122
128
  <substage abbreviation="PPUB">60</substage>
123
129
  </status>
124
130
  <copyright>
125
- <from>2020</from>
131
+ <from>#{Time.now.year}</from>
126
132
  <owner>
127
133
  <organization>
128
134
  <name>International Electrotechnical Commission</name>
@@ -144,7 +150,7 @@ INPUT
144
150
  <stagename>International standard</stagename>
145
151
  </ext>
146
152
  </bibdata>
147
- #{BOILERPLATE}
153
+ #{@boilerplate}
148
154
  <sections>
149
155
  <clause id='_' obligation='normative'>
150
156
  <title>Terms and definitions</title>
@@ -201,7 +207,7 @@ OUTPUT
201
207
  <substage abbreviation='PPUB'>60</substage>
202
208
  </status>
203
209
  <copyright>
204
- <from>2020</from>
210
+ <from>#{Time.now.year}</from>
205
211
  <owner>
206
212
  <organization>
207
213
  <name>International Electrotechnical Commission</name>
@@ -223,7 +229,7 @@ OUTPUT
223
229
  <stagename>International standard</stagename>
224
230
  </ext>
225
231
  </bibdata>
226
- #{BOILERPLATE}
232
+ #{@boilerplate}
227
233
  <preface>
228
234
  <introduction id='_' obligation='informative'>
229
235
  <title>INTRODUCTION&lt;br/&gt;Principles and rules followed</title>
@@ -1,6 +1,10 @@
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
7
+
4
8
  it "processes inline_quoted formatting" do
5
9
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
10
  #{ASCIIDOC_BLANK_HDR}
@@ -19,7 +23,7 @@ RSpec.describe Asciidoctor::Iec do
19
23
  [strike]#strike#
20
24
  [smallcap]#smallcap#
21
25
  INPUT
22
- #{BLANK_HDR}
26
+ #{@blank_hdr}
23
27
  <sections>
24
28
  <em>emphasis</em>
25
29
  <strong>strong</strong>
@@ -56,7 +60,7 @@ RSpec.describe Asciidoctor::Iec do
56
60
 
57
61
  <<<
58
62
  INPUT
59
- #{BLANK_HDR}
63
+ #{@blank_hdr}
60
64
  <sections><p id="_">Line break<br/>
61
65
  line break</p>
62
66
  <hr/>
@@ -72,7 +76,7 @@ RSpec.describe Asciidoctor::Iec do
72
76
  http://example.com[]
73
77
  http://example.com[Link]
74
78
  INPUT
75
- #{BLANK_HDR}
79
+ #{@blank_hdr}
76
80
  <sections>
77
81
  <p id="_">mailto:fred@example.com
78
82
  <link target="http://example.com"/>
@@ -87,7 +91,7 @@ RSpec.describe Asciidoctor::Iec do
87
91
  #{ASCIIDOC_BLANK_HDR}
88
92
  Text [[bookmark]] Text
89
93
  INPUT
90
- #{BLANK_HDR}
94
+ #{@blank_hdr}
91
95
  <sections>
92
96
  <p id="_">Text <bookmark id="bookmark"/> Text</p>
93
97
  </sections>
@@ -106,7 +110,7 @@ RSpec.describe Asciidoctor::Iec do
106
110
  Inline Reference with Text to <<reference,text>>
107
111
  Footnoted Reference with Text to <<reference,fn: text>>
108
112
  INPUT
109
- #{BLANK_HDR}
113
+ #{@blank_hdr}
110
114
  <sections>
111
115
  <clause id="reference" inline-header="false" obligation="normative">
112
116
  <title>Section</title>
@@ -130,7 +134,7 @@ RSpec.describe Asciidoctor::Iec do
130
134
  * [[[ISO713]]] Reference
131
135
 
132
136
  INPUT
133
- #{BLANK_HDR}
137
+ #{@blank_hdr}
134
138
  <sections>
135
139
 
136
140
  </sections><bibliography><references id="_" obligation="informative" normative="true">
@@ -156,7 +160,7 @@ RSpec.describe Asciidoctor::Iec do
156
160
  #{ASCIIDOC_BLANK_HDR}
157
161
  Hello!footnote:[Footnote text]
158
162
  INPUT
159
- #{BLANK_HDR}
163
+ #{@blank_hdr}
160
164
  <sections>
161
165
  <p id="_">Hello!<fn reference="1">
162
166
  <p id="_">Footnote text</p>