isodoc 0.4.5 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,227 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "processes unordered lists" do
5
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <foreword>
8
+ <ul id="_61961034-0fb1-436b-b281-828857a59ddb">
9
+ <li>
10
+ <p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
11
+ </li>
12
+ <li>
13
+ <p id="_60eb765c-1f6c-418a-8016-29efa06bf4f9">deletion of 4.3.</p>
14
+ </li>
15
+ </ul>
16
+ </foreword>
17
+ </iso-standard>
18
+ INPUT
19
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
20
+ <head>
21
+ <title>test</title>
22
+ <body lang="EN-US" link="blue" vlink="#954F72">
23
+ <div class="WordSection1">
24
+ <p>&#160;</p>
25
+ </div>
26
+ <br clear="all" class="section"/>
27
+ <div class="WordSection2">
28
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
29
+ <div>
30
+ <h1 class="ForewordTitle">Foreword</h1>
31
+ <ul>
32
+ <li>
33
+ <p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
34
+ </li>
35
+ <li>
36
+ <p id="_60eb765c-1f6c-418a-8016-29efa06bf4f9">deletion of 4.3.</p>
37
+ </li>
38
+ </ul>
39
+ </div>
40
+ <p>&#160;</p>
41
+ </div>
42
+ <br clear="all" class="section"/>
43
+ <div class="WordSection3">
44
+ <p class="zzSTDTitle1"/>
45
+ </div>
46
+ </body>
47
+ </head>
48
+ </html>
49
+ OUTPUT
50
+ end
51
+
52
+ it "processes ordered lists" do
53
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
54
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
55
+ <foreword>
56
+ <ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="alphabet">
57
+ <li>
58
+ <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
59
+ </li>
60
+ <ol>
61
+ <li>
62
+ <p id="_8a7b6299-db05-4ff8-9de7-ff019b9017b2">a reference to this document (i.e. ISO 17301-1);</p>
63
+ </li>
64
+ <ol>
65
+ <li>
66
+ <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
67
+ </li>
68
+ </ol>
69
+ </ol>
70
+ </ol>
71
+ </foreword>
72
+ </iso-standard>
73
+ INPUT
74
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
75
+ <head>
76
+ <title>test</title>
77
+ <body lang="EN-US" link="blue" vlink="#954F72">
78
+ <div class="WordSection1">
79
+ <p>&#160;</p>
80
+ </div>
81
+ <br clear="all" class="section"/>
82
+ <div class="WordSection2">
83
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
84
+ <div>
85
+ <h1 class="ForewordTitle">Foreword</h1>
86
+ <ol type="a">
87
+ <li>
88
+ <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
89
+ </li>
90
+ <ol type="1">
91
+ <li>
92
+ <p id="_8a7b6299-db05-4ff8-9de7-ff019b9017b2">a reference to this document (i.e. ISO 17301-1);</p>
93
+ </li>
94
+ <ol type="i">
95
+ <li>
96
+ <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
97
+ </li>
98
+ </ol>
99
+ </ol>
100
+ </ol>
101
+ </div>
102
+ <p>&#160;</p>
103
+ </div>
104
+ <br clear="all" class="section"/>
105
+ <div class="WordSection3">
106
+ <p class="zzSTDTitle1"/>
107
+ </div>
108
+ </body>
109
+ </head>
110
+ </html>
111
+ OUTPUT
112
+ end
113
+
114
+ it "processes Roman Upper ordered lists" do
115
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
116
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
117
+ <foreword>
118
+ <ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="roman_upper">
119
+ <li>
120
+ <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
121
+ </li>
122
+ <li>
123
+ <p id="_8a7b6299-db05-4ff8-9de7-ff019b9017b2">a reference to this document (i.e. ISO 17301-1);</p>
124
+ </li>
125
+ <li>
126
+ <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
127
+ </li>
128
+ </ol>
129
+ </foreword>
130
+ </iso-standard>
131
+ INPUT
132
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
133
+ <head>
134
+ <title>test</title>
135
+ <body lang="EN-US" link="blue" vlink="#954F72">
136
+ <div class="WordSection1">
137
+ <p>&#160;</p>
138
+ </div>
139
+ <br clear="all" class="section"/>
140
+ <div class="WordSection2">
141
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
142
+ <div>
143
+ <h1 class="ForewordTitle">Foreword</h1>
144
+ <ol type="a">
145
+ <li>
146
+ <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
147
+ </li>
148
+ <li>
149
+ <p id="_8a7b6299-db05-4ff8-9de7-ff019b9017b2">a reference to this document (i.e. ISO 17301-1);</p>
150
+ </li>
151
+ <li>
152
+ <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
153
+ </li>
154
+ </ol>
155
+ </div>
156
+ <p>&#160;</p>
157
+ </div>
158
+ <br clear="all" class="section"/>
159
+ <div class="WordSection3">
160
+ <p class="zzSTDTitle1"/>
161
+ </div>
162
+ </body>
163
+ </head>
164
+ </html>
165
+ OUTPUT
166
+ end
167
+
168
+ it "processes definition lists" do
169
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
170
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
171
+ <foreword>
172
+ <dl id="_732d3f57-4f88-40bf-9ae9-633891edc395">
173
+ <dt>
174
+ W
175
+ </dt>
176
+ <dd>
177
+ <p id="_05d81174-3a41-44af-94d8-c78b8d2e175d">mass fraction of gelatinized kernels, expressed in per cent</p>
178
+ </dd>
179
+ <dt><stem type="AsciiMath">w</stem></dt>
180
+ <dd><p>??</p></dd>
181
+ </dl>
182
+ </foreword>
183
+ </iso-standard>
184
+ INPUT
185
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
186
+ <head>
187
+ <title>test</title>
188
+ <body lang="EN-US" link="blue" vlink="#954F72">
189
+ <div class="WordSection1">
190
+ <p>&#160;</p>
191
+ </div>
192
+ <br clear="all" class="section"/>
193
+ <div class="WordSection2">
194
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
195
+ <div>
196
+ <h1 class="ForewordTitle">Foreword</h1>
197
+ <dl>
198
+ <dt>
199
+ <p>
200
+ W
201
+ </p>
202
+ </dt>
203
+ <dd>
204
+ <p id="_05d81174-3a41-44af-94d8-c78b8d2e175d">mass fraction of gelatinized kernels, expressed in per cent</p>
205
+ </dd>
206
+ <dt>
207
+ <span class="stem">(#(w)#)</span>
208
+ </dt>
209
+ <dd>
210
+ <p>??</p>
211
+ </dd>
212
+ </dl>
213
+ </div>
214
+ <p>&#160;</p>
215
+ </div>
216
+ <br clear="all" class="section"/>
217
+ <div class="WordSection3">
218
+ <p class="zzSTDTitle1"/>
219
+ </div>
220
+ </body>
221
+ </head>
222
+ </html>
223
+ OUTPUT
224
+ end
225
+
226
+ end
227
+
@@ -0,0 +1,419 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "processes section names" do
5
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <foreword obligation="informative">
8
+ <title>Foreword</title>
9
+ <p id="A">This is a preamble</p>
10
+ </foreword>
11
+ <introduction id="B" obligation="informative"><title>Introduction</title><subsection id="C" inline-header="false" obligation="informative">
12
+ <title>Introduction Subsection</title>
13
+ </subsection>
14
+ <patent-notice>
15
+ <p>This is patent boilerplate</p>
16
+ </patent-notice>
17
+ </introduction><sections>
18
+ <clause id="D" obligation="normative">
19
+ <title>Scope</title>
20
+ <p id="E">Text</p>
21
+ </clause>
22
+
23
+ <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
24
+ <title>Normal Terms</title>
25
+ <term id="J">
26
+ <preferred>Term2</preferred>
27
+ </term>
28
+ </terms>
29
+ <symbols-abbrevs id="K">
30
+ <dl>
31
+ <dt>Symbol</dt>
32
+ <dd>Definition</dd>
33
+ </dl>
34
+ </symbols-abbrevs>
35
+ </terms>
36
+ <symbols-abbrevs id="L">
37
+ <dl>
38
+ <dt>Symbol</dt>
39
+ <dd>Definition</dd>
40
+ </dl>
41
+ </symbols-abbrevs>
42
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><subsection id="N" inline-header="false" obligation="normative">
43
+ <title>Introduction</title>
44
+ </subsection>
45
+ <subsection id="O" inline-header="false" obligation="normative">
46
+ <title>Clause 4.2</title>
47
+ </subsection></clause>
48
+
49
+ </sections><annex id="P" inline-header="false" obligation="normative">
50
+ <title>Annex</title>
51
+ <subsection id="Q" inline-header="false" obligation="normative">
52
+ <title>Annex A.1</title>
53
+ <subsection id="Q1" inline-header="false" obligation="normative">
54
+ <title>Annex A.1a</title>
55
+ </subsection>
56
+ </subsection>
57
+ </annex><references id="R" obligation="informative">
58
+ <title>Normative References</title>
59
+ </references><references id="S" obligation="informative">
60
+ <title>Bibliography</title>
61
+ <references id="T" obligation="informative">
62
+ <title>Bibliography Subsection</title>
63
+ </references>
64
+ </references>
65
+ </iso-standard>
66
+ INPUT
67
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
68
+ <head>
69
+ <title>test</title>
70
+ <body lang="EN-US" link="blue" vlink="#954F72">
71
+ <div class="WordSection1">
72
+ <p>&#160;</p>
73
+ </div>
74
+ <br clear="all" class="section"/>
75
+ <div class="WordSection2">
76
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
77
+ <div>
78
+ <h1 class="ForewordTitle">Foreword</h1>
79
+ <p id="A">This is a preamble</p>
80
+ </div>
81
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
82
+ <div class="Section3" id="B">
83
+ <h1 class="IntroTitle">0.<span style="mso-tab-count:1">&#160; </span>Introduction</h1>
84
+ <div id="C">
85
+ <h2>0.1. Introduction Subsection</h2>
86
+ </div>
87
+ <p>This is patent boilerplate</p>
88
+ </div>
89
+ <p>&#160;</p>
90
+ </div>
91
+ <br clear="all" class="section"/>
92
+ <div class="WordSection3">
93
+ <p class="zzSTDTitle1"/>
94
+ <div id="D">
95
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
96
+ <p id="E">Text</p>
97
+ </div>
98
+ <div>
99
+ <h1>2.<span style="mso-tab-count:1">&#160; </span>Normative References</h1>
100
+ <p>There are no normative references in this document.</p>
101
+ </div>
102
+ <div id="H"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>For the purposes of this document,
103
+ the following terms and definitions apply.</p>
104
+ <p>ISO and IEC maintain terminological databases for use in
105
+ standardization at the following addresses:</p>
106
+
107
+ <ul>
108
+ <li> <p>ISO Online browsing platform: available at
109
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
110
+ <li> <p>IEC Electropedia: available at
111
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
112
+ </p> </li> </ul>
113
+ <div id="I">
114
+ <h2>3.1. Normal Terms</h2>
115
+ <p class="TermNum" id="J">3.1.1</p>
116
+ <p class="Terms">Term2</p>
117
+
118
+ </div><div id="K"><h2>3.2. Symbols and Abbreviated Terms</h2>
119
+ <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
120
+ </div></div>
121
+ <div id="L" class="Symbols">
122
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Symbols and Abbreviated Terms</h1>
123
+ <dl>
124
+ <dt>
125
+ <p>Symbol</p>
126
+ </dt>
127
+ <dd>Definition</dd>
128
+ </dl>
129
+ </div>
130
+ <div id="M">
131
+ <h1>5.<span style="mso-tab-count:1">&#160; </span>Clause 4</h1>
132
+ <div id="N">
133
+ <h2>5.1. Introduction</h2>
134
+ </div>
135
+ <div id="O">
136
+ <h2>5.2. Clause 4.2</h2>
137
+ </div>
138
+ </div>
139
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
140
+ <div id="P" class="Section3">
141
+ <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
142
+ <div id="Q">
143
+ <h2>A.1. Annex A.1</h2>
144
+ <div id="Q1">
145
+ <h3>A.1.1. Annex A.1a</h3>
146
+ </div>
147
+ </div>
148
+ </div>
149
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
150
+ <div>
151
+ <h1 class="Section3">Bibliography</h1>
152
+ <div>
153
+ <h2 class="Section3">Bibliography Subsection</h2>
154
+ </div>
155
+ </div>
156
+ </div>
157
+ </body>
158
+ </head>
159
+ </html>
160
+ OUTPUT
161
+ end
162
+
163
+ it "processes simple terms & definitions" do
164
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
165
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
166
+ <sections>
167
+ <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
168
+ <term id="J">
169
+ <preferred>Term2</preferred>
170
+ </term>
171
+ </terms>
172
+ </sections>
173
+ </iso-standard>
174
+ INPUT
175
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
176
+ <head>
177
+ <title>test</title>
178
+ <body lang="EN-US" link="blue" vlink="#954F72">
179
+ <div class="WordSection1">
180
+ <p>&#160;</p>
181
+ </div>
182
+ <br clear="all" class="section"/>
183
+ <div class="WordSection2">
184
+ <p>&#160;</p>
185
+ </div>
186
+ <br clear="all" class="section"/>
187
+ <div class="WordSection3">
188
+ <p class="zzSTDTitle1"/>
189
+ <div id="H"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>For the purposes of this document,
190
+ the following terms and definitions apply.</p>
191
+ <p>ISO and IEC maintain terminological databases for use in
192
+ standardization at the following addresses:</p>
193
+
194
+ <ul>
195
+ <li> <p>ISO Online browsing platform: available at
196
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
197
+ <li> <p>IEC Electropedia: available at
198
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
199
+ </p> </li> </ul>
200
+ <p class="TermNum" id="J">3.1</p>
201
+ <p class="Terms">Term2</p>
202
+ </div>
203
+ </div>
204
+ </body>
205
+ </head>
206
+ </html>
207
+ OUTPUT
208
+ end
209
+
210
+ it "processes terms & definitions with external source" do
211
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
212
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
213
+ <sections>
214
+ <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
215
+ <source type="inline" bibitemid="ISO712" citeas="ISO 712"/>
216
+ <term id="J">
217
+ <preferred>Term2</preferred>
218
+ </term>
219
+ </terms>
220
+ </sections>
221
+ <references id="_normative_references" obligation="informative"><title>Normative References</title>
222
+ <bibitem id="ISO712" type="standard">
223
+ <title format="text/plain">Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</title>
224
+ <docidentifier>ISO 712</docidentifier>
225
+ <contributor>
226
+ <role type="publisher"/>
227
+ <organization>
228
+ <name>ISO</name>
229
+ </organization>
230
+ </contributor>
231
+ </bibitem></references>
232
+ </iso-standard>
233
+ INPUT
234
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
235
+ <head>
236
+ <title>test</title>
237
+ <body lang="EN-US" link="blue" vlink="#954F72">
238
+ <div class="WordSection1">
239
+ <p>&#160;</p>
240
+ </div>
241
+ <br clear="all" class="section"/>
242
+ <div class="WordSection2">
243
+ <p>&#160;</p>
244
+ </div>
245
+ <br clear="all" class="section"/>
246
+ <div class="WordSection3">
247
+ <p class="zzSTDTitle1"/>
248
+ <div>
249
+ <h1>2.<span style="mso-tab-count:1">&#160; </span>Normative References</h1>
250
+ <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
251
+ <p id="ISO712">ISO 712, <i> Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</i></p>
252
+ </div>
253
+ <div id="H"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>For the purposes of this document, the terms and definitions
254
+ given in ISO 712 and the following apply.</p>
255
+ <p>ISO and IEC maintain terminological databases for use in
256
+ standardization at the following addresses:</p>
257
+
258
+ <ul>
259
+ <li> <p>ISO Online browsing platform: available at
260
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
261
+ <li> <p>IEC Electropedia: available at
262
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
263
+ </p> </li> </ul>
264
+ <p class="TermNum" id="J">3.1</p>
265
+ <p class="Terms">Term2</p>
266
+ </div>
267
+ </div>
268
+ </body>
269
+ </head>
270
+ </html>
271
+ OUTPUT
272
+ end
273
+
274
+ it "processes empty terms & definitions with external source" do
275
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
276
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
277
+ <sections>
278
+ <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
279
+ <source type="inline" bibitemid="ISO712" citeas="ISO 712"/>
280
+ </terms>
281
+ </sections>
282
+ <references id="_normative_references" obligation="informative"><title>Normative References</title>
283
+ <bibitem id="ISO712" type="standard">
284
+ <title format="text/plain">Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</title>
285
+ <docidentifier>ISO 712</docidentifier>
286
+ <contributor>
287
+ <role type="publisher"/>
288
+ <organization>
289
+ <name>ISO</name>
290
+ </organization>
291
+ </contributor>
292
+ </bibitem></references>
293
+ </iso-standard>
294
+ INPUT
295
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
296
+ <head>
297
+ <title>test</title>
298
+ <body lang="EN-US" link="blue" vlink="#954F72">
299
+ <div class="WordSection1">
300
+ <p>&#160;</p>
301
+ </div>
302
+ <br clear="all" class="section"/>
303
+ <div class="WordSection2">
304
+ <p>&#160;</p>
305
+ </div>
306
+ <br clear="all" class="section"/>
307
+ <div class="WordSection3">
308
+ <p class="zzSTDTitle1"/>
309
+ <div>
310
+ <h1>2.<span style="mso-tab-count:1">&#160; </span>Normative References</h1>
311
+ <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
312
+ <p id="ISO712">ISO 712, <i> Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</i></p>
313
+ </div>
314
+ <div id="H"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>For the purposes of this document,
315
+ the terms and definitions given in ISO 712 apply.</p>
316
+ <p>ISO and IEC maintain terminological databases for use in
317
+ standardization at the following addresses:</p>
318
+
319
+ <ul>
320
+ <li> <p>ISO Online browsing platform: available at
321
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
322
+ <li> <p>IEC Electropedia: available at
323
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
324
+ </p> </li> </ul>
325
+ </div>
326
+ </div>
327
+ </body>
328
+ </head>
329
+ </html>
330
+ OUTPUT
331
+ end
332
+
333
+
334
+ it "processes empty terms & definitions" do
335
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
336
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
337
+ <sections>
338
+ <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
339
+ </terms>
340
+ </sections>
341
+ </iso-standard>
342
+ INPUT
343
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
344
+ <head>
345
+ <title>test</title>
346
+ <body lang="EN-US" link="blue" vlink="#954F72">
347
+ <div class="WordSection1">
348
+ <p>&#160;</p>
349
+ </div>
350
+ <br clear="all" class="section"/>
351
+ <div class="WordSection2">
352
+ <p>&#160;</p>
353
+ </div>
354
+ <br clear="all" class="section"/>
355
+ <div class="WordSection3">
356
+ <p class="zzSTDTitle1"/>
357
+ <div id="H"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>No terms and definitions are listed in this document.</p>
358
+ <p>ISO and IEC maintain terminological databases for use in
359
+ standardization at the following addresses:</p>
360
+
361
+ <ul>
362
+ <li> <p>ISO Online browsing platform: available at
363
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
364
+ <li> <p>IEC Electropedia: available at
365
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
366
+ </p> </li> </ul>
367
+ </div>
368
+ </div>
369
+ </body>
370
+ </head>
371
+ </html>
372
+ OUTPUT
373
+ end
374
+
375
+ it "processes inline section headers" do
376
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
377
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
378
+ <sections>
379
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><subsection id="N" inline-header="false" obligation="normative">
380
+ <title>Introduction</title>
381
+ </subsection>
382
+ <subsection id="O" inline-header="true" obligation="normative">
383
+ <title>Clause 4.2</title>
384
+ </subsection></clause>
385
+
386
+ </sections>
387
+ </iso-standard>
388
+ INPUT
389
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
390
+ <head>
391
+ <title>test</title>
392
+ <body lang="EN-US" link="blue" vlink="#954F72">
393
+ <div class="WordSection1">
394
+ <p>&#160;</p>
395
+ </div>
396
+ <br clear="all" class="section"/>
397
+ <div class="WordSection2">
398
+ <p>&#160;</p>
399
+ </div>
400
+ <br clear="all" class="section"/>
401
+ <div class="WordSection3">
402
+ <p class="zzSTDTitle1"/>
403
+ <div id="M">
404
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Clause 4</h1>
405
+ <div id="N">
406
+ <h2>4.1. Introduction</h2>
407
+ </div>
408
+ <div id="O">
409
+ <span class="zzMoveToFollowing"><b>4.2. Clause 4.2 </b></span>
410
+ </div>
411
+ </div>
412
+ </div>
413
+ </body>
414
+ </head>
415
+ </html>
416
+ OUTPUT
417
+ end
418
+
419
+ end