metanorma-iec 1.2.17 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +12 -11
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +3 -7
  5. data/lib/asciidoctor/iec/biblio.rng +1 -0
  6. data/lib/asciidoctor/iec/front.rb +11 -5
  7. data/lib/asciidoctor/iec/iec.rng +4 -0
  8. data/lib/asciidoctor/iec/iec_intro_en.xml +1 -1
  9. data/lib/asciidoctor/iec/isodoc.rng +321 -4
  10. data/lib/asciidoctor/iec/isostandard.rng +12 -0
  11. data/lib/isodoc/iec/html/htmlstyle.css +7 -0
  12. data/lib/isodoc/iec/html_convert.rb +0 -1
  13. data/lib/isodoc/iec/iec.international-standard.xsl +503 -67
  14. data/lib/metanorma/iec/version.rb +1 -1
  15. data/metanorma-iec.gemspec +4 -4
  16. data/spec/asciidoctor/base_spec.rb +1062 -0
  17. data/spec/{asciidoctor-iec → asciidoctor}/blocks_spec.rb +214 -154
  18. data/spec/{asciidoctor-iec → asciidoctor}/cleanup_spec.rb +0 -0
  19. data/spec/{asciidoctor-iec → asciidoctor}/iev_spec.rb +0 -0
  20. data/spec/{asciidoctor-iec → asciidoctor}/inline_spec.rb +0 -0
  21. data/spec/{asciidoctor-iec → asciidoctor}/lists_spec.rb +0 -0
  22. data/spec/{asciidoctor-iec → asciidoctor}/section_spec.rb +0 -38
  23. data/spec/{asciidoctor-iec → asciidoctor}/validate_spec.rb +0 -0
  24. data/spec/isodoc/postproc_spec.rb +2 -20
  25. metadata +44 -53
  26. data/spec/asciidoctor-iec/base_spec.rb +0 -1045
  27. data/spec/examples/rice.adoc +0 -723
  28. data/spec/examples/rice.doc +0 -19162
  29. data/spec/examples/rice.html +0 -1787
  30. data/spec/examples/rice.xml +0 -1951
  31. data/spec/examples/rice_img/rice_image1.png +0 -0
  32. data/spec/examples/rice_img/rice_image2.png +0 -0
  33. data/spec/examples/rice_img/rice_image3_1.png +0 -0
  34. data/spec/examples/rice_img/rice_image3_2.png +0 -0
  35. data/spec/examples/rice_img/rice_image3_3.png +0 -0
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "1.2.17"
3
+ VERSION = "1.3.4".freeze
4
4
  end
5
5
  end
6
6
 
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
 
3
- lib = File.expand_path("../lib", __FILE__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require "metanorma/iec/version"
6
6
 
@@ -27,18 +27,18 @@ Gem::Specification.new do |spec|
27
27
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
28
28
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
29
29
 
30
+ spec.add_dependency "metanorma-iso", "~> 1.8.0"
30
31
  spec.add_dependency "ruby-jing"
31
- spec.add_dependency "metanorma-iso", "~> 1.7.0"
32
32
 
33
33
  spec.add_development_dependency "byebug"
34
- spec.add_development_dependency "sassc", "2.4.0"
35
34
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
36
35
  spec.add_development_dependency "guard", "~> 2.14"
37
36
  spec.add_development_dependency "guard-rspec", "~> 4.7"
37
+ spec.add_development_dependency "iev", "~> 0.2.0"
38
38
  spec.add_development_dependency "rake", "~> 13.0"
39
39
  spec.add_development_dependency "rspec", "~> 3.6"
40
40
  spec.add_development_dependency "rubocop", "~> 1.5.2"
41
+ spec.add_development_dependency "sassc", "2.4.0"
41
42
  spec.add_development_dependency "simplecov", "~> 0.15"
42
43
  spec.add_development_dependency "timecop", "~> 0.9"
43
- spec.add_development_dependency "iev", "~> 0.2.0"
44
44
  end
@@ -0,0 +1,1062 @@
1
+ require "spec_helper"
2
+ require "fileutils"
3
+
4
+ OPTIONS = [backend: :iec, header_footer: true].freeze
5
+
6
+ RSpec.describe Asciidoctor::Iec do
7
+ before(:all) do
8
+ @blank_hdr = blank_hdr_gen
9
+ end
10
+
11
+ it "has a version number" do
12
+ expect(Metanorma::Iec::VERSION).not_to be nil
13
+ end
14
+
15
+ it "processes a blank document" do
16
+ input = <<~INPUT
17
+ #{ASCIIDOC_BLANK_HDR}
18
+ INPUT
19
+ output = <<~OUTPUT
20
+ #{@blank_hdr}
21
+ <sections/>
22
+ </iec-standard>
23
+ OUTPUT
24
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
25
+ .to be_equivalent_to xmlpp(output)
26
+ end
27
+
28
+ it "converts a blank document" do
29
+ FileUtils.rm_f "test.doc"
30
+ FileUtils.rm_f "test.html"
31
+ FileUtils.rm_f "test.pdf"
32
+ input = <<~INPUT
33
+ = Document title
34
+ Author
35
+ :docfile: test.adoc
36
+ :novalid:
37
+ :no-isobib:
38
+ INPUT
39
+ output = <<~OUTPUT
40
+ #{@blank_hdr}
41
+ <sections/>
42
+ </iec-standard>
43
+ OUTPUT
44
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
45
+ .to be_equivalent_to xmlpp(output)
46
+ expect(File.exist?("test.pdf")).to be true
47
+ expect(File.exist?("test.html")).to be true
48
+ expect(File.exist?("test.doc")).to be true
49
+ expect(File.exist?("htmlstyle.css")).to be false
50
+ end
51
+
52
+ it "processes default metadata" do
53
+ input = <<~INPUT
54
+ = Document title
55
+ Author
56
+ :docfile: test.adoc
57
+ :nodoc:
58
+ :novalid:
59
+ :no-isobib:
60
+ :docnumber: 1000
61
+ :partnumber: 1
62
+ :edition: 2
63
+ :revdate: 2000-01-01
64
+ :draft: 0.3.4
65
+ :technical-committee: TC
66
+ :technical-committee-number: 1
67
+ :technical-committee-type: A
68
+ :subcommittee: SC
69
+ :subcommittee-number: 2
70
+ :subcommittee-type: B
71
+ :workgroup: WG
72
+ :workgroup-number: 3
73
+ :workgroup-type: C
74
+ :technical-committee_2: TC1
75
+ :technical-committee-number_2: 11
76
+ :technical-committee-type_2: A1
77
+ :subcommittee_2: SC1
78
+ :subcommittee-number_2: 21
79
+ :subcommittee-type_2: B1
80
+ :workgroup_2: WG1
81
+ :workgroup-number_2: 31
82
+ :workgroup-type_2: C1
83
+ :secretariat: SECRETARIAT
84
+ :docstage: 10
85
+ :docsubstage: 20
86
+ :iteration: 3
87
+ :language: en
88
+ :title-intro-en: Introduction
89
+ :title-main-en: Main Title -- Title
90
+ :title-part-en: Title Part
91
+ :title-intro-fr: Introduction Française
92
+ :title-main-fr: Titre Principal
93
+ :title-part-fr: Part du Titre
94
+ :library-ics: 1,2,3
95
+ :accessibility-color-inside: true
96
+ :price-code: XC
97
+ :cen-processing: true
98
+ :secretary: Fred Nerk
99
+ :interest-to-committees: TC 6121, SC 12
100
+ :obsoletes: ABC; DEF
101
+ INPUT
102
+ output = <<~OUTPUT
103
+ <?xml version="1.0" encoding="UTF-8"?>
104
+ <iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
105
+ <bibdata type='standard'>
106
+ <title language='en' format='text/plain' type='main'>
107
+ Introduction&#8201;&#8212;&#8201;Main
108
+ Title&#8201;&#8212;&#8201;Title&#8201;&#8212;&#8201;Title Part
109
+ </title>
110
+ <title language='en' format='text/plain' type='title-intro'>Introduction</title>
111
+ <title language='en' format='text/plain' type='title-main'>Main Title&#8201;&#8212;&#8201;Title</title>
112
+ <title language='en' format='text/plain' type='title-part'>Title Part</title>
113
+ <title language='fr' format='text/plain' type='main'>
114
+ Introduction Fran&#231;aise&#8201;&#8212;&#8201;Titre
115
+ Principal&#8201;&#8212;&#8201;Part du Titre
116
+ </title>
117
+ <title language='fr' format='text/plain' type='title-intro'>Introduction Fran&#231;aise</title>
118
+ <title language='fr' format='text/plain' type='title-main'>Titre Principal</title>
119
+ <title language='fr' format='text/plain' type='title-part'>Part du Titre</title>
120
+ <docidentifier type='ISO'>IEC/3NWIP 1000-1 ED 2</docidentifier>
121
+ <docnumber>1000</docnumber>
122
+ <contributor>
123
+ <role type='author'/>
124
+ <organization>
125
+ <name>International Electrotechnical Commission</name>
126
+ <abbreviation>IEC</abbreviation>
127
+ </organization>
128
+ </contributor>
129
+ <contributor>
130
+ <role type='publisher'/>
131
+ <organization>
132
+ <name>International Electrotechnical Commission</name>
133
+ <abbreviation>IEC</abbreviation>
134
+ </organization>
135
+ </contributor>
136
+ <edition>2</edition>
137
+ <version>
138
+ <revision-date>2000-01-01</revision-date>
139
+ <draft>0.3.4</draft>
140
+ </version>
141
+ <language>en</language>
142
+ <script>Latn</script>
143
+ <status>
144
+ <stage abbreviation='NWIP'>10</stage>
145
+ <substage abbreviation='??'>20</substage>
146
+ <iteration>3</iteration>
147
+ </status>
148
+ <copyright>
149
+ <from>#{Date.today.year}</from>
150
+ <owner>
151
+ <organization>
152
+ <name>International Electrotechnical Commission</name>
153
+ <abbreviation>IEC</abbreviation>
154
+ </organization>
155
+ </owner>
156
+ </copyright>
157
+ <relation type='obsoletes'>
158
+ <bibitem>
159
+ <title>--</title>
160
+ <docidentifier>ABC</docidentifier>
161
+ </bibitem>
162
+ </relation>
163
+ <relation type='obsoletes'>
164
+ <bibitem>
165
+ <title>--</title>
166
+ <docidentifier>DEF</docidentifier>
167
+ </bibitem>
168
+ </relation>
169
+ <ext>
170
+ <doctype>article</doctype>
171
+ <horizontal>false</horizontal>
172
+ <editorialgroup>
173
+ <technical-committee number='1' type='A'>TC</technical-committee>
174
+ <technical-committee number='11' type='A1'>TC1</technical-committee>
175
+ <subcommittee number='2' type='B'>SC</subcommittee>
176
+ <subcommittee number='21' type='B1'>SC1</subcommittee>
177
+ <workgroup number='3' type='C'>WG</workgroup>
178
+ <workgroup number='31' type='C1'>WG1</workgroup>
179
+ <secretariat>SECRETARIAT</secretariat>
180
+ </editorialgroup>
181
+ <ics>
182
+ <code>1</code>
183
+ </ics>
184
+ <ics>
185
+ <code>2</code>
186
+ </ics>
187
+ <ics>
188
+ <code>3</code>
189
+ </ics>
190
+ <structuredidentifier>
191
+ <project-number part='1'>IEC 1000</project-number>
192
+ </structuredidentifier>
193
+ <stagename>New work item proposal</stagename>
194
+ <accessibility-color-inside>true</accessibility-color-inside>
195
+ <price-code>XC</price-code>
196
+ <cen-processing>true</cen-processing>
197
+ <secretary>Fred Nerk</secretary>
198
+ <interest-to-committees>TC 6121, SC 12</interest-to-committees>
199
+ </ext>
200
+ </bibdata>
201
+ <boilerplate>
202
+ <copyright-statement>
203
+ <clause>
204
+ <p id='_'>
205
+ <strong>Copyright &#169; #{Date.today.year} International Electrotechnical Commission, IEC.</strong>
206
+ All rights reserved. It is permitted to download this electronic
207
+ file, to make a copy and to print out the content for the sole purpose
208
+ of preparing National Committee positions. You may not copy or
209
+ &#8220;mirror&#8221; the file or printed version of the document, or
210
+ any part of it, for any other purpose without permission in writing
211
+ from IEC.
212
+ </p>
213
+ </clause>
214
+ </copyright-statement>
215
+ <legal-statement>
216
+ <clause>
217
+ <ol id='_'>
218
+ <li>
219
+ <p id='_'>
220
+ The International Electrotechnical Commission (IEC) is a worldwide
221
+ organization for standardization comprising all national
222
+ electrotechnical committees (IEC National Committees). The object
223
+ of IEC is to promote international co-operation on all questions
224
+ concerning standardization in the electrical and electronic
225
+ fields. To this end and in addition to other activities, IEC
226
+ publishes International Standards, Technical Specifications,
227
+ Technical Reports, Publicly Available Specifications (PAS) and
228
+ Guides (hereafter referred to as &#8220;IEC
229
+ Publication(s)&#8221;). Their preparation is entrusted to
230
+ technical committees; any IEC National Committee interested in the
231
+ subject dealt with may participate in this preparatory work.
232
+ International, governmental and non-governmental organizations
233
+ liaising with the IEC also participate in this preparation. IEC
234
+ collaborates closely with the International Organization for
235
+ Standardization (ISO) in accordance with conditions determined by
236
+ agreement between the two organizations.
237
+ </p>
238
+ </li>
239
+ <li>
240
+ <p id='_'>
241
+ The formal decisions or agreements of IEC on technical matters
242
+ express, as nearly as possible, an international consensus of
243
+ opinion on the relevant subjects since each technical committee
244
+ has representation from all interested IEC National Committees.
245
+ </p>
246
+ </li>
247
+ <li>
248
+ <p id='_'>
249
+ IEC Publications have the form of recommendations for
250
+ international use and are accepted by IEC National Committees in
251
+ that sense. While all reasonable efforts are made to ensure that
252
+ the technical content of IEC Publications is accurate, IEC cannot
253
+ be held responsible for the way in which they are used or for any
254
+ misinterpretation by any end user.
255
+ </p>
256
+ </li>
257
+ <li>
258
+ <p id='_'>
259
+ In order to promote international uniformity, IEC National
260
+ Committees undertake to apply IEC Publications transparently to
261
+ the maximum extent possible in their national and regional
262
+ publications. Any divergence between any IEC Publication and the
263
+ corresponding national or regional publication shall be clearly
264
+ indicated in the latter.
265
+ </p>
266
+ </li>
267
+ <li>
268
+ <p id='_'>
269
+ IEC itself does not provide any attestation of conformity.
270
+ Independent certification bodies provide conformity assessment
271
+ services and, in some areas, access to IEC marks of conformity.
272
+ IEC is not responsible for any services carried out by independent
273
+ certification bodies.
274
+ </p>
275
+ </li>
276
+ <li>
277
+ <p id='_'>All users should ensure that they have the latest edition of this publication.</p>
278
+ </li>
279
+ <li>
280
+ <p id='_'>
281
+ No liability shall attach to IEC or its directors, employees,
282
+ servants or agents including individual experts and members of its
283
+ technical committees and IEC National Committees for any personal
284
+ injury, property damage or other damage of any nature whatsoever,
285
+ whether direct or indirect, or for costs (including legal fees)
286
+ and expenses arising out of the publication, use of, or reliance
287
+ upon, this IEC Publication or any other IEC Publications.
288
+ </p>
289
+ </li>
290
+ <li>
291
+ <p id='_'>
292
+ Attention is drawn to the Normative references cited in this
293
+ publication. Use of the referenced publications is indispensable
294
+ for the correct application of this publication.
295
+ </p>
296
+ </li>
297
+ <li>
298
+ <p id='_'>
299
+ Attention is drawn to the possibility that some of the elements of
300
+ this IEC Publication may be the subject of patent rights. IEC
301
+ shall not be held responsible for identifying any or all such
302
+ patent rights.
303
+ </p>
304
+ </li>
305
+ </ol>
306
+ </clause>
307
+ </legal-statement>
308
+ <license-statement>
309
+ <clause>
310
+ <p id='_'>
311
+ This document is still under study and subject to change. It should
312
+ not be used for reference purposes. until published as such.
313
+ </p>
314
+ <p id='_'>
315
+ Recipients of this document are invited to submit, with their
316
+ comments, notification of any relevant patent rights of which they are
317
+ aware and to provide supporting documentation.
318
+ </p>
319
+ </clause>
320
+ </license-statement>
321
+ <feedback-statement>
322
+ <clause id='boilerplate-cenelec-attention'>
323
+ <title>Attention IEC-CENELEC parallel voting</title>
324
+ <p id='_'>
325
+ The attention of IEC National Committees, members of CENELEC, is drawn
326
+ to the fact that this (NWIP) is submitted for parallel voting.
327
+ </p>
328
+ <p id='_'>The CENELEC members are invited to vote through the CENELEC voting system.</p>
329
+ </clause>
330
+ </feedback-statement>
331
+ </boilerplate>
332
+ <sections> </sections>
333
+ </iec-standard>
334
+ OUTPUT
335
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
336
+ .to be_equivalent_to xmlpp(output)
337
+ end
338
+
339
+ it "processes complex metadata" do
340
+ input = <<~INPUT
341
+ = Document title
342
+ Author
343
+ :docfile: test.adoc
344
+ :nodoc:
345
+ :novalid:
346
+ :no-isobib:
347
+ :docnumber: 1000
348
+ :partnumber: 1-1
349
+ :tc-docnumber: 2000
350
+ :language: el
351
+ :script: Grek
352
+ :publisher: IEC;IETF;ISO
353
+ :copyright-year: 2001
354
+ :docstage: A2CD
355
+ :doctype: technical-specification
356
+ :function: emc
357
+ :horizontal: true
358
+ INPUT
359
+ output = <<~OUTPUT
360
+ <?xml version="1.0" encoding="UTF-8"?>
361
+ <iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
362
+ <bibdata type='standard'>
363
+ <docidentifier type='ISO'>ISO/IEC/IETF/2CDTS 1000-1-1 ED 1</docidentifier>
364
+ <docidentifier type='iso-tc'>2000</docidentifier>
365
+ <docnumber>1000</docnumber>
366
+ <contributor>
367
+ <role type='author'/>
368
+ <organization>
369
+ <name>International Electrotechnical Commission</name>
370
+ <abbreviation>IEC</abbreviation>
371
+ </organization>
372
+ </contributor>
373
+ <contributor>
374
+ <role type='author'/>
375
+ <organization>
376
+ <name>IETF</name>
377
+ </organization>
378
+ </contributor>
379
+ <contributor>
380
+ <role type='author'/>
381
+ <organization>
382
+ <name>International Organization for Standardization</name>
383
+ <abbreviation>ISO</abbreviation>
384
+ </organization>
385
+ </contributor>
386
+ <contributor>
387
+ <role type='publisher'/>
388
+ <organization>
389
+ <name>International Electrotechnical Commission</name>
390
+ <abbreviation>IEC</abbreviation>
391
+ </organization>
392
+ </contributor>
393
+ <contributor>
394
+ <role type='publisher'/>
395
+ <organization>
396
+ <name>IETF</name>
397
+ </organization>
398
+ </contributor>
399
+ <contributor>
400
+ <role type='publisher'/>
401
+ <organization>
402
+ <name>International Organization for Standardization</name>
403
+ <abbreviation>ISO</abbreviation>
404
+ </organization>
405
+ </contributor>
406
+ <language>el</language>
407
+ <script>Grek</script>
408
+ <status>
409
+ <stage abbreviation='CD'>30</stage>
410
+ <substage abbreviation='A22CD'>99</substage>
411
+ <iteration>2</iteration>
412
+ </status>
413
+ <copyright>
414
+ <from>2001</from>
415
+ <owner>
416
+ <organization>
417
+ <name>International Electrotechnical Commission</name>
418
+ <abbreviation>IEC</abbreviation>
419
+ </organization>
420
+ </owner>
421
+ </copyright>
422
+ <copyright>
423
+ <from>2001</from>
424
+ <owner>
425
+ <organization>
426
+ <name>IETF</name>
427
+ </organization>
428
+ </owner>
429
+ </copyright>
430
+ <copyright>
431
+ <from>2001</from>
432
+ <owner>
433
+ <organization>
434
+ <name>International Organization for Standardization</name>
435
+ <abbreviation>ISO</abbreviation>
436
+ </organization>
437
+ </owner>
438
+ </copyright>
439
+ <ext>
440
+ <doctype>technical-specification</doctype>
441
+ <horizontal>true</horizontal>
442
+ <function>emc</function>
443
+ <editorialgroup>
444
+ <technical-committee/>
445
+ <subcommittee/>
446
+ <workgroup/>
447
+ </editorialgroup>
448
+ <structuredidentifier>
449
+ <project-number part='1' subpart='1'>ISO/IEC/IETF 1000</project-number>
450
+ </structuredidentifier>
451
+ <stagename>Committee draft</stagename>
452
+ </ext>
453
+ </bibdata>
454
+ <boilerplate>
455
+ <copyright-statement>
456
+ <clause>
457
+ <p id='_'>
458
+ <strong>Copyright &#169; 2001 International Electrotechnical Commission, IEC.</strong>
459
+ All rights reserved. It is permitted to download this electronic
460
+ file, to make a copy and to print out the content for the sole purpose
461
+ of preparing National Committee positions. You may not copy or
462
+ &#8220;mirror&#8221; the file or printed version of the document, or
463
+ any part of it, for any other purpose without permission in writing
464
+ from IEC.
465
+ </p>
466
+ </clause>
467
+ </copyright-statement>
468
+ <legal-statement>
469
+ <clause>
470
+ <ol id='_'>
471
+ <li>
472
+ <p id='_'>
473
+ The International Electrotechnical Commission (IEC) is a worldwide
474
+ organization for standardization comprising all national
475
+ electrotechnical committees (IEC National Committees). The object
476
+ of IEC is to promote international co-operation on all questions
477
+ concerning standardization in the electrical and electronic
478
+ fields. To this end and in addition to other activities, IEC
479
+ publishes International Standards, Technical Specifications,
480
+ Technical Reports, Publicly Available Specifications (PAS) and
481
+ Guides (hereafter referred to as &#8220;IEC
482
+ Publication(s)&#8221;). Their preparation is entrusted to
483
+ technical committees; any IEC National Committee interested in the
484
+ subject dealt with may participate in this preparatory work.
485
+ International, governmental and non-governmental organizations
486
+ liaising with the IEC also participate in this preparation. IEC
487
+ collaborates closely with the International Organization for
488
+ Standardization (ISO) in accordance with conditions determined by
489
+ agreement between the two organizations.
490
+ </p>
491
+ </li>
492
+ <li>
493
+ <p id='_'>
494
+ The formal decisions or agreements of IEC on technical matters
495
+ express, as nearly as possible, an international consensus of
496
+ opinion on the relevant subjects since each technical committee
497
+ has representation from all interested IEC National Committees.
498
+ </p>
499
+ </li>
500
+ <li>
501
+ <p id='_'>
502
+ IEC Publications have the form of recommendations for
503
+ international use and are accepted by IEC National Committees in
504
+ that sense. While all reasonable efforts are made to ensure that
505
+ the technical content of IEC Publications is accurate, IEC cannot
506
+ be held responsible for the way in which they are used or for any
507
+ misinterpretation by any end user.
508
+ </p>
509
+ </li>
510
+ <li>
511
+ <p id='_'>
512
+ In order to promote international uniformity, IEC National
513
+ Committees undertake to apply IEC Publications transparently to
514
+ the maximum extent possible in their national and regional
515
+ publications. Any divergence between any IEC Publication and the
516
+ corresponding national or regional publication shall be clearly
517
+ indicated in the latter.
518
+ </p>
519
+ </li>
520
+ <li>
521
+ <p id='_'>
522
+ IEC itself does not provide any attestation of conformity.
523
+ Independent certification bodies provide conformity assessment
524
+ services and, in some areas, access to IEC marks of conformity.
525
+ IEC is not responsible for any services carried out by independent
526
+ certification bodies.
527
+ </p>
528
+ </li>
529
+ <li>
530
+ <p id='_'>All users should ensure that they have the latest edition of this publication.</p>
531
+ </li>
532
+ <li>
533
+ <p id='_'>
534
+ No liability shall attach to IEC or its directors, employees,
535
+ servants or agents including individual experts and members of its
536
+ technical committees and IEC National Committees for any personal
537
+ injury, property damage or other damage of any nature whatsoever,
538
+ whether direct or indirect, or for costs (including legal fees)
539
+ and expenses arising out of the publication, use of, or reliance
540
+ upon, this IEC Publication or any other IEC Publications.
541
+ </p>
542
+ </li>
543
+ <li>
544
+ <p id='_'>
545
+ Attention is drawn to the Normative references cited in this
546
+ publication. Use of the referenced publications is indispensable
547
+ for the correct application of this publication.
548
+ </p>
549
+ </li>
550
+ <li>
551
+ <p id='_'>
552
+ Attention is drawn to the possibility that some of the elements of
553
+ this IEC Publication may be the subject of patent rights. IEC
554
+ shall not be held responsible for identifying any or all such
555
+ patent rights.
556
+ </p>
557
+ </li>
558
+ </ol>
559
+ </clause>
560
+ </legal-statement>
561
+ <license-statement>
562
+ <clause>
563
+ <p id='_'>
564
+ This document is still under study and subject to change. It should
565
+ not be used for reference purposes. until published as such.
566
+ </p>
567
+ <p id='_'>
568
+ Recipients of this document are invited to submit, with their
569
+ comments, notification of any relevant patent rights of which they are
570
+ aware and to provide supporting documentation.
571
+ </p>
572
+ </clause>
573
+ </license-statement>
574
+ <feedback-statement>
575
+ <clause id='boilerplate-cenelec-attention'>
576
+ <title>Attention IEC-CENELEC parallel voting</title>
577
+ <p id='_'>
578
+ The attention of IEC National Committees, members of CENELEC, is drawn
579
+ to the fact that this Committee Draft (CD) is submitted for parallel
580
+ voting.
581
+ </p>
582
+ <p id='_'>The CENELEC members are invited to vote through the CENELEC voting system.</p>
583
+ </clause>
584
+ </feedback-statement>
585
+ </boilerplate>
586
+ <sections> </sections>
587
+ </iec-standard>
588
+ OUTPUT
589
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
590
+ .to be_equivalent_to xmlpp(output)
591
+ end
592
+
593
+ it "processes boilerplate in English" do
594
+ doc = strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS))
595
+ = Document title
596
+ Author
597
+ :docfile: test.adoc
598
+ :nodoc:
599
+ :novalid:
600
+ :no-isobib:
601
+ :docnumber: 1000
602
+ :partnumber: 1-1
603
+ :tc-docnumber: 2000
604
+ :language: en
605
+ :script: Latn
606
+ :publisher: IEC,IETF,ISO
607
+ :copyright-year: 2001
608
+ INPUT
609
+ expect(doc).to include "including individual experts"
610
+ expect(doc).not_to include "y compris ses experts particuliers"
611
+ end
612
+
613
+ it "processes boilerplate in French" do
614
+ doc = strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS))
615
+ = Document title
616
+ Author
617
+ :docfile: test.adoc
618
+ :nodoc:
619
+ :novalid:
620
+ :no-isobib:
621
+ :docnumber: 1000
622
+ :partnumber: 1-1
623
+ :tc-docnumber: 2000
624
+ :language: fr
625
+ :script: Latn
626
+ :publisher: IEC,IETF,ISO
627
+ :copyright-year: 2001
628
+ INPUT
629
+ expect(doc).not_to include "including individual experts"
630
+ expect(doc).to include "y compris ses experts particuliers"
631
+ end
632
+
633
+ it "defaults substage" do
634
+ input = <<~INPUT
635
+ = Document title
636
+ Author
637
+ :docfile: test.adoc
638
+ :nodoc:
639
+ :novalid:
640
+ :no-isobib:
641
+ :docnumber: 1000
642
+ :docstage: 50
643
+ INPUT
644
+ output = <<~OUTPUT
645
+ <iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
646
+ <bibdata type="standard">
647
+ <docidentifier type="ISO">IEC/FDIS 1000 ED 1</docidentifier>
648
+ <docnumber>1000</docnumber>
649
+ <contributor>
650
+ <role type="author"/>
651
+ <organization>
652
+ <name>International Electrotechnical Commission</name>
653
+ <abbreviation>IEC</abbreviation>
654
+ </organization>
655
+ </contributor>
656
+ <contributor>
657
+ <role type="publisher"/>
658
+ <organization>
659
+ <name>International Electrotechnical Commission</name>
660
+ <abbreviation>IEC</abbreviation>
661
+ </organization>
662
+ </contributor>
663
+ <language>en</language>
664
+ <script>Latn</script>
665
+ <status>
666
+ <stage abbreviation="FDIS">50</stage>
667
+ <substage abbreviation="RFDIS">00</substage>
668
+ </status>
669
+ <copyright>
670
+ <from>#{Date.today.year}</from>
671
+ <owner>
672
+ <organization>
673
+ <name>International Electrotechnical Commission</name>
674
+ <abbreviation>IEC</abbreviation>
675
+ </organization>
676
+ </owner>
677
+ </copyright>
678
+ <ext>
679
+ <doctype>article</doctype>
680
+ <horizontal>false</horizontal>
681
+ <editorialgroup>
682
+ <technical-committee/>
683
+ <subcommittee/>
684
+ <workgroup/>
685
+ </editorialgroup>
686
+ <structuredidentifier>
687
+ <project-number>IEC 1000</project-number>
688
+ </structuredidentifier>
689
+ <stagename>Final draft international standard</stagename>
690
+ </ext>
691
+ </bibdata>
692
+ <boilerplate>
693
+ <copyright-statement>
694
+ <clause>
695
+ <p id='_'>
696
+ <strong>Copyright © #{Time.now.year} International Electrotechnical Commission, IEC.</strong>
697
+ All rights reserved. It is permitted to download this electronic
698
+ file, to make a copy and to print out the content for the sole purpose
699
+ of preparing National Committee positions. You may not copy or
700
+ “mirror” the file or printed version of the document, or any part of
701
+ it, for any other purpose without permission in writing from IEC.
702
+ </p>
703
+ </clause>
704
+ </copyright-statement>
705
+ <legal-statement>
706
+ <clause>
707
+ <ol id='_'>
708
+ <li>
709
+ <p id='_'>
710
+ The International Electrotechnical Commission (IEC) is a worldwide
711
+ organization for standardization comprising all national
712
+ electrotechnical committees (IEC National Committees). The object
713
+ of IEC is to promote international co-operation on all questions
714
+ concerning standardization in the electrical and electronic
715
+ fields. To this end and in addition to other activities, IEC
716
+ publishes International Standards, Technical Specifications,
717
+ Technical Reports, Publicly Available Specifications (PAS) and
718
+ Guides (hereafter referred to as “IEC Publication(s)”). Their
719
+ preparation is entrusted to technical committees; any IEC National
720
+ Committee interested in the subject dealt with may participate in
721
+ this preparatory work. International, governmental and
722
+ non-governmental organizations liaising with the IEC also
723
+ participate in this preparation. IEC collaborates closely with the
724
+ International Organization for Standardization (ISO) in accordance
725
+ with conditions determined by agreement between the two
726
+ organizations.
727
+ </p>
728
+ </li>
729
+ <li>
730
+ <p id='_'>
731
+ The formal decisions or agreements of IEC on technical matters
732
+ express, as nearly as possible, an international consensus of
733
+ opinion on the relevant subjects since each technical committee
734
+ has representation from all interested IEC National Committees.
735
+ </p>
736
+ </li>
737
+ <li>
738
+ <p id='_'>
739
+ IEC Publications have the form of recommendations for
740
+ international use and are accepted by IEC National Committees in
741
+ that sense. While all reasonable efforts are made to ensure that
742
+ the technical content of IEC Publications is accurate, IEC cannot
743
+ be held responsible for the way in which they are used or for any
744
+ misinterpretation by any end user.
745
+ </p>
746
+ </li>
747
+ <li>
748
+ <p id='_'>
749
+ In order to promote international uniformity, IEC National
750
+ Committees undertake to apply IEC Publications transparently to
751
+ the maximum extent possible in their national and regional
752
+ publications. Any divergence between any IEC Publication and the
753
+ corresponding national or regional publication shall be clearly
754
+ indicated in the latter.
755
+ </p>
756
+ </li>
757
+ <li>
758
+ <p id='_'>
759
+ IEC itself does not provide any attestation of conformity.
760
+ Independent certification bodies provide conformity assessment
761
+ services and, in some areas, access to IEC marks of conformity.
762
+ IEC is not responsible for any services carried out by independent
763
+ certification bodies.
764
+ </p>
765
+ </li>
766
+ <li>
767
+ <p id='_'>All users should ensure that they have the latest edition of this publication.</p>
768
+ </li>
769
+ <li>
770
+ <p id='_'>
771
+ No liability shall attach to IEC or its directors, employees,
772
+ servants or agents including individual experts and members of its
773
+ technical committees and IEC National Committees for any personal
774
+ injury, property damage or other damage of any nature whatsoever,
775
+ whether direct or indirect, or for costs (including legal fees)
776
+ and expenses arising out of the publication, use of, or reliance
777
+ upon, this IEC Publication or any other IEC Publications.
778
+ </p>
779
+ </li>
780
+ <li>
781
+ <p id='_'>
782
+ Attention is drawn to the Normative references cited in this
783
+ publication. Use of the referenced publications is indispensable
784
+ for the correct application of this publication.
785
+ </p>
786
+ </li>
787
+ <li>
788
+ <p id='_'>
789
+ Attention is drawn to the possibility that some of the elements of
790
+ this IEC Publication may be the subject of patent rights. IEC
791
+ shall not be held responsible for identifying any or all such
792
+ patent rights.
793
+ </p>
794
+ </li>
795
+ </ol>
796
+ </clause>
797
+ </legal-statement>
798
+ <license-statement>
799
+ <clause>
800
+ <p id='_'>
801
+ This document is a draft distributed for approval. It may not be
802
+ referred to as an International Standard until published as such.
803
+ </p>
804
+ <p id='_'>
805
+ In addition to their evaluation as being acceptable for industrial,
806
+ technological, commercial and user purposes, Final Draft International
807
+ Standards may on occasion have to be considered in the light of their
808
+ potential to become standards to which reference may be made in
809
+ national regulations.
810
+ </p>
811
+ <p id='_'>
812
+ Recipients of this document are invited to submit, with their
813
+ comments, notification of any relevant patent rights of which they are
814
+ aware and to provide supporting documentation.
815
+ </p>
816
+ </clause>
817
+ </license-statement>
818
+ <feedback-statement>
819
+ <clause id='boilerplate-cenelec-attention'>
820
+ <title>Attention IEC-CENELEC parallel voting</title>
821
+ <p id='_'>
822
+ The attention of IEC National Committees, members of CENELEC, is drawn
823
+ to the fact that this Final Draft International Standard (FDIS) is
824
+ submitted for parallel voting.
825
+ </p>
826
+ <p id='_'>The CENELEC members are invited to vote through the CENELEC voting system.</p>
827
+ </clause>
828
+ </feedback-statement>
829
+ </boilerplate>
830
+ <sections/>
831
+ </iec-standard>
832
+ OUTPUT
833
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
834
+ .to be_equivalent_to xmlpp(output)
835
+ end
836
+
837
+ it "defaults substage for stage 60" do
838
+ input = <<~INPUT
839
+ = Document title
840
+ Author
841
+ :docfile: test.adoc
842
+ :nodoc:
843
+ :novalid:
844
+ :no-isobib:
845
+ :docnumber: 1000
846
+ :docstage: 60
847
+ INPUT
848
+ output = <<~OUTPUT
849
+ <iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
850
+ <bibdata type="standard">
851
+ <docidentifier type="ISO">IEC 1000 ED 1</docidentifier>
852
+ <docnumber>1000</docnumber>
853
+ <contributor>
854
+ <role type="author"/>
855
+ <organization>
856
+ <name>International Electrotechnical Commission</name>
857
+ <abbreviation>IEC</abbreviation>
858
+ </organization>
859
+ </contributor>
860
+ <contributor>
861
+ <role type="publisher"/>
862
+ <organization>
863
+ <name>International Electrotechnical Commission</name>
864
+ <abbreviation>IEC</abbreviation>
865
+ </organization>
866
+ </contributor>
867
+ <language>en</language>
868
+ <script>Latn</script>
869
+ <status>
870
+ <stage abbreviation="PPUB">60</stage>
871
+ <substage abbreviation="PPUB">60</substage>
872
+ </status>
873
+ <copyright>
874
+ <from>#{Date.today.year}</from>
875
+ <owner>
876
+ <organization>
877
+ <name>International Electrotechnical Commission</name>
878
+ <abbreviation>IEC</abbreviation>
879
+ </organization>
880
+ </owner>
881
+ </copyright>
882
+ <ext>
883
+ <doctype>article</doctype>
884
+ <horizontal>false</horizontal>
885
+ <editorialgroup>
886
+ <technical-committee/>
887
+ <subcommittee/>
888
+ <workgroup/>
889
+ </editorialgroup>
890
+ <structuredidentifier>
891
+ <project-number>IEC 1000</project-number>
892
+ </structuredidentifier>
893
+ <stagename>International standard</stagename>
894
+ </ext>
895
+ </bibdata>
896
+ #{boilerplate(Nokogiri::XML(BLANK_HDR + '</iec-standard>'))}
897
+ <sections/>
898
+ </iec-standard>
899
+ OUTPUT
900
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
901
+ .to be_equivalent_to xmlpp(output)
902
+ end
903
+
904
+ it "populates metadata for PRF" do
905
+ input = <<~INPUT
906
+ = Document title
907
+ Author
908
+ :docfile: test.adoc
909
+ :nodoc:
910
+ :novalid:
911
+ :no-isobib:
912
+ :docnumber: 1000
913
+ :docstage: 60
914
+ :docsubstage: 00
915
+ INPUT
916
+ output = <<~OUTPUT
917
+ <iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
918
+ <bibdata type="standard">
919
+ <docidentifier type="ISO">IEC 1000 ED 1</docidentifier>
920
+ <docnumber>1000</docnumber>
921
+ <contributor>
922
+ <role type="author"/>
923
+ <organization>
924
+ <name>International Electrotechnical Commission</name>
925
+ <abbreviation>IEC</abbreviation>
926
+ </organization>
927
+ </contributor>
928
+ <contributor>
929
+ <role type="publisher"/>
930
+ <organization>
931
+ <name>International Electrotechnical Commission</name>
932
+ <abbreviation>IEC</abbreviation>
933
+ </organization>
934
+ </contributor>
935
+ <language>en</language>
936
+ <script>Latn</script>
937
+ <status>
938
+ <stage abbreviation="PPUB">60</stage>
939
+ <substage abbreviation="BPUB">00</substage>
940
+ </status>
941
+ <copyright>
942
+ <from>#{Date.today.year}</from>
943
+ <owner>
944
+ <organization>
945
+ <name>International Electrotechnical Commission</name>
946
+ <abbreviation>IEC</abbreviation>
947
+ </organization>
948
+ </owner>
949
+ </copyright>
950
+ <ext>
951
+ <doctype>article</doctype>
952
+ <horizontal>false</horizontal>
953
+ <editorialgroup>
954
+ <technical-committee/>
955
+ <subcommittee/>
956
+ <workgroup/>
957
+ </editorialgroup>
958
+ <structuredidentifier>
959
+ <project-number>IEC 1000</project-number>
960
+ </structuredidentifier>
961
+ <stagename>International standard</stagename>
962
+ </ext>
963
+ </bibdata>
964
+ #{boilerplate(Nokogiri::XML(BLANK_HDR + '</iec-standard>'))}
965
+ <sections/>
966
+ </iec-standard>
967
+ OUTPUT
968
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
969
+ .to be_equivalent_to xmlpp(output)
970
+ end
971
+
972
+ it "reads scripts into blank HTML document" do
973
+ FileUtils.rm_f "test.html"
974
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
975
+ = Document title
976
+ Author
977
+ :docfile: test.adoc
978
+ :novalid:
979
+ :no-isobib:
980
+ :no-pdf:
981
+ INPUT
982
+ html = File.read("test.html", encoding: "utf-8")
983
+ expect(html).to match(%r{<script>})
984
+ end
985
+
986
+ it "uses default fonts" do
987
+ FileUtils.rm_f "test.html"
988
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
989
+ = Document title
990
+ Author
991
+ :docfile: test.adoc
992
+ :novalid:
993
+ :no-isobib:
994
+ :no-pdf:
995
+ INPUT
996
+ html = File.read("test.html", encoding: "utf-8")
997
+ expect(html)
998
+ .to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
999
+ expect(html)
1000
+ .to match(%r[blockquote[^{]+\{[^{]+font-family: "Arial", sans-serif;]m)
1001
+ expect(html)
1002
+ .to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Arial", sans-serif;]m)
1003
+ end
1004
+
1005
+ it "uses Chinese fonts" do
1006
+ FileUtils.rm_f "test.html"
1007
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1008
+ = Document title
1009
+ Author
1010
+ :docfile: test.adoc
1011
+ :novalid:
1012
+ :no-isobib:
1013
+ :script: Hans
1014
+ :no-pdf:
1015
+ INPUT
1016
+ html = File.read("test.html", encoding: "utf-8")
1017
+ expect(html)
1018
+ .to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
1019
+ expect(html)
1020
+ .to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
1021
+ expect(html)
1022
+ .to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
1023
+ end
1024
+
1025
+ it "uses specified fonts" do
1026
+ FileUtils.rm_f "test.html"
1027
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1028
+ = Document title
1029
+ Author
1030
+ :docfile: test.adoc
1031
+ :novalid:
1032
+ :no-isobib:
1033
+ :script: Hans
1034
+ :body-font: Zapf Chancery
1035
+ :header-font: Comic Sans
1036
+ :monospace-font: Andale Mono
1037
+ :no-pdf:
1038
+ INPUT
1039
+ html = File.read("test.html", encoding: "utf-8")
1040
+ expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: Andale Mono;]m)
1041
+ expect(html)
1042
+ .to match(%r[blockquote[^{]+\{[^{]+font-family: Zapf Chancery;]m)
1043
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: Comic Sans;]m)
1044
+ end
1045
+
1046
+ it "strips MS-specific CSS" do
1047
+ FileUtils.rm_f "test.html"
1048
+ FileUtils.rm_f "test.doc"
1049
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1050
+ = Document title
1051
+ Author
1052
+ :docfile: test.adoc
1053
+ :novalid:
1054
+ :no-isobib:
1055
+ :no-pdf:
1056
+ INPUT
1057
+ word = File.read("test.doc", encoding: "utf-8")
1058
+ html = File.read("test.html", encoding: "utf-8")
1059
+ expect(word).to match(%r[mso-style-name: "Intro Title";]m)
1060
+ expect(html).not_to match(%r[mso-style-name: "Intro Title";]m)
1061
+ end
1062
+ end