metanorma-iec 2.1.11 → 2.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/iec/iec.international-standard.xsl +274 -100
- data/lib/isodoc/iec/presentation_xml_convert.rb +8 -6
- data/lib/metanorma/iec/biblio.rng +5 -0
- data/lib/metanorma/iec/iec_intro_en.xml +11 -12
- data/lib/metanorma/iec/iec_intro_fr.xml +11 -11
- data/lib/metanorma/iec/isodoc.rng +46 -12
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +5 -2
- metadata +4 -36
- data/.github/workflows/automerge.yml +0 -31
- data/.github/workflows/rake.yml +0 -15
- data/.github/workflows/release.yml +0 -24
- data/Rakefile +0 -8
- data/bin/rspec +0 -18
- data/spec/assets/header.html +0 -7
- data/spec/assets/html.css +0 -2
- data/spec/assets/iso.xml +0 -71
- data/spec/assets/rice_image1.png +0 -0
- data/spec/assets/word.css +0 -2
- data/spec/assets/wordintro.html +0 -4
- data/spec/assets/xref_error.adoc +0 -7
- data/spec/isodoc/blocks_spec.rb +0 -200
- data/spec/isodoc/i18n_spec.rb +0 -607
- data/spec/isodoc/iev_spec.rb +0 -888
- data/spec/isodoc/inline_spec.rb +0 -256
- data/spec/isodoc/iso_spec.rb +0 -211
- data/spec/isodoc/metadata_spec.rb +0 -251
- data/spec/isodoc/postproc_spec.rb +0 -303
- data/spec/isodoc/ref_spec.rb +0 -335
- data/spec/isodoc/section_spec.rb +0 -566
- data/spec/isodoc/terms_spec.rb +0 -192
- data/spec/metanorma/base_spec.rb +0 -1041
- data/spec/metanorma/blocks_spec.rb +0 -470
- data/spec/metanorma/cleanup_spec.rb +0 -372
- data/spec/metanorma/iev_spec.rb +0 -254
- data/spec/metanorma/inline_spec.rb +0 -145
- data/spec/metanorma/lists_spec.rb +0 -194
- data/spec/metanorma/processor_spec.rb +0 -171
- data/spec/metanorma/section_spec.rb +0 -348
- data/spec/metanorma/validate_spec.rb +0 -56
- data/spec/spec_helper.rb +0 -305
data/spec/isodoc/inline_spec.rb
DELETED
@@ -1,256 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe IsoDoc do
|
4
|
-
it "processes inline formatting" do
|
5
|
-
input = <<~INPUT
|
6
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
-
<preface><foreword>
|
8
|
-
<p>
|
9
|
-
<em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
|
10
|
-
<strike>F</strike> <smallcap>G</smallcap> <br/> <hr/>
|
11
|
-
<bookmark id="H"/> <pagebreak/>
|
12
|
-
</p>
|
13
|
-
</foreword></preface>
|
14
|
-
<sections>
|
15
|
-
</iso-standard>
|
16
|
-
INPUT
|
17
|
-
output = <<~OUTPUT
|
18
|
-
#{HTML_HDR}
|
19
|
-
<div>
|
20
|
-
<h1 class="ForewordTitle">FOREWORD</h1>
|
21
|
-
<div class="boilerplate_legal"/>
|
22
|
-
<p>
|
23
|
-
<i>A</i> <b>B</b> <sup>C</sup> <sub>D</sub> <tt>E</tt>
|
24
|
-
<s>F</s> <span style="font-variant:small-caps;">G</span> <br/> <hr/>
|
25
|
-
<a id="H"/> <br/>
|
26
|
-
</p>
|
27
|
-
</div>
|
28
|
-
#{IEC_TITLE1}
|
29
|
-
</div>
|
30
|
-
</body>
|
31
|
-
</html>
|
32
|
-
OUTPUT
|
33
|
-
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({})
|
34
|
-
.convert("test", input, true)))
|
35
|
-
.to be_equivalent_to xmlpp(output)
|
36
|
-
end
|
37
|
-
|
38
|
-
it "processes links" do
|
39
|
-
input = <<~INPUT
|
40
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
41
|
-
<preface><foreword>
|
42
|
-
<p>
|
43
|
-
<link target="http://example.com"/>
|
44
|
-
<link target="http://example.com">example</link>
|
45
|
-
<link target="mailto:fred@example.com"/>
|
46
|
-
<link target="mailto:fred@example.com">mailto:fred@example.com</link>
|
47
|
-
</p>
|
48
|
-
</foreword></preface>
|
49
|
-
<sections>
|
50
|
-
</iso-standard>
|
51
|
-
INPUT
|
52
|
-
output = <<~OUTPUT
|
53
|
-
#{HTML_HDR}
|
54
|
-
<div>
|
55
|
-
<h1 class="ForewordTitle">FOREWORD</h1>
|
56
|
-
<div class="boilerplate_legal"/>
|
57
|
-
<p>
|
58
|
-
<a href="http://example.com">http://example.com</a>
|
59
|
-
<a href="http://example.com">example</a>
|
60
|
-
<a href="mailto:fred@example.com">fred@example.com</a>
|
61
|
-
<a href="mailto:fred@example.com">mailto:fred@example.com</a>
|
62
|
-
</p>
|
63
|
-
</div>
|
64
|
-
#{IEC_TITLE1}
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
68
|
-
OUTPUT
|
69
|
-
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({})
|
70
|
-
.convert("test", input, true)))
|
71
|
-
.to be_equivalent_to xmlpp(output)
|
72
|
-
end
|
73
|
-
|
74
|
-
it "processes unrecognised markup" do
|
75
|
-
input = <<~INPUT
|
76
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
77
|
-
<preface><foreword>
|
78
|
-
<p>
|
79
|
-
<barry fred="http://example.com">example</barry>
|
80
|
-
</p>
|
81
|
-
</foreword></preface>
|
82
|
-
<sections>
|
83
|
-
</iso-standard>
|
84
|
-
INPUT
|
85
|
-
output = <<~OUTPUT
|
86
|
-
#{HTML_HDR}
|
87
|
-
<div>
|
88
|
-
<h1 class="ForewordTitle">FOREWORD</h1>
|
89
|
-
<div class="boilerplate_legal"/>
|
90
|
-
<p>
|
91
|
-
<para><b role="strong"><barry fred="http://example.com">example</barry></b></para>
|
92
|
-
</p>
|
93
|
-
</div>
|
94
|
-
#{IEC_TITLE1}
|
95
|
-
</div>
|
96
|
-
</body>
|
97
|
-
</html>
|
98
|
-
OUTPUT
|
99
|
-
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({})
|
100
|
-
.convert("test", input, true)))
|
101
|
-
.to be_equivalent_to xmlpp(output)
|
102
|
-
end
|
103
|
-
|
104
|
-
it "overrides AsciiMath delimiters" do
|
105
|
-
input = <<~INPUT
|
106
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
107
|
-
<preface><foreword>
|
108
|
-
<p>
|
109
|
-
<stem type="AsciiMath">A</stem>
|
110
|
-
(#((Hello))#)
|
111
|
-
</p>
|
112
|
-
</foreword></preface>
|
113
|
-
<sections>
|
114
|
-
</iso-standard>
|
115
|
-
INPUT
|
116
|
-
output = <<~OUTPUT
|
117
|
-
#{HTML_HDR}
|
118
|
-
<div>
|
119
|
-
<h1 class="ForewordTitle">FOREWORD</h1>
|
120
|
-
<div class="boilerplate_legal"/>
|
121
|
-
<p>
|
122
|
-
<span class="stem">(#(((A)#)))</span>
|
123
|
-
(#((Hello))#)
|
124
|
-
</p>
|
125
|
-
</div>
|
126
|
-
#{IEC_TITLE1}
|
127
|
-
</div>
|
128
|
-
</body>
|
129
|
-
</html>
|
130
|
-
OUTPUT
|
131
|
-
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({})
|
132
|
-
.convert("test", input, true)))
|
133
|
-
.to be_equivalent_to xmlpp(output)
|
134
|
-
end
|
135
|
-
|
136
|
-
it "processes eref content" do
|
137
|
-
input = <<~INPUT
|
138
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
139
|
-
<preface><foreword>
|
140
|
-
<p>
|
141
|
-
<eref type="inline" bibitemid="IEV" citeas="IEV"><locality type="clause"><referenceFrom>1-2-3</referenceFrom></locality></eref>
|
142
|
-
<eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
|
143
|
-
<eref type="inline" bibitemid="ISO712"/>
|
144
|
-
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
145
|
-
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
|
146
|
-
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
147
|
-
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="list"><referenceFrom>a</referenceFrom></locality></eref>
|
148
|
-
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
149
|
-
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
|
150
|
-
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
151
|
-
<eref type="inline" bibitemid="ISO712"><locality type="whole"></locality></eref>
|
152
|
-
<eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
|
153
|
-
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
|
154
|
-
</p>
|
155
|
-
</foreword></preface>
|
156
|
-
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
157
|
-
<bibitem id="ISO712" type="standard">
|
158
|
-
<title format="text/plain">Cereals and cereal products</title>
|
159
|
-
<docidentifier>ISO 712</docidentifier>
|
160
|
-
<contributor>
|
161
|
-
<role type="publisher"/>
|
162
|
-
<organization>
|
163
|
-
<abbreviation>ISO</abbreviation>
|
164
|
-
</organization>
|
165
|
-
</contributor>
|
166
|
-
</bibitem>
|
167
|
-
</references>
|
168
|
-
</bibliography>
|
169
|
-
</iso-standard>
|
170
|
-
INPUT
|
171
|
-
output = <<~OUTPUT
|
172
|
-
<foreword displayorder="1">
|
173
|
-
<p>
|
174
|
-
<eref type='inline' bibitemid='IEV' citeas='IEV'>
|
175
|
-
<locality type='clause'>
|
176
|
-
<referenceFrom>1-2-3</referenceFrom>
|
177
|
-
</locality>
|
178
|
-
<span class='stdpublisher'>IEV</span>, <span class='citesec'>1-2-3</span>
|
179
|
-
</eref>
|
180
|
-
<eref type='inline' bibitemid='ISO712' citeas='ISO 712'><span class='stdpublisher'>ISO</span>
|
181
|
-
<span class='stddocNumber'>712</span>
|
182
|
-
</eref>
|
183
|
-
<eref type='inline' bibitemid='ISO712'>ISO 712</eref>
|
184
|
-
<eref type='inline' bibitemid='ISO712'>
|
185
|
-
<locality type='table'>
|
186
|
-
<referenceFrom>1</referenceFrom>
|
187
|
-
</locality>
|
188
|
-
ISO 712, <span class='citetbl'>Table 1</span>
|
189
|
-
</eref>
|
190
|
-
<eref type='inline' bibitemid='ISO712'>
|
191
|
-
<locality type='table'>
|
192
|
-
<referenceFrom>1</referenceFrom>
|
193
|
-
<referenceTo>1</referenceTo>
|
194
|
-
</locality>
|
195
|
-
ISO 712, <span class='citetbl'>Table 1–1</span>
|
196
|
-
</eref>
|
197
|
-
<eref type='inline' bibitemid='ISO712'>
|
198
|
-
<locality type='clause'>
|
199
|
-
<referenceFrom>1</referenceFrom>
|
200
|
-
</locality>
|
201
|
-
<locality type='table'>
|
202
|
-
<referenceFrom>1</referenceFrom>
|
203
|
-
</locality>
|
204
|
-
ISO 712, <span class='citesec'>Clause 1</span>, <span class='citetbl'>Table 1</span>
|
205
|
-
</eref>
|
206
|
-
<eref type='inline' bibitemid='ISO712'>
|
207
|
-
<locality type='clause'>
|
208
|
-
<referenceFrom>1</referenceFrom>
|
209
|
-
</locality>
|
210
|
-
<locality type='list'>
|
211
|
-
<referenceFrom>a</referenceFrom>
|
212
|
-
</locality>
|
213
|
-
ISO 712, <span class='citesec'>Clause 1</span> a)
|
214
|
-
</eref>
|
215
|
-
<eref type='inline' bibitemid='ISO712'>
|
216
|
-
<locality type='clause'>
|
217
|
-
<referenceFrom>1</referenceFrom>
|
218
|
-
</locality>
|
219
|
-
ISO 712, <span class='citesec'>Clause 1</span>
|
220
|
-
</eref>
|
221
|
-
<eref type='inline' bibitemid='ISO712'>
|
222
|
-
<locality type='clause'>
|
223
|
-
<referenceFrom>1.5</referenceFrom>
|
224
|
-
</locality>
|
225
|
-
ISO 712, <span class='citesec'>1.5</span>
|
226
|
-
</eref>
|
227
|
-
<eref type='inline' bibitemid='ISO712'>
|
228
|
-
<locality type='table'>
|
229
|
-
<referenceFrom>1</referenceFrom>
|
230
|
-
</locality>
|
231
|
-
A
|
232
|
-
</eref>
|
233
|
-
<eref type='inline' bibitemid='ISO712'>
|
234
|
-
<locality type='whole'/>
|
235
|
-
ISO 712, Whole of text
|
236
|
-
</eref>
|
237
|
-
<eref type='inline' bibitemid='ISO712'>
|
238
|
-
<locality type='locality:prelude'>
|
239
|
-
<referenceFrom>7</referenceFrom>
|
240
|
-
</locality>
|
241
|
-
ISO 712, Prelude 7
|
242
|
-
</eref>
|
243
|
-
<eref type='inline' bibitemid='ISO712' citeas='ISO 712'>A</eref>
|
244
|
-
</p>
|
245
|
-
</foreword>
|
246
|
-
OUTPUT
|
247
|
-
expect(xmlpp(
|
248
|
-
Nokogiri::XML(
|
249
|
-
IsoDoc::Iec::PresentationXMLConvert.new({})
|
250
|
-
.convert("test", input, true),
|
251
|
-
)
|
252
|
-
.at("//xmlns:foreword").to_xml,
|
253
|
-
))
|
254
|
-
.to be_equivalent_to xmlpp(output)
|
255
|
-
end
|
256
|
-
end
|
data/spec/isodoc/iso_spec.rb
DELETED
@@ -1,211 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "fileutils"
|
3
|
-
|
4
|
-
RSpec.describe IsoDoc::Iec do
|
5
|
-
FileUtils.rm_f "test.html"
|
6
|
-
it "processes isodoc as ISO: HTML output" do
|
7
|
-
IsoDoc::Iec::HtmlConvert.new({})
|
8
|
-
.convert("test", <<~"INPUT", false)
|
9
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
10
|
-
<preface><foreword>
|
11
|
-
<note>
|
12
|
-
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
13
|
-
</note>
|
14
|
-
</foreword></preface>
|
15
|
-
</iso-standard>
|
16
|
-
INPUT
|
17
|
-
html = File.read("test.html", encoding: "utf-8")
|
18
|
-
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
19
|
-
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Arial", sans-serif;]m)
|
20
|
-
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Arial", sans-serif;]m)
|
21
|
-
end
|
22
|
-
|
23
|
-
it "processes isodoc as ISO: Chinese HTML output" do
|
24
|
-
FileUtils.rm_f "test.html"
|
25
|
-
IsoDoc::Iec::HtmlConvert.new({ script: "Hans" })
|
26
|
-
.convert("test", <<~"INPUT", false)
|
27
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
28
|
-
<preface><foreword>
|
29
|
-
<note>
|
30
|
-
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
31
|
-
</note>
|
32
|
-
</foreword></preface>
|
33
|
-
</iso-standard>
|
34
|
-
INPUT
|
35
|
-
html = File.read("test.html", encoding: "utf-8")
|
36
|
-
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
37
|
-
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
|
38
|
-
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "processes isodoc as ISO: user nominated fonts" do
|
42
|
-
FileUtils.rm_f "test.html"
|
43
|
-
IsoDoc::Iec::HtmlConvert
|
44
|
-
.new({ bodyfont: "Zapf Chancery", headerfont: "Comic Sans",
|
45
|
-
monospacefont: "Andale Mono" })
|
46
|
-
.convert("test", <<~"INPUT", false)
|
47
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
48
|
-
<preface><foreword>
|
49
|
-
<note>
|
50
|
-
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
51
|
-
</note>
|
52
|
-
</foreword></preface>
|
53
|
-
</iso-standard>
|
54
|
-
INPUT
|
55
|
-
html = File.read("test.html", encoding: "utf-8")
|
56
|
-
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: Andale Mono;]m)
|
57
|
-
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: Zapf Chancery;]m)
|
58
|
-
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: Comic Sans;]m)
|
59
|
-
end
|
60
|
-
|
61
|
-
it "processes isodoc as ISO: Word output" do
|
62
|
-
FileUtils.rm_f "test.doc"
|
63
|
-
IsoDoc::Iec::WordConvert.new({})
|
64
|
-
.convert("test", <<~"INPUT", false)
|
65
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
66
|
-
<preface><foreword>
|
67
|
-
<note>
|
68
|
-
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
69
|
-
</note>
|
70
|
-
</foreword></preface>
|
71
|
-
</iso-standard>
|
72
|
-
INPUT
|
73
|
-
html = File.read("test.doc", encoding: "utf-8")
|
74
|
-
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
75
|
-
expect(html).to match(%r[Quote[^{]+\{[^{]+font-family: "Arial", sans-serif;]m)
|
76
|
-
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Arial", sans-serif;]m)
|
77
|
-
end
|
78
|
-
|
79
|
-
it "processes examples" do
|
80
|
-
input = <<~INPUT
|
81
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
82
|
-
<preface><foreword>
|
83
|
-
<example id="samplecode">
|
84
|
-
<name>EXAMPLE</name>
|
85
|
-
<p>Hello</p>
|
86
|
-
</example>
|
87
|
-
</foreword></preface>
|
88
|
-
</iso-standard>
|
89
|
-
INPUT
|
90
|
-
html = <<~OUTPUT
|
91
|
-
#{HTML_HDR}
|
92
|
-
<div>
|
93
|
-
<h1 class="ForewordTitle">FOREWORD</h1>
|
94
|
-
<div class="boilerplate_legal"/>
|
95
|
-
<div id="samplecode" class="example">
|
96
|
-
<p><span class="example_label">EXAMPLE</span>  Hello</p>
|
97
|
-
</div>
|
98
|
-
</div>
|
99
|
-
#{IEC_TITLE1}
|
100
|
-
</div>
|
101
|
-
</body>
|
102
|
-
</html>
|
103
|
-
OUTPUT
|
104
|
-
doc = <<~OUTPUT
|
105
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
106
|
-
<div class="WordSection2">
|
107
|
-
<p>
|
108
|
-
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
109
|
-
</p>
|
110
|
-
#{IEC_TITLE}
|
111
|
-
<div>
|
112
|
-
<h1 class="ForewordTitle">FOREWORD</h1>
|
113
|
-
<div class="boilerplate_legal"/>
|
114
|
-
<div id="samplecode" class="example">
|
115
|
-
<p><span class="example_label">EXAMPLE</span><span style="mso-tab-count:1">  </span>Hello</p>
|
116
|
-
</div>
|
117
|
-
</div>
|
118
|
-
<p> </p>
|
119
|
-
</div>
|
120
|
-
<p>
|
121
|
-
<br clear="all" class="section"/>
|
122
|
-
</p>
|
123
|
-
<div class="WordSection3">
|
124
|
-
#{IEC_TITLE1}
|
125
|
-
</div>
|
126
|
-
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
127
|
-
<div class="colophon"/>
|
128
|
-
</body>
|
129
|
-
OUTPUT
|
130
|
-
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({})
|
131
|
-
.convert("test", input, true)))
|
132
|
-
.to be_equivalent_to xmlpp(html)
|
133
|
-
expect(xmlpp(IsoDoc::Iec::WordConvert.new({})
|
134
|
-
.convert("test", input, true)
|
135
|
-
.sub(/^.*<body/m, "<body")
|
136
|
-
.sub(%r{</body>.*$}m, "</body>")))
|
137
|
-
.to be_equivalent_to xmlpp(doc)
|
138
|
-
end
|
139
|
-
|
140
|
-
it "processes sequences of examples" do
|
141
|
-
input = <<~INPUT
|
142
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
143
|
-
<preface><foreword>
|
144
|
-
<example id="samplecode">
|
145
|
-
<name>EXAMPLE 1</name>
|
146
|
-
<p>Hello</p>
|
147
|
-
</example>
|
148
|
-
<example id="samplecode2">
|
149
|
-
<name>EXAMPLE 2</name>
|
150
|
-
<p>Hello</p>
|
151
|
-
</example>
|
152
|
-
</foreword></preface>
|
153
|
-
</iso-standard>
|
154
|
-
INPUT
|
155
|
-
html = <<~OUTPUT
|
156
|
-
#{HTML_HDR}
|
157
|
-
<div>
|
158
|
-
<h1 class="ForewordTitle">FOREWORD</h1>
|
159
|
-
<div class="boilerplate_legal"/>
|
160
|
-
<div id="samplecode" class="example">
|
161
|
-
<p><span class="example_label">EXAMPLE 1</span>  Hello</p>
|
162
|
-
</div>
|
163
|
-
<div id="samplecode2" class="example">
|
164
|
-
<p><span class="example_label">EXAMPLE 2</span>  Hello</p>
|
165
|
-
</div>
|
166
|
-
</div>
|
167
|
-
#{IEC_TITLE1}
|
168
|
-
</div>
|
169
|
-
</body>
|
170
|
-
</html>
|
171
|
-
OUTPUT
|
172
|
-
|
173
|
-
doc = <<~OUTPUT
|
174
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
175
|
-
<div class="WordSection2">
|
176
|
-
<p>
|
177
|
-
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
178
|
-
</p>
|
179
|
-
#{IEC_TITLE}
|
180
|
-
<div>
|
181
|
-
<h1 class="ForewordTitle">FOREWORD</h1>
|
182
|
-
<div class="boilerplate_legal"/>
|
183
|
-
<div id="samplecode" class="example">
|
184
|
-
<p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">  </span>Hello</p>
|
185
|
-
</div>
|
186
|
-
<div id="samplecode2" class="example">
|
187
|
-
<p><span class="example_label">EXAMPLE 2</span><span style="mso-tab-count:1">  </span>Hello</p>
|
188
|
-
</div>
|
189
|
-
</div>
|
190
|
-
<p> </p>
|
191
|
-
</div>
|
192
|
-
<p>
|
193
|
-
<br clear="all" class="section"/>
|
194
|
-
</p>
|
195
|
-
<div class="WordSection3">
|
196
|
-
#{IEC_TITLE1}
|
197
|
-
</div>
|
198
|
-
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
199
|
-
<div class="colophon"/>
|
200
|
-
</body>
|
201
|
-
OUTPUT
|
202
|
-
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({})
|
203
|
-
.convert("test", input, true)))
|
204
|
-
.to be_equivalent_to xmlpp(html)
|
205
|
-
expect(xmlpp(IsoDoc::Iec::WordConvert.new({})
|
206
|
-
.convert("test", input, true)
|
207
|
-
.sub(/^.*<body/m, "<body")
|
208
|
-
.sub(%r{</body>.*$}m, "</body>")))
|
209
|
-
.to be_equivalent_to xmlpp(doc)
|
210
|
-
end
|
211
|
-
end
|