metanorma-iec 2.1.1 → 2.1.2
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.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/lib/isodoc/iec/html/htmlstyle.css +28 -22
- data/lib/isodoc/iec/html/htmlstyle.scss +23 -22
- data/lib/isodoc/iec/html/isodoc.css +19 -11
- data/lib/isodoc/iec/html/isodoc.scss +21 -12
- data/lib/isodoc/iec/i18n.rb +1 -1
- data/lib/isodoc/iec/iec.international-standard.xsl +218 -147
- data/lib/isodoc/iec/presentation_xml_convert.rb +6 -4
- data/lib/isodoc/iec/word_convert.rb +1 -1
- data/lib/metanorma/iec/biblio.rng +32 -34
- data/lib/metanorma/iec/converter.rb +5 -0
- data/lib/metanorma/iec/front.rb +2 -0
- data/lib/metanorma/iec/isodoc.rng +9 -0
- data/lib/metanorma/iec/isostandard.rng +35 -12
- data/lib/metanorma/iec/version.rb +1 -1
- data/spec/isodoc/blocks_spec.rb +37 -0
- data/spec/isodoc/iev_spec.rb +6 -4
- data/spec/isodoc/metadata_spec.rb +235 -261
- data/spec/isodoc/postproc_spec.rb +0 -4
- data/spec/isodoc/section_spec.rb +121 -91
- data/spec/metanorma/base_spec.rb +11 -4
- data/spec/metanorma/cleanup_spec.rb +1 -0
- data/spec/metanorma/iev_spec.rb +3 -0
- data/spec/spec_helper.rb +2 -1
- metadata +3 -3
data/spec/isodoc/section_spec.rb
CHANGED
@@ -69,69 +69,69 @@ RSpec.describe IsoDoc do
|
|
69
69
|
INPUT
|
70
70
|
|
71
71
|
presxml = <<~OUTPUT
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
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
|
-
|
134
|
-
|
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({})
|
309
|
-
|
310
|
-
expect(xmlpp(IsoDoc::Iec::
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
443
|
+
output = <<~OUTPUT
|
444
|
+
<body lang='EN-US' link='blue' vlink='#954F72'>
|
445
|
+
<div class='WordSection1'>
|
446
|
+
<p> </p>
|
447
|
+
</div>
|
448
|
+
<p>
|
449
|
+
<br clear='all' class='section'/>
|
450
|
+
</p>
|
451
|
+
<div class='WordSection2'>
|
452
|
+
<p> </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
|
-
|
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
|
-
|
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
|
-
|
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
|
data/spec/metanorma/base_spec.rb
CHANGED
@@ -165,8 +165,9 @@ RSpec.describe Metanorma::Iec do
|
|
165
165
|
</bibitem>
|
166
166
|
</relation>
|
167
167
|
<ext>
|
168
|
-
<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,6 +439,9 @@ RSpec.describe Metanorma::Iec do
|
|
438
439
|
<horizontal>true</horizontal>
|
439
440
|
<function>emc</function>
|
440
441
|
<editorialgroup>
|
442
|
+
<agency>IEC</agency>
|
443
|
+
<agency>IETF</agency>
|
444
|
+
<agency>ISO</agency>
|
441
445
|
<technical-committee/>
|
442
446
|
<subcommittee/>
|
443
447
|
<workgroup/>
|
@@ -673,8 +677,9 @@ RSpec.describe Metanorma::Iec do
|
|
673
677
|
</owner>
|
674
678
|
</copyright>
|
675
679
|
<ext>
|
676
|
-
<doctype>
|
680
|
+
<doctype>standard</doctype>
|
677
681
|
<editorialgroup>
|
682
|
+
<agency>IEC</agency>
|
678
683
|
<technical-committee/>
|
679
684
|
<subcommittee/>
|
680
685
|
<workgroup/>
|
@@ -876,8 +881,9 @@ RSpec.describe Metanorma::Iec do
|
|
876
881
|
</owner>
|
877
882
|
</copyright>
|
878
883
|
<ext>
|
879
|
-
<doctype>
|
884
|
+
<doctype>standard</doctype>
|
880
885
|
<editorialgroup>
|
886
|
+
<agency>IEC</agency>
|
881
887
|
<technical-committee/>
|
882
888
|
<subcommittee/>
|
883
889
|
<workgroup/>
|
@@ -943,8 +949,9 @@ RSpec.describe Metanorma::Iec do
|
|
943
949
|
</owner>
|
944
950
|
</copyright>
|
945
951
|
<ext>
|
946
|
-
<doctype>
|
952
|
+
<doctype>standard</doctype>
|
947
953
|
<editorialgroup>
|
954
|
+
<agency>IEC</agency>
|
948
955
|
<technical-committee/>
|
949
956
|
<subcommittee/>
|
950
957
|
<workgroup/>
|
data/spec/metanorma/iev_spec.rb
CHANGED
@@ -60,6 +60,7 @@ RSpec.describe Metanorma::Iec do
|
|
60
60
|
<doctype>article</doctype>
|
61
61
|
<subdoctype>vocabulary</subdoctype>
|
62
62
|
<editorialgroup>
|
63
|
+
<agency>IEC</agency>
|
63
64
|
<technical-committee/>
|
64
65
|
<subcommittee/>
|
65
66
|
<workgroup/>
|
@@ -148,6 +149,7 @@ RSpec.describe Metanorma::Iec do
|
|
148
149
|
<doctype>article</doctype>
|
149
150
|
<subdoctype>vocabulary</subdoctype>
|
150
151
|
<editorialgroup>
|
152
|
+
<agency>IEC</agency>
|
151
153
|
<technical-committee/>
|
152
154
|
<subcommittee/>
|
153
155
|
<workgroup/>
|
@@ -230,6 +232,7 @@ RSpec.describe Metanorma::Iec do
|
|
230
232
|
<doctype>article</doctype>
|
231
233
|
<subdoctype>vocabulary</subdoctype>
|
232
234
|
<editorialgroup>
|
235
|
+
<agency>IEC</agency>
|
233
236
|
<technical-committee/>
|
234
237
|
<subcommittee/>
|
235
238
|
<workgroup/>
|
data/spec/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 2.1.2
|
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-
|
11
|
+
date: 2022-06-06 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.
|
301
|
+
rubygems_version: 3.3.7
|
302
302
|
signing_key:
|
303
303
|
specification_version: 4
|
304
304
|
summary: metanorma-iec lets you write IEC standards in AsciiDoc.
|