metanorma-iec 1.2.15 → 1.3.2

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