metanorma-iec 2.1.1 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,69 +69,69 @@ RSpec.describe IsoDoc do
69
69
  INPUT
70
70
 
71
71
  presxml = <<~OUTPUT
72
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
73
- <preface>
74
- <foreword obligation="informative" displayorder="1">
75
- <title>Foreword</title>
76
- <p id="A">This is a preamble</p>
77
- </foreword>
78
- <introduction id="B" obligation="informative" displayorder="2"><title depth="1">0<tab/>Introduction</title><clause id="C" inline-header="false" obligation="informative">
79
- <title depth="2">0.1<tab/>Introduction Subsection</title>
80
- </clause>
81
- <p>This is patent boilerplate</p>
82
- </introduction></preface><sections>
83
- <clause id="D" obligation="normative" type="scope" displayorder="3">
84
- <title depth="1">1<tab/>Scope</title>
85
- <p id="E">Text</p>
86
- </clause>
87
-
88
- <clause id="H" obligation="normative" displayorder="5"><title depth="1">3<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
89
- <title depth="2">3.1<tab/>Normal Terms</title>
90
- <term id="J"><name>3.1.1</name>
91
- <preferred>Term2</preferred>
92
- </term>
93
- </terms>
94
- <definitions id="K"><title>3.2</title>
95
- <dl>
96
- <dt>Symbol</dt>
97
- <dd>Definition</dd>
98
- </dl>
99
- </definitions>
100
- </clause>
101
- <definitions id="L" displayorder="6"><title>4</title>
102
- <dl>
103
- <dt>Symbol</dt>
104
- <dd>Definition</dd>
105
- </dl>
106
- </definitions>
107
- <clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
108
- <title depth="2">5.1<tab/>Introduction</title>
109
- </clause>
110
- <clause id="O" inline-header="false" obligation="normative">
111
- <title depth="2">5.2<tab/>Clause 4.2</title>
112
- </clause></clause>
113
-
114
- </sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
115
- <title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
116
- <clause id="Q" inline-header="false" obligation="normative">
117
- <title depth="2">A.1<tab/>Annex A.1</title>
118
- <clause id="Q1" inline-header="false" obligation="normative">
119
- <title depth="3">A.1.1<tab/>Annex A.1a</title>
120
- </clause>
121
- </clause>
122
- <appendix id="Q2" inline-header="false" obligation="normative">
123
- <title depth="2">Appendix 1<tab/>An Appendix</title>
124
- </appendix>
125
- </annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
126
- <title depth="1">2<tab/>Normative References</title>
127
- </references><clause id="S" obligation="informative" displayorder="9">
128
- <title depth="1">Bibliography</title>
129
- <references id="T" obligation="informative" normative="false">
130
- <title depth="2">Bibliography Subsection</title>
131
- </references>
72
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
73
+ <preface>
74
+ <foreword obligation="informative" displayorder="1">
75
+ <title>Foreword</title>
76
+ <p id="A">This is a preamble</p>
77
+ </foreword>
78
+ <introduction id="B" obligation="informative" displayorder="2"><title depth="1">0<tab/>Introduction</title><clause id="C" inline-header="false" obligation="informative">
79
+ <title depth="2">0.1<tab/>Introduction Subsection</title>
80
+ </clause>
81
+ <p>This is patent boilerplate</p>
82
+ </introduction></preface><sections>
83
+ <clause id="D" obligation="normative" type="scope" displayorder="3">
84
+ <title depth="1">1<tab/>Scope</title>
85
+ <p id="E">Text</p>
86
+ </clause>
87
+
88
+ <clause id="H" obligation="normative" displayorder="5"><title depth="1">3<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
89
+ <title depth="2">3.1<tab/>Normal Terms</title>
90
+ <term id="J"><name>3.1.1</name>
91
+ <preferred>Term2</preferred>
92
+ </term>
93
+ </terms>
94
+ <definitions id="K"><title>3.2</title>
95
+ <dl>
96
+ <dt>Symbol</dt>
97
+ <dd>Definition</dd>
98
+ </dl>
99
+ </definitions>
100
+ </clause>
101
+ <definitions id="L" displayorder="6"><title>4</title>
102
+ <dl>
103
+ <dt>Symbol</dt>
104
+ <dd>Definition</dd>
105
+ </dl>
106
+ </definitions>
107
+ <clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
108
+ <title depth="2">5.1<tab/>Introduction</title>
109
+ </clause>
110
+ <clause id="O" inline-header="false" obligation="normative">
111
+ <title depth="2">5.2<tab/>Clause 4.2</title>
112
+ </clause></clause>
113
+
114
+ </sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
115
+ <title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
116
+ <clause id="Q" inline-header="false" obligation="normative">
117
+ <title depth="2">A.1<tab/>Annex A.1</title>
118
+ <clause id="Q1" inline-header="false" obligation="normative">
119
+ <title depth="3">A.1.1<tab/>Annex A.1a</title>
132
120
  </clause>
133
- </bibliography>
134
- </iso-standard>
121
+ </clause>
122
+ <appendix id="Q2" inline-header="false" obligation="normative">
123
+ <title depth="2">Appendix 1<tab/>An Appendix</title>
124
+ </appendix>
125
+ </annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
126
+ <title depth="1">2<tab/>Normative References</title>
127
+ </references><clause id="S" obligation="informative" displayorder="9">
128
+ <title depth="1">Bibliography</title>
129
+ <references id="T" obligation="informative" normative="false">
130
+ <title depth="2">Bibliography Subsection</title>
131
+ </references>
132
+ </clause>
133
+ </bibliography>
134
+ </iso-standard>
135
135
  OUTPUT
136
136
 
137
137
  html = <<~OUTPUT
@@ -305,13 +305,18 @@ RSpec.describe IsoDoc do
305
305
  <div class="colophon"/>
306
306
  </body>
307
307
  OUTPUT
308
- expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
309
- expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
310
- expect(xmlpp(IsoDoc::Iec::WordConvert.new({}).convert("test", presxml, true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(word)
308
+ expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({})
309
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
310
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({})
311
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
312
+ expect(xmlpp(IsoDoc::Iec::WordConvert.new({})
313
+ .convert("test", presxml, true)
314
+ .sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>")))
315
+ .to be_equivalent_to xmlpp(word)
311
316
  end
312
317
 
313
318
  it "processes subclauses with and without titles" do
314
- expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
319
+ input = <<~INPUT
315
320
  <iso-standard xmlns="http://riboseinc.com/isoxml">
316
321
  <sections>
317
322
  <clause id="D" obligation="normative">
@@ -325,6 +330,7 @@ RSpec.describe IsoDoc do
325
330
  </sections>
326
331
  </iso-standard>
327
332
  INPUT
333
+ output = <<~OUTPUT
328
334
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
329
335
  <sections>
330
336
  <clause id='D' obligation='normative' displayorder="1">
@@ -347,10 +353,12 @@ RSpec.describe IsoDoc do
347
353
  </sections>
348
354
  </iso-standard>
349
355
  OUTPUT
356
+ expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({})
357
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
350
358
  end
351
359
 
352
360
  it "processes simple terms & definitions" do
353
- expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
361
+ input = <<~INPUT
354
362
  <iso-standard xmlns="http://riboseinc.com/isoxml">
355
363
  <sections>
356
364
  <terms id="H" obligation="normative"><title>1<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
@@ -362,6 +370,7 @@ RSpec.describe IsoDoc do
362
370
  </sections>
363
371
  </iso-standard>
364
372
  INPUT
373
+ output = <<~OUTPUT
365
374
  #{HTML_HDR}
366
375
  <div id="">
367
376
  <h1 class="ForewordTitle">FOREWORD</h1>
@@ -376,10 +385,12 @@ RSpec.describe IsoDoc do
376
385
  </body>
377
386
  </html>
378
387
  OUTPUT
388
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", input, true)))
389
+ .to be_equivalent_to xmlpp(output)
379
390
  end
380
391
 
381
392
  it "processes inline section headers" do
382
- expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
393
+ input = <<~INPUT
383
394
  <iso-standard xmlns="http://riboseinc.com/isoxml">
384
395
  <sections>
385
396
  <clause id="M" inline-header="false" obligation="normative"><title>1<tab/>Clause 4</title>
@@ -392,6 +403,7 @@ RSpec.describe IsoDoc do
392
403
  </sections>
393
404
  </iso-standard>
394
405
  INPUT
406
+ output = <<~OUTPUT
395
407
  #{HTML_HDR}
396
408
  <div id="">
397
409
  <h1 class="ForewordTitle">FOREWORD</h1>
@@ -411,10 +423,12 @@ RSpec.describe IsoDoc do
411
423
  </body>
412
424
  </html>
413
425
  OUTPUT
426
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", input, true)))
427
+ .to be_equivalent_to xmlpp(output)
414
428
  end
415
429
 
416
430
  it "adds colophon to published standard (Word)" do
417
- expect(xmlpp(IsoDoc::Iec::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
431
+ input = <<~INPUT
418
432
  <iso-standard xmlns="http://riboseinc.com/isoxml">
419
433
  <bibdata>
420
434
  <status>
@@ -426,30 +440,34 @@ RSpec.describe IsoDoc do
426
440
  </sections>
427
441
  </iso-standard>
428
442
  INPUT
429
- <body lang="EN-US" link="blue" vlink="#954F72">
430
- <div class="WordSection2">
431
- <p>
432
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
433
- </p>
434
- #{IEC_TITLE}
435
- <div id="">
436
- <h1 class="ForewordTitle">FOREWORD</h1>
437
- <div class="boilerplate_legal"/>
438
- </div>
439
- <p>&#160;</p>
440
- </div>
441
- <p><br clear="all" class="section"/></p>
442
- <div class="WordSection3">
443
- #{IEC_TITLE1}
444
- </div>
445
- <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
446
- <div class="colophon"/>
447
- </body>
443
+ output = <<~OUTPUT
444
+ <body lang='EN-US' link='blue' vlink='#954F72'>
445
+ <div class='WordSection1'>
446
+ <p>&#xa0;</p>
447
+ </div>
448
+ <p>
449
+ <br clear='all' class='section'/>
450
+ </p>
451
+ <div class='WordSection2'>
452
+ <p>&#xa0;</p>
453
+ </div>
454
+ <p>
455
+ <br clear='all' class='section'/>
456
+ </p>
457
+ <div class='WordSection3'>
458
+ <p class='zzSTDTitle'/>
459
+ </div>
460
+ <br clear='all' style='page-break-before:left;mso-break-type:section-break'/>
461
+ <div class='colophon'/>
462
+ </body>
448
463
  OUTPUT
464
+ expect(xmlpp(IsoDoc::Iec::WordConvert.new({}).convert("test", input, true)
465
+ .sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>")))
466
+ .to be_equivalent_to xmlpp(output)
449
467
  end
450
468
 
451
469
  it "does not add colophon to draft standard (Word)" do
452
- expect(xmlpp(IsoDoc::Iec::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
470
+ input = <<~INPUT
453
471
  <iso-standard xmlns="http://riboseinc.com/isoxml">
454
472
  <bibdata>
455
473
  <status>
@@ -461,6 +479,7 @@ RSpec.describe IsoDoc do
461
479
  </sections>
462
480
  </iso-standard>
463
481
  INPUT
482
+ output = <<~OUTPUT
464
483
  <body lang="EN-US" link="blue" vlink="#954F72">
465
484
  <div class="WordSection2">
466
485
  <p>
@@ -479,10 +498,15 @@ RSpec.describe IsoDoc do
479
498
  </div>
480
499
  </body>
481
500
  OUTPUT
501
+ expect(xmlpp(IsoDoc::Iec::WordConvert.new({})
502
+ .convert("test", input, true)
503
+ .sub(/^.*<body /m, "<body ")
504
+ .sub(%r{</body>.*$}m, "</body>")))
505
+ .to be_equivalent_to xmlpp(output)
482
506
  end
483
507
 
484
508
  it "adds boilerplate to foreword" do
485
- expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
509
+ input = <<~INPUT
486
510
  <iso-standard xmlns="http://riboseinc.com/isoxml">
487
511
  <bibdata>
488
512
  <ext><doctype>International Standard</doctype></ext>
@@ -495,6 +519,7 @@ RSpec.describe IsoDoc do
495
519
  <sections/>
496
520
  </iso-standard>
497
521
  INPUT
522
+ output = <<~OUTPUT
498
523
  #{HTML_HDR}
499
524
  <div id="">
500
525
  <h1 class="ForewordTitle">FOREWORD</h1>
@@ -507,10 +532,12 @@ RSpec.describe IsoDoc do
507
532
  </body>
508
533
  </html>
509
534
  OUTPUT
535
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({})
536
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
510
537
  end
511
538
 
512
539
  it "does not add boilerplate to foreword in amendments" do
513
- expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
540
+ input = <<~INPUT
514
541
  <iso-standard xmlns="http://riboseinc.com/isoxml">
515
542
  <bibdata>
516
543
  <ext><doctype>Amendment</doctype></ext>
@@ -523,6 +550,7 @@ RSpec.describe IsoDoc do
523
550
  <sections/>
524
551
  </iso-standard>
525
552
  INPUT
553
+ output = <<~OUTPUT
526
554
  #{HTML_HDR}
527
555
  <div id="">
528
556
  <h1 class="ForewordTitle">FOREWORD</h1>
@@ -532,5 +560,7 @@ RSpec.describe IsoDoc do
532
560
  </body>
533
561
  </html>
534
562
  OUTPUT
563
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({})
564
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
535
565
  end
536
566
  end
@@ -165,8 +165,9 @@ RSpec.describe Metanorma::Iec do
165
165
  </bibitem>
166
166
  </relation>
167
167
  <ext>
168
- <doctype>article</doctype>
168
+ <doctype>standard</doctype>
169
169
  <editorialgroup>
170
+ <agency>IEC</agency>
170
171
  <technical-committee number='1' type='A'>TC</technical-committee>
171
172
  <technical-committee number='11' type='A1'>TC1</technical-committee>
172
173
  <subcommittee number='2' type='B'>SC</subcommittee>
@@ -438,9 +439,9 @@ RSpec.describe Metanorma::Iec do
438
439
  <horizontal>true</horizontal>
439
440
  <function>emc</function>
440
441
  <editorialgroup>
441
- <technical-committee/>
442
- <subcommittee/>
443
- <workgroup/>
442
+ <agency>IEC</agency>
443
+ <agency>IETF</agency>
444
+ <agency>ISO</agency>
444
445
  </editorialgroup>
445
446
  <structuredidentifier>
446
447
  <project-number part='1' subpart='1'>IEC/IETF/ISO 1000</project-number>
@@ -673,11 +674,9 @@ RSpec.describe Metanorma::Iec do
673
674
  </owner>
674
675
  </copyright>
675
676
  <ext>
676
- <doctype>article</doctype>
677
+ <doctype>standard</doctype>
677
678
  <editorialgroup>
678
- <technical-committee/>
679
- <subcommittee/>
680
- <workgroup/>
679
+ <agency>IEC</agency>
681
680
  </editorialgroup>
682
681
  <structuredidentifier>
683
682
  <project-number>IEC 1000</project-number>
@@ -876,11 +875,9 @@ RSpec.describe Metanorma::Iec do
876
875
  </owner>
877
876
  </copyright>
878
877
  <ext>
879
- <doctype>article</doctype>
878
+ <doctype>standard</doctype>
880
879
  <editorialgroup>
881
- <technical-committee/>
882
- <subcommittee/>
883
- <workgroup/>
880
+ <agency>IEC</agency>
884
881
  </editorialgroup>
885
882
  <structuredidentifier>
886
883
  <project-number>IEC 1000</project-number>
@@ -943,11 +940,9 @@ RSpec.describe Metanorma::Iec do
943
940
  </owner>
944
941
  </copyright>
945
942
  <ext>
946
- <doctype>article</doctype>
943
+ <doctype>standard</doctype>
947
944
  <editorialgroup>
948
- <technical-committee/>
949
- <subcommittee/>
950
- <workgroup/>
945
+ <agency>IEC</agency>
951
946
  </editorialgroup>
952
947
  <structuredidentifier>
953
948
  <project-number>IEC 1000</project-number>
@@ -52,11 +52,9 @@ RSpec.describe Metanorma::Iec do
52
52
  </owner>
53
53
  </copyright>
54
54
  <ext>
55
- <doctype>article</doctype>
55
+ <doctype>standard</doctype>
56
56
  <editorialgroup>
57
- <technical-committee/>
58
- <subcommittee/>
59
- <workgroup/>
57
+ <agency>IEC</agency>
60
58
  </editorialgroup>
61
59
  <stagename>International standard</stagename>
62
60
  <tc-sc-officers-note>
@@ -57,12 +57,10 @@ RSpec.describe Metanorma::Iec do
57
57
  </owner>
58
58
  </copyright>
59
59
  <ext>
60
- <doctype>article</doctype>
60
+ <doctype>standard</doctype>
61
61
  <subdoctype>vocabulary</subdoctype>
62
62
  <editorialgroup>
63
- <technical-committee/>
64
- <subcommittee/>
65
- <workgroup/>
63
+ <agency>IEC</agency>
66
64
  </editorialgroup>
67
65
  <structuredidentifier>
68
66
  <project-number>IEC 60050</project-number>
@@ -145,12 +143,10 @@ RSpec.describe Metanorma::Iec do
145
143
  </owner>
146
144
  </copyright>
147
145
  <ext>
148
- <doctype>article</doctype>
146
+ <doctype>standard</doctype>
149
147
  <subdoctype>vocabulary</subdoctype>
150
148
  <editorialgroup>
151
- <technical-committee/>
152
- <subcommittee/>
153
- <workgroup/>
149
+ <agency>IEC</agency>
154
150
  </editorialgroup>
155
151
  <structuredidentifier>
156
152
  <project-number>IEC 60050</project-number>
@@ -227,12 +223,10 @@ RSpec.describe Metanorma::Iec do
227
223
  </owner>
228
224
  </copyright>
229
225
  <ext>
230
- <doctype>article</doctype>
226
+ <doctype>standard</doctype>
231
227
  <subdoctype>vocabulary</subdoctype>
232
228
  <editorialgroup>
233
- <technical-committee/>
234
- <subcommittee/>
235
- <workgroup/>
229
+ <agency>IEC</agency>
236
230
  </editorialgroup>
237
231
  <structuredidentifier>
238
232
  <project-number>IEC 60050</project-number>
data/spec/spec_helper.rb CHANGED
@@ -174,11 +174,9 @@ BLANK_HDR = <<~"HDR".freeze
174
174
  </owner>
175
175
  </copyright>
176
176
  <ext>
177
- <doctype>article</doctype>
177
+ <doctype>standard</doctype>
178
178
  <editorialgroup>
179
- <technical-committee/>
180
- <subcommittee/>
181
- <workgroup/>
179
+ <agency>IEC</agency>
182
180
  </editorialgroup>
183
181
  <stagename>International standard</stagename>
184
182
  </ext>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-16 00:00:00.000000000 Z
11
+ date: 2022-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso
@@ -298,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
298
  - !ruby/object:Gem::Version
299
299
  version: '0'
300
300
  requirements: []
301
- rubygems_version: 3.3.9
301
+ rubygems_version: 3.3.16
302
302
  signing_key:
303
303
  specification_version: 4
304
304
  summary: metanorma-iec lets you write IEC standards in AsciiDoc.