metanorma-iec 1.2.8 → 1.2.13
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/.github/workflows/rake.yml +7 -5
- data/lib/asciidoctor/iec/basicdoc.rng +52 -3
- data/lib/asciidoctor/iec/converter.rb +25 -1
- data/lib/asciidoctor/iec/front.rb +35 -58
- data/lib/asciidoctor/iec/iec.rng +81 -1
- data/lib/asciidoctor/iec/iec_intro_en.xml +110 -56
- data/lib/asciidoctor/iec/iec_intro_fr.xml +78 -22
- data/lib/asciidoctor/iec/isodoc.rng +51 -3
- data/lib/asciidoctor/iec/isostandard.rng +27 -10
- data/lib/isodoc/iec/base_convert.rb +2 -2
- data/lib/isodoc/iec/html/html_iec_intro.html +1 -1
- data/lib/isodoc/iec/html/htmlstyle.css +5 -5
- data/lib/isodoc/iec/html/htmlstyle.scss +4 -4
- data/lib/isodoc/iec/html/isodoc.css +79 -79
- data/lib/isodoc/iec/html/isodoc.scss +79 -79
- data/lib/isodoc/iec/html/word_iec_intro.html +1 -1
- data/lib/isodoc/iec/html/wordstyle.css +120 -120
- data/lib/isodoc/iec/html/wordstyle.scss +120 -120
- data/lib/isodoc/iec/html_convert.rb +10 -2
- data/lib/isodoc/iec/i18n-en.yaml +17 -0
- data/lib/isodoc/iec/i18n-fr.yaml +18 -0
- data/lib/isodoc/iec/iec.international-standard.xsl +914 -398
- data/lib/isodoc/iec/metadata.rb +33 -0
- data/lib/isodoc/iec/presentation_xml_convert.rb +12 -0
- data/lib/isodoc/iec/word_convert.rb +12 -2
- data/lib/metanorma/iec/processor.rb +11 -8
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +2 -3
- data/spec/asciidoctor-iec/base_spec.rb +444 -10
- data/spec/asciidoctor-iec/blocks_spec.rb +25 -21
- data/spec/asciidoctor-iec/cleanup_spec.rb +99 -14
- data/spec/asciidoctor-iec/iev_spec.rb +15 -6
- data/spec/asciidoctor-iec/inline_spec.rb +11 -7
- data/spec/asciidoctor-iec/lists_spec.rb +13 -9
- data/spec/asciidoctor-iec/section_spec.rb +9 -5
- data/spec/asciidoctor-iec/validate_spec.rb +16 -1
- data/spec/isodoc/i18n_spec.rb +30 -0
- data/spec/isodoc/iso_spec.rb +4 -4
- data/spec/isodoc/metadata_spec.rb +23 -1
- data/spec/metanorma/processor_spec.rb +1 -1
- data/spec/spec_helper.rb +20 -31
- metadata +5 -19
@@ -1,6 +1,10 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe Asciidoctor::Iec do
|
4
|
+
before(:all) do
|
5
|
+
@blank_hdr = blank_hdr_gen
|
6
|
+
end
|
7
|
+
|
4
8
|
it "processes inline_quoted formatting" do
|
5
9
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
10
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -19,7 +23,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
19
23
|
[strike]#strike#
|
20
24
|
[smallcap]#smallcap#
|
21
25
|
INPUT
|
22
|
-
#{
|
26
|
+
#{@blank_hdr}
|
23
27
|
<sections>
|
24
28
|
<em>emphasis</em>
|
25
29
|
<strong>strong</strong>
|
@@ -56,7 +60,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
56
60
|
|
57
61
|
<<<
|
58
62
|
INPUT
|
59
|
-
#{
|
63
|
+
#{@blank_hdr}
|
60
64
|
<sections><p id="_">Line break<br/>
|
61
65
|
line break</p>
|
62
66
|
<hr/>
|
@@ -72,7 +76,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
72
76
|
http://example.com[]
|
73
77
|
http://example.com[Link]
|
74
78
|
INPUT
|
75
|
-
#{
|
79
|
+
#{@blank_hdr}
|
76
80
|
<sections>
|
77
81
|
<p id="_">mailto:fred@example.com
|
78
82
|
<link target="http://example.com"/>
|
@@ -87,7 +91,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
87
91
|
#{ASCIIDOC_BLANK_HDR}
|
88
92
|
Text [[bookmark]] Text
|
89
93
|
INPUT
|
90
|
-
#{
|
94
|
+
#{@blank_hdr}
|
91
95
|
<sections>
|
92
96
|
<p id="_">Text <bookmark id="bookmark"/> Text</p>
|
93
97
|
</sections>
|
@@ -106,7 +110,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
106
110
|
Inline Reference with Text to <<reference,text>>
|
107
111
|
Footnoted Reference with Text to <<reference,fn: text>>
|
108
112
|
INPUT
|
109
|
-
#{
|
113
|
+
#{@blank_hdr}
|
110
114
|
<sections>
|
111
115
|
<clause id="reference" inline-header="false" obligation="normative">
|
112
116
|
<title>Section</title>
|
@@ -130,7 +134,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
130
134
|
* [[[ISO713]]] Reference
|
131
135
|
|
132
136
|
INPUT
|
133
|
-
#{
|
137
|
+
#{@blank_hdr}
|
134
138
|
<sections>
|
135
139
|
|
136
140
|
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
@@ -156,7 +160,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
156
160
|
#{ASCIIDOC_BLANK_HDR}
|
157
161
|
Hello!footnote:[Footnote text]
|
158
162
|
INPUT
|
159
|
-
#{
|
163
|
+
#{@blank_hdr}
|
160
164
|
<sections>
|
161
165
|
<p id="_">Hello!<fn reference="1">
|
162
166
|
<p id="_">Footnote text</p>
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe Asciidoctor::Iec do
|
4
|
+
before(:all) do
|
5
|
+
@blank_hdr = blank_hdr_gen
|
6
|
+
end
|
7
|
+
|
4
8
|
it "processes simple lists" do
|
5
9
|
output = Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)
|
6
10
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -17,7 +21,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
17
21
|
|
18
22
|
INPUT
|
19
23
|
expect(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
20
|
-
#{
|
24
|
+
#{@blank_hdr}
|
21
25
|
<sections>
|
22
26
|
<ul id="_">
|
23
27
|
<li>
|
@@ -28,7 +32,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
28
32
|
</li>
|
29
33
|
<li>
|
30
34
|
<p id="_">List 3</p>
|
31
|
-
<ol id="_"
|
35
|
+
<ol id="_">
|
32
36
|
<li>
|
33
37
|
<p id="_">List A</p>
|
34
38
|
</li>
|
@@ -99,7 +103,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
99
103
|
|
100
104
|
INPUT
|
101
105
|
expect(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
102
|
-
#{
|
106
|
+
#{@blank_hdr}
|
103
107
|
<sections><ul id="id">
|
104
108
|
<li>
|
105
109
|
<p id="_">First</p>
|
@@ -107,13 +111,13 @@ RSpec.describe Asciidoctor::Iec do
|
|
107
111
|
<li><p id="_">Second</p><p id="_">entry1</p>
|
108
112
|
<p id="_">entry2</p></li>
|
109
113
|
</ul>
|
110
|
-
<ol id="id1"
|
114
|
+
<ol id="id1">
|
111
115
|
<li>
|
112
116
|
<p id="_">First</p>
|
113
117
|
</li>
|
114
118
|
<li>
|
115
119
|
<p id="_">Second</p>
|
116
|
-
<ol id="_"
|
120
|
+
<ol id="_">
|
117
121
|
<li>
|
118
122
|
<p id="_">Third</p>
|
119
123
|
</li>
|
@@ -129,19 +133,19 @@ RSpec.describe Asciidoctor::Iec do
|
|
129
133
|
<p id="_">Sixth</p>
|
130
134
|
</li>
|
131
135
|
</ol>
|
132
|
-
<ol id="_"
|
136
|
+
<ol id="_">
|
133
137
|
<li>
|
134
138
|
<p id="_">A</p>
|
135
139
|
</li>
|
136
140
|
<li>
|
137
141
|
<p id="_">B</p>
|
138
|
-
<ol id="_"
|
142
|
+
<ol id="_">
|
139
143
|
<li>
|
140
144
|
<p id="_">C</p>
|
141
145
|
</li>
|
142
146
|
<li>
|
143
147
|
<p id="_">D</p>
|
144
|
-
<ol id="_"
|
148
|
+
<ol id="_">
|
145
149
|
<li>
|
146
150
|
<p id="_">E</p>
|
147
151
|
</li>
|
@@ -172,7 +176,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
172
176
|
* Hello [[id3]] List item
|
173
177
|
|
174
178
|
INPUT
|
175
|
-
#{
|
179
|
+
#{@blank_hdr}
|
176
180
|
<sections>
|
177
181
|
<ul id="id1">
|
178
182
|
<li id="id2">
|
@@ -1,6 +1,10 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe Asciidoctor::Iec do
|
4
|
+
before(:all) do
|
5
|
+
@blank_hdr = blank_hdr_gen
|
6
|
+
end
|
7
|
+
|
4
8
|
it "processes sections" do
|
5
9
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
10
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -52,7 +56,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
52
56
|
|
53
57
|
=== Bibliography Subsection
|
54
58
|
INPUT
|
55
|
-
#{
|
59
|
+
#{@blank_hdr}
|
56
60
|
<preface><foreword id="_" obligation="informative">
|
57
61
|
<title>FOREWORD</title>
|
58
62
|
<p id="_">Text</p>
|
@@ -189,7 +193,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
189
193
|
|
190
194
|
=== Bibliography Subsection
|
191
195
|
INPUT
|
192
|
-
#{
|
196
|
+
#{@blank_hdr}
|
193
197
|
<preface>
|
194
198
|
<foreword id="_" obligation="informative">
|
195
199
|
<title>FOREWORD</title>
|
@@ -298,7 +302,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
298
302
|
[appendix,obligation=informative]
|
299
303
|
== Annex
|
300
304
|
INPUT
|
301
|
-
#{
|
305
|
+
#{@blank_hdr}
|
302
306
|
<sections><clause id="_" inline-header="false" obligation="informative">
|
303
307
|
<title>Clause 1</title>
|
304
308
|
<clause id="_" inline-header="false" obligation="informative">
|
@@ -329,7 +333,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
329
333
|
[%inline-header]
|
330
334
|
=== Clause Aa
|
331
335
|
INPUT
|
332
|
-
#{
|
336
|
+
#{@blank_hdr}
|
333
337
|
<sections><clause id="_" inline-header="false" obligation="normative">
|
334
338
|
<title>Clause 1</title>
|
335
339
|
<clause id="_" inline-header="true" obligation="normative">
|
@@ -354,7 +358,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
354
358
|
=== {blank}
|
355
359
|
|
356
360
|
INPUT
|
357
|
-
#{
|
361
|
+
#{@blank_hdr}
|
358
362
|
<sections>
|
359
363
|
<clause id="_" inline-header="false" obligation="normative">
|
360
364
|
<title>Clause 1</title>
|
@@ -17,7 +17,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
17
17
|
expect do
|
18
18
|
Metanorma::Compile
|
19
19
|
.new
|
20
|
-
.compile("spec/assets/xref_error.adoc", type: "iec")
|
20
|
+
.compile("spec/assets/xref_error.adoc", type: "iec", :"agree-to-terms" => true)
|
21
21
|
end.to(change { File.exist?("spec/assets/xref_error.err") }
|
22
22
|
.from(false).to(true))
|
23
23
|
end
|
@@ -37,4 +37,19 @@ it "Warns of illegal doctype" do
|
|
37
37
|
INPUT
|
38
38
|
expect(File.read("test.err")).to include "pizza is not a recognised document type"
|
39
39
|
end
|
40
|
+
|
41
|
+
it "Warns of illegal function" do
|
42
|
+
FileUtils.rm_f "test.err"
|
43
|
+
Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)
|
44
|
+
= Document title
|
45
|
+
Author
|
46
|
+
:docfile: test.adoc
|
47
|
+
:nodoc:
|
48
|
+
:no-isobib:
|
49
|
+
:function: pizza
|
50
|
+
|
51
|
+
text
|
52
|
+
INPUT
|
53
|
+
expect(File.read("test.err")).to include "pizza is not a recognised document function"
|
54
|
+
end
|
40
55
|
end
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -7,6 +7,11 @@ RSpec.describe IsoDoc do
|
|
7
7
|
<bibdata>
|
8
8
|
<docnumber>1</docnumber>
|
9
9
|
<language>en</language>
|
10
|
+
<ext>
|
11
|
+
<doctype>international-standard</doctype>
|
12
|
+
<horizontal>true</horizontal>
|
13
|
+
<function>emc</function>
|
14
|
+
</ext>
|
10
15
|
</bibdata>
|
11
16
|
<preface>
|
12
17
|
<foreword obligation="informative">
|
@@ -77,6 +82,17 @@ RSpec.describe IsoDoc do
|
|
77
82
|
<bibdata>
|
78
83
|
<docnumber>1</docnumber>
|
79
84
|
<language current="true">en</language>
|
85
|
+
<ext>
|
86
|
+
<doctype language=''>international-standard</doctype>
|
87
|
+
<doctype language='fr'>Norme international</doctype>
|
88
|
+
<doctype language='en'>International Standard</doctype>
|
89
|
+
<horizontal language=''>true</horizontal>
|
90
|
+
<horizontal language='fr'>Norme horizontale</horizontal>
|
91
|
+
<horizontal language='en'>Horizontal Standard</horizontal>
|
92
|
+
<function language=''>emc</function>
|
93
|
+
<function language='fr'>Publication fondamentale en CEM</function>
|
94
|
+
<function language='en'>Basic EMC Publication</function>
|
95
|
+
</ext>
|
80
96
|
</bibdata>
|
81
97
|
<preface>
|
82
98
|
<foreword obligation="informative">
|
@@ -432,6 +448,11 @@ RSpec.describe IsoDoc do
|
|
432
448
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
433
449
|
<bibdata>
|
434
450
|
<language>fr</language>
|
451
|
+
<ext>
|
452
|
+
<doctype>international-standard</doctype>
|
453
|
+
<horizontal>false</horizontal>
|
454
|
+
<function>emc</function>
|
455
|
+
</ext>
|
435
456
|
</bibdata>
|
436
457
|
<preface>
|
437
458
|
<foreword obligation="informative">
|
@@ -501,6 +522,15 @@ RSpec.describe IsoDoc do
|
|
501
522
|
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
502
523
|
<bibdata>
|
503
524
|
<language current="true">fr</language>
|
525
|
+
<ext>
|
526
|
+
<doctype language=''>international-standard</doctype>
|
527
|
+
<doctype language='fr'>Norme international</doctype>
|
528
|
+
<doctype language='en'>International Standard</doctype>
|
529
|
+
<horizontal language=''>false</horizontal>
|
530
|
+
<function language=''>emc</function>
|
531
|
+
<function language='fr'>Publication fondamentale en CEM</function>
|
532
|
+
<function language='en'>Basic EMC Publication</function>
|
533
|
+
</ext>
|
504
534
|
</bibdata>
|
505
535
|
<preface>
|
506
536
|
<foreword obligation="informative">
|
data/spec/isodoc/iso_spec.rb
CHANGED
@@ -32,8 +32,8 @@ RSpec.describe IsoDoc::Iec do
|
|
32
32
|
INPUT
|
33
33
|
html = File.read("test.html", encoding: "utf-8")
|
34
34
|
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
35
|
-
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "
|
36
|
-
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "
|
35
|
+
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
|
36
|
+
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
|
37
37
|
end
|
38
38
|
|
39
39
|
it "processes isodoc as ISO: user nominated fonts" do
|
@@ -65,9 +65,9 @@ RSpec.describe IsoDoc::Iec do
|
|
65
65
|
</iso-standard>
|
66
66
|
INPUT
|
67
67
|
html = File.read("test.doc", encoding: "utf-8")
|
68
|
-
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New",monospace;]m)
|
68
|
+
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
69
69
|
expect(html).to match(%r[Quote[^{]+\{[^{]+font-family: "Arial", sans-serif;]m)
|
70
|
-
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Arial",sans-serif;]m)
|
70
|
+
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Arial", sans-serif;]m)
|
71
71
|
end
|
72
72
|
|
73
73
|
it "processes examples" do
|
@@ -59,7 +59,15 @@ RSpec.describe IsoDoc::Iec::Metadata do
|
|
59
59
|
</owner>
|
60
60
|
</copyright>
|
61
61
|
<ext>
|
62
|
-
<doctype>international-standard</doctype>
|
62
|
+
<doctype language=''>international-standard</doctype>
|
63
|
+
<doctype language='fr'>Norme international</doctype>
|
64
|
+
<doctype language='en'>International Standard</doctype>
|
65
|
+
<horizontal language=''>true</horizontal>
|
66
|
+
<horizontal language='fr'>Norme horizontale</horizontal>
|
67
|
+
<horizontal language='en'>Horizontal Standard</horizontal>
|
68
|
+
<function language=''>emc</function>
|
69
|
+
<function language='fr'>Publication fondamentale en CEM</function>
|
70
|
+
<function language='en'>Basic EMC Publication</function>
|
63
71
|
<editorialgroup>
|
64
72
|
<technical-committee number="34">Food products</technical-committee>
|
65
73
|
<subcommittee number="4">Cereals and pulses</subcommittee>
|
@@ -94,11 +102,21 @@ INPUT
|
|
94
102
|
:doctitlepartlabel=>"Part 1",
|
95
103
|
:doctype=>"International Standard",
|
96
104
|
:doctype_display=>"International Standard",
|
105
|
+
:doctype_en=>"International Standard",
|
106
|
+
:doctype_fr=>"Norme International",
|
97
107
|
:docyear=>"2016",
|
98
108
|
:draft=>"0.4",
|
99
109
|
:draftinfo=>" (draft 0.4, 2016-05-01)",
|
100
110
|
:edition=>"2",
|
101
111
|
:editorialgroup=>["TC 34", "SC 4", "WG 3"],
|
112
|
+
:function=>"Emc",
|
113
|
+
:function_display=>"Basic Emc Publication",
|
114
|
+
:function_en=>"Basic Emc Publication",
|
115
|
+
:function_fr=>"Publication Fondamentale En Cem",
|
116
|
+
:horizontal=>"True",
|
117
|
+
:horizontal_display=>"Horizontal Standard",
|
118
|
+
:horizontal_en=>"Horizontal Standard",
|
119
|
+
:horizontal_fr=>"Norme Horizontale",
|
102
120
|
:implementeddate=>"XXX",
|
103
121
|
:issueddate=>"XXX",
|
104
122
|
:lang=>"en",
|
@@ -188,6 +206,7 @@ OUTPUT
|
|
188
206
|
</relation>
|
189
207
|
<ext>
|
190
208
|
<doctype>technical-report</doctype>
|
209
|
+
<horizontal>false</horizontal>
|
191
210
|
<editorialgroup>
|
192
211
|
<technical-committee number="34" type="ABC">Food products</technical-committee>
|
193
212
|
<subcommittee number="4" type="DEF">Cereals and pulses</subcommittee>
|
@@ -221,8 +240,11 @@ INPUT
|
|
221
240
|
:doctitlepartlabel=>"Part 1–3",
|
222
241
|
:doctype=>"Technical Report",
|
223
242
|
:doctype_display=>"Technical Report",
|
243
|
+
:doctype_en=>"Technical Report",
|
244
|
+
:doctype_fr=>"Technical Report",
|
224
245
|
:docyear=>"2016",
|
225
246
|
:editorialgroup=>["ABC 34", "DEF 4", "GHI 3"],
|
247
|
+
:horizontal=>"False",
|
226
248
|
:ics=>"1.2.3, 1.2.3",
|
227
249
|
:implementeddate=>"XXX",
|
228
250
|
:issueddate=>"XXX",
|
@@ -27,7 +27,7 @@ RSpec.describe Metanorma::Iec::Processor do
|
|
27
27
|
expect(xmlpp(strip_guid(processor.input_to_isodoc(<<~"INPUT", nil)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
28
28
|
#{ASCIIDOC_BLANK_HDR}
|
29
29
|
INPUT
|
30
|
-
#{
|
30
|
+
#{blank_hdr_gen}
|
31
31
|
<sections/>
|
32
32
|
</iec-standard>
|
33
33
|
OUTPUT
|
data/spec/spec_helper.rb
CHANGED
@@ -112,36 +112,17 @@ TERMS_BOILERPLATE = <<~"BOILERPLATE"
|
|
112
112
|
</ul>
|
113
113
|
BOILERPLATE
|
114
114
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
)
|
124
|
-
|
125
|
-
|
126
|
-
<license-statement>
|
127
|
-
<clause>
|
128
|
-
<title>Warning for CDs, CDVs and FDISs</title>
|
129
|
-
<p id='_'>
|
130
|
-
This document is not an IEC International Standard. It is distributed
|
131
|
-
for review and comment. It is subject to change without notice and may
|
132
|
-
not be referred to as an International Standard.
|
133
|
-
</p>
|
134
|
-
<p id='_'>
|
135
|
-
Recipients of this draft are invited to submit, with their comments,
|
136
|
-
notification of any relevant patent rights of which they are aware and
|
137
|
-
to provide supporting documentation.
|
138
|
-
</p>
|
139
|
-
</clause>
|
140
|
-
</license-statement>
|
141
|
-
END
|
142
|
-
|
143
|
-
UNPUBLISHED_BOILERPLATE = BOILERPLATE.sub(/<\/boilerplate>/, "#{BOILERPLATE_LICENSE}</boilerplate>")
|
144
|
-
|
115
|
+
def boilerplate(xmldoc)
|
116
|
+
file = File.read(File.join(File.dirname(__FILE__), "..", "lib", "asciidoctor", "iec", "iec_intro_en.xml"), encoding: "utf-8")
|
117
|
+
conv = Asciidoctor::Iec::Converter.new(nil, backend: :iec, header_footer: true)
|
118
|
+
conv.init(Asciidoctor::Document.new [])
|
119
|
+
ret = Nokogiri::XML(
|
120
|
+
conv.boilerplate_isodoc(xmldoc).populate_template(file, nil).
|
121
|
+
gsub(/<p>/, "<p id='_'>").
|
122
|
+
gsub(/<ol>/, "<ol id='_'>"))
|
123
|
+
conv.smartquotes_cleanup(ret)
|
124
|
+
HTMLEntities.new.decode(ret.to_xml)
|
125
|
+
end
|
145
126
|
|
146
127
|
BLANK_HDR = <<~"HDR"
|
147
128
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -178,6 +159,7 @@ BLANK_HDR = <<~"HDR"
|
|
178
159
|
</copyright>
|
179
160
|
<ext>
|
180
161
|
<doctype>article</doctype>
|
162
|
+
<horizontal>false</horizontal>
|
181
163
|
<editorialgroup>
|
182
164
|
<technical-committee/>
|
183
165
|
<subcommittee/>
|
@@ -186,9 +168,16 @@ BLANK_HDR = <<~"HDR"
|
|
186
168
|
<stagename>International standard</stagename>
|
187
169
|
</ext>
|
188
170
|
</bibdata>
|
189
|
-
#{BOILERPLATE}
|
190
171
|
HDR
|
191
172
|
|
173
|
+
def blank_hdr_gen
|
174
|
+
<<~"HDR"
|
175
|
+
#{BLANK_HDR}
|
176
|
+
#{boilerplate(Nokogiri::XML(BLANK_HDR + "</iec-standard>"))}
|
177
|
+
HDR
|
178
|
+
end
|
179
|
+
|
180
|
+
|
192
181
|
IEC_TITLE = <<~END
|
193
182
|
<p class="zzSTDTitle1">INTERNATIONAL ELECTROTECHNICAL COMMISSION</p>
|
194
183
|
<p class="zzSTDTitle1">____________</p>
|