isodoc 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.tb.yml +20 -10
  3. data/lib/isodoc/blocks.rb +13 -13
  4. data/lib/isodoc/cleanup.rb +19 -3
  5. data/lib/isodoc/comments.rb +1 -1
  6. data/lib/isodoc/convert.rb +2 -0
  7. data/lib/isodoc/footnotes.rb +4 -2
  8. data/lib/isodoc/html.rb +28 -10
  9. data/lib/isodoc/i18n-en.yaml +9 -0
  10. data/lib/isodoc/i18n-fr.yaml +12 -3
  11. data/lib/isodoc/i18n-zh-Hans.yaml +10 -1
  12. data/lib/isodoc/i18n.rb +9 -2
  13. data/lib/isodoc/inline.rb +5 -6
  14. data/lib/isodoc/iso2wordhtml.rb +9 -6
  15. data/lib/isodoc/lists.rb +7 -5
  16. data/lib/isodoc/metadata.rb +27 -10
  17. data/lib/isodoc/references.rb +12 -6
  18. data/lib/isodoc/section.rb +17 -11
  19. data/lib/isodoc/table.rb +2 -4
  20. data/lib/isodoc/terms.rb +3 -3
  21. data/lib/isodoc/utils.rb +15 -14
  22. data/lib/isodoc/version.rb +1 -1
  23. data/lib/isodoc/wordconvert/comments.rb +1 -1
  24. data/lib/isodoc/wordconvert/wordconvertmodule.rb +51 -12
  25. data/lib/isodoc/xref_gen.rb +30 -26
  26. data/lib/isodoc/xref_sect_gen.rb +31 -13
  27. data/spec/assets/scripts.html +1 -0
  28. data/spec/isodoc/blocks_spec.rb +50 -49
  29. data/spec/isodoc/cleanup_spec.rb +6 -6
  30. data/spec/isodoc/footnotes_spec.rb +10 -2
  31. data/spec/isodoc/i18n_spec.rb +86 -54
  32. data/spec/isodoc/inline_spec.rb +22 -18
  33. data/spec/isodoc/lists_spec.rb +25 -11
  34. data/spec/isodoc/metadata_spec.rb +4 -3
  35. data/spec/isodoc/postproc_spec.rb +108 -42
  36. data/spec/isodoc/ref_spec.rb +9 -7
  37. data/spec/isodoc/section_spec.rb +162 -141
  38. data/spec/isodoc/table_spec.rb +18 -16
  39. data/spec/isodoc/terms_spec.rb +9 -9
  40. data/spec/isodoc/xref_spec.rb +153 -122
  41. metadata +3 -2
@@ -4,14 +4,14 @@ RSpec.describe IsoDoc do
4
4
  it "processes IsoXML bibliographies" do
5
5
  expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
- <foreword>
7
+ <preface><foreword>
8
8
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
9
9
  <eref bibitemid="ISO712"/>
10
10
  <eref bibitemid="ref1"/>
11
11
  <eref bibitemid="ref10"/>
12
12
  </p>
13
- </foreword>
14
- <references id="_normative_references" obligation="informative"><title>Normative References</title>
13
+ </foreword></preface>
14
+ <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
15
15
  <bibitem id="ISO712" type="standard">
16
16
  <title format="text/plain">Cereals and cereal products</title>
17
17
  <docidentifier>ISO 712</docidentifier>
@@ -73,6 +73,7 @@ RSpec.describe IsoDoc do
73
73
 
74
74
 
75
75
  </references>
76
+ </bibliography>
76
77
  </iso-standard>
77
78
  INPUT
78
79
  <html xmlns:epub="http://www.idpf.org/2007/ops">
@@ -99,7 +100,7 @@ RSpec.describe IsoDoc do
99
100
  <div class="WordSection3">
100
101
  <p class="zzSTDTitle1"/>
101
102
  <div>
102
- <h1>2.&#160; Normative References</h1>
103
+ <h1>1.&#160; Normative References</h1>
103
104
  <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>
104
105
  <p id="ISO712">ISO 712, <i> Cereals and cereal products</i></p>
105
106
  <p id="ISO16634">ISO 16634:All Parts: --<a href="#ftn1" epub:type="footnote"><sup>1</sup></a>, <i> Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i></p>
@@ -113,7 +114,7 @@ RSpec.describe IsoDoc do
113
114
  <p id="ref10" class="Biblio">[10]&#160; <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
114
115
  <p id="ref11" class="Biblio">[3]&#160; IETF RFC 10,<span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
115
116
  </div>
116
- <aside id="ftn1">
117
+ <aside class="footnote" id="ftn1">
117
118
  <p>Under preparation. (Stage at the time of publication ISO/DIS 16634)</p>
118
119
  </aside>
119
120
  </div>
@@ -126,8 +127,9 @@ RSpec.describe IsoDoc do
126
127
  it "processes empty IsoXML Normative References" do
127
128
  expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
128
129
  <iso-standard xmlns="http://riboseinc.com/isoxml">
129
- <references id="_normative_references" obligation="informative"><title>Normative References</title>
130
+ <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
130
131
  </references>
132
+ </bibliography>
131
133
  </iso-standard>
132
134
  INPUT
133
135
  <html xmlns:epub="http://www.idpf.org/2007/ops">
@@ -145,7 +147,7 @@ RSpec.describe IsoDoc do
145
147
  <div class="WordSection3">
146
148
  <p class="zzSTDTitle1"/>
147
149
  <div>
148
- <h1>2.&#160; Normative References</h1>
150
+ <h1>1.&#160; Normative References</h1>
149
151
  <p>There are no normative references in this document.</p>
150
152
  </div>
151
153
  </div>
@@ -4,17 +4,18 @@ RSpec.describe IsoDoc do
4
4
  it "processes section names" do
5
5
  expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <preface>
7
8
  <foreword obligation="informative">
8
9
  <title>Foreword</title>
9
10
  <p id="A">This is a preamble</p>
10
11
  </foreword>
11
- <introduction id="B" obligation="informative"><title>Introduction</title><subsection id="C" inline-header="false" obligation="informative">
12
+ <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
12
13
  <title>Introduction Subsection</title>
13
- </subsection>
14
+ </clause>
14
15
  <patent-notice>
15
16
  <p>This is patent boilerplate</p>
16
17
  </patent-notice>
17
- </introduction><sections>
18
+ </introduction></preface><sections>
18
19
  <clause id="D" obligation="normative">
19
20
  <title>Scope</title>
20
21
  <p id="E">Text</p>
@@ -39,22 +40,25 @@ RSpec.describe IsoDoc do
39
40
  <dd>Definition</dd>
40
41
  </dl>
41
42
  </symbols-abbrevs>
42
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><subsection id="N" inline-header="false" obligation="normative">
43
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
43
44
  <title>Introduction</title>
44
- </subsection>
45
- <subsection id="O" inline-header="false" obligation="normative">
45
+ </clause>
46
+ <clause id="O" inline-header="false" obligation="normative">
46
47
  <title>Clause 4.2</title>
47
- </subsection></clause>
48
+ </clause></clause>
48
49
 
49
50
  </sections><annex id="P" inline-header="false" obligation="normative">
50
51
  <title>Annex</title>
51
- <subsection id="Q" inline-header="false" obligation="normative">
52
+ <clause id="Q" inline-header="false" obligation="normative">
52
53
  <title>Annex A.1</title>
53
- <subsection id="Q1" inline-header="false" obligation="normative">
54
+ <clause id="Q1" inline-header="false" obligation="normative">
54
55
  <title>Annex A.1a</title>
55
- </subsection>
56
- </subsection>
57
- </annex><references id="R" obligation="informative">
56
+ </clause>
57
+ </clause>
58
+ <appendix id="Q2" inline-header="false" obligation="normative">
59
+ <title>An Appendix</title>
60
+ </appendix>
61
+ </annex><bibliography><references id="R" obligation="informative">
58
62
  <title>Normative References</title>
59
63
  </references><clause id="S" obligation="informative">
60
64
  <title>Bibliography</title>
@@ -62,6 +66,7 @@ RSpec.describe IsoDoc do
62
66
  <title>Bibliography Subsection</title>
63
67
  </references>
64
68
  </clause>
69
+ </bibliography>
65
70
  </iso-standard>
66
71
  INPUT
67
72
  <html xmlns:epub="http://www.idpf.org/2007/ops">
@@ -113,7 +118,7 @@ RSpec.describe IsoDoc do
113
118
  <div id="I">
114
119
  <h2>3.1. Normal Terms</h2>
115
120
  <p class="TermNum" id="J">3.1.1</p>
116
- <p class="Terms">Term2</p>
121
+ <p class="Terms" style="text-align:left;">Term2</p>
117
122
 
118
123
  </div><div id="K"><h2>3.2. Symbols and Abbreviated Terms</h2>
119
124
  <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
@@ -145,6 +150,10 @@ RSpec.describe IsoDoc do
145
150
  <h3>A.1.1. Annex A.1a</h3>
146
151
  </div>
147
152
  </div>
153
+ <div id="Q2">
154
+ <h2>Appendix 1. An Appendix</h2>
155
+ </div>
156
+
148
157
  </div>
149
158
  <br/>
150
159
  <div>
@@ -163,17 +172,18 @@ OUTPUT
163
172
  it "processes section names (Word)" do
164
173
  expect(IsoDoc::WordConvert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
165
174
  <iso-standard xmlns="http://riboseinc.com/isoxml">
175
+ <preface>
166
176
  <foreword obligation="informative">
167
177
  <title>Foreword</title>
168
178
  <p id="A">This is a preamble</p>
169
179
  </foreword>
170
- <introduction id="B" obligation="informative"><title>Introduction</title><subsection id="C" inline-header="false" obligation="informative">
180
+ <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
171
181
  <title>Introduction Subsection</title>
172
- </subsection>
182
+ </clause>
173
183
  <patent-notice>
174
184
  <p>This is patent boilerplate</p>
175
185
  </patent-notice>
176
- </introduction><sections>
186
+ </introduction></preface><sections>
177
187
  <clause id="D" obligation="normative">
178
188
  <title>Scope</title>
179
189
  <p id="E">Text</p>
@@ -198,22 +208,25 @@ OUTPUT
198
208
  <dd>Definition</dd>
199
209
  </dl>
200
210
  </symbols-abbrevs>
201
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><subsection id="N" inline-header="false" obligation="normative">
211
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
202
212
  <title>Introduction</title>
203
- </subsection>
204
- <subsection id="O" inline-header="false" obligation="normative">
213
+ </clause>
214
+ <clause id="O" inline-header="false" obligation="normative">
205
215
  <title>Clause 4.2</title>
206
- </subsection></clause>
216
+ </clause></clause>
207
217
 
208
218
  </sections><annex id="P" inline-header="false" obligation="normative">
209
219
  <title>Annex</title>
210
- <subsection id="Q" inline-header="false" obligation="normative">
220
+ <clause id="Q" inline-header="false" obligation="normative">
211
221
  <title>Annex A.1</title>
212
- <subsection id="Q1" inline-header="false" obligation="normative">
222
+ <clause id="Q1" inline-header="false" obligation="normative">
213
223
  <title>Annex A.1a</title>
214
- </subsection>
215
- </subsection>
216
- </annex><references id="R" obligation="informative">
224
+ </clause>
225
+ </clause>
226
+ <appendix id="Q2" inline-header="false" obligation="normative">
227
+ <title>An Appendix</title>
228
+ </appendix>
229
+ </annex><bibliography><references id="R" obligation="informative">
217
230
  <title>Normative References</title>
218
231
  </references><clause id="S" obligation="informative">
219
232
  <title>Bibliography</title>
@@ -221,103 +234,107 @@ OUTPUT
221
234
  <title>Bibliography Subsection</title>
222
235
  </references>
223
236
  </clause>
237
+ </bibliography>
224
238
  </iso-standard>
225
239
  INPUT
226
- <html xmlns:epub="http://www.idpf.org/2007/ops">
227
- <head>
228
- <title>test</title>
229
- <body lang="EN-US" link="blue" vlink="#954F72">
230
- <div class="WordSection1">
231
- <p>&#160;</p>
232
- </div>
233
- <br clear="all" class="section"/>
234
- <div class="WordSection2">
235
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
236
- <div>
237
- <h1 class="ForewordTitle">Foreword</h1>
238
- <p id="A">This is a preamble</p>
239
- </div>
240
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
241
- <div class="Section3" id="B">
242
- <h1 class="IntroTitle">0.<span style="mso-tab-count:1">&#160; </span>Introduction</h1>
243
- <div id="C">
244
- <h2>0.1. Introduction Subsection</h2>
245
- </div>
246
- <p>This is patent boilerplate</p>
247
- </div>
248
- <p>&#160;</p>
249
- </div>
250
- <br clear="all" class="section"/>
251
- <div class="WordSection3">
252
- <p class="zzSTDTitle1"/>
253
- <div id="D">
254
- <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
255
- <p id="E">Text</p>
256
- </div>
257
- <div>
258
- <h1>2.<span style="mso-tab-count:1">&#160; </span>Normative References</h1>
259
- <p>There are no normative references in this document.</p>
260
- </div>
261
- <div id="H"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>For the purposes of this document,
262
- the following terms and definitions apply.</p>
263
- <p>ISO and IEC maintain terminological databases for use in
264
- standardization at the following addresses:</p>
265
-
266
- <ul>
267
- <li> <p>ISO Online browsing platform: available at
268
- <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
269
- <li> <p>IEC Electropedia: available at
270
- <a href="http://www.electropedia.org">http://www.electropedia.org</a>
271
- </p> </li> </ul>
272
- <div id="I">
273
- <h2>3.1. Normal Terms</h2>
274
- <p class="TermNum" id="J">3.1.1</p>
275
- <p class="Terms">Term2</p>
276
-
277
- </div><div id="K"><h2>3.2. Symbols and Abbreviated Terms</h2>
278
- <table class="dl"><tr><td valign="top" align="left"><p style="text-align: left;">Symbol</p></td><td valign="top">Definition</td></tr></table>
279
- </div></div>
280
- <div id="L" class="Symbols">
281
- <h1>4.<span style="mso-tab-count:1">&#160; </span>Symbols and Abbreviated Terms</h1>
282
- <table class="dl">
283
- <tr>
284
- <td valign="top" align="left">
285
- <p style="text-align: left;">Symbol</p>
286
- </td>
287
- <td valign="top">Definition</td>
288
- </tr>
289
- </table>
290
- </div>
291
- <div id="M">
292
- <h1>5.<span style="mso-tab-count:1">&#160; </span>Clause 4</h1>
293
- <div id="N">
294
- <h2>5.1. Introduction</h2>
295
- </div>
296
- <div id="O">
297
- <h2>5.2. Clause 4.2</h2>
298
- </div>
299
- </div>
300
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
301
- <div id="P" class="Section3">
302
- <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
303
- <div id="Q">
304
- <h2>A.1. Annex A.1</h2>
305
- <div id="Q1">
306
- <h3>A.1.1. Annex A.1a</h3>
307
- </div>
308
- </div>
309
- </div>
310
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
311
- <div>
312
- <h1 class="Section3">Bibliography</h1>
313
- <div>
314
- <h2 class="Section3">Bibliography Subsection</h2>
315
- </div>
316
- </div>
317
- </div>
318
- </body>
319
- </head>
320
- </html>
240
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
241
+ <head>
242
+ <title>test</title>
243
+ <body lang="EN-US" link="blue" vlink="#954F72">
244
+ <div class="WordSection1">
245
+ <p>&#160;</p>
246
+ </div>
247
+ <br clear="all" class="section"/>
248
+ <div class="WordSection2">
249
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
250
+ <div>
251
+ <h1 class="ForewordTitle">Foreword</h1>
252
+ <p id="A">This is a preamble</p>
253
+ </div>
254
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
255
+ <div class="Section3" id="B">
256
+ <h1 class="IntroTitle">0.<span style="mso-tab-count:1">&#160; </span>Introduction</h1>
257
+ <div id="C">
258
+ <h2>0.1. Introduction Subsection</h2>
259
+ </div>
260
+ <p>This is patent boilerplate</p>
261
+ </div>
262
+ <p>&#160;</p>
263
+ </div>
264
+ <br clear="all" class="section"/>
265
+ <div class="WordSection3">
266
+ <p class="zzSTDTitle1"/>
267
+ <div id="D">
268
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
269
+ <p id="E">Text</p>
270
+ </div>
271
+ <div>
272
+ <h1>2.<span style="mso-tab-count:1">&#160; </span>Normative References</h1>
273
+ <p>There are no normative references in this document.</p>
274
+ </div>
275
+ <div id="H"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>For the purposes of this document,
276
+ the following terms and definitions apply.</p>
277
+ <p>ISO and IEC maintain terminological databases for use in
278
+ standardization at the following addresses:</p>
279
+
280
+ <ul>
281
+ <li> <p>ISO Online browsing platform: available at
282
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
283
+ <li> <p>IEC Electropedia: available at
284
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
285
+ </p> </li> </ul>
286
+ <div id="I">
287
+ <h2>3.1. Normal Terms</h2>
288
+ <p class="TermNum" id="J">3.1.1</p>
289
+ <p class="Terms" style="text-align:left;">Term2</p>
290
+
291
+ </div><div id="K"><h2>3.2. Symbols and Abbreviated Terms</h2>
292
+ <table class="dl"><tr><td valign="top" align="left"><p align="left" style="margin-left:0pt;text-align:left;">Symbol</p></td><td valign="top">Definition</td></tr></table>
293
+ </div></div>
294
+ <div id="L" class="Symbols">
295
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Symbols and Abbreviated Terms</h1>
296
+ <table class="dl">
297
+ <tr>
298
+ <td valign="top" align="left">
299
+ <p align="left" style="margin-left:0pt;text-align:left;">Symbol</p>
300
+ </td>
301
+ <td valign="top">Definition</td>
302
+ </tr>
303
+ </table>
304
+ </div>
305
+ <div id="M">
306
+ <h1>5.<span style="mso-tab-count:1">&#160; </span>Clause 4</h1>
307
+ <div id="N">
308
+ <h2>5.1. Introduction</h2>
309
+ </div>
310
+ <div id="O">
311
+ <h2>5.2. Clause 4.2</h2>
312
+ </div>
313
+ </div>
314
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
315
+ <div id="P" class="Section3">
316
+ <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
317
+ <div id="Q">
318
+ <h2>A.1. Annex A.1</h2>
319
+ <div id="Q1">
320
+ <h3>A.1.1. Annex A.1a</h3>
321
+ </div>
322
+ </div>
323
+ <div id="Q2">
324
+ <h2>Appendix 1. An Appendix</h2>
325
+ </div>
326
+ </div>
327
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
328
+ <div>
329
+ <h1 class="Section3">Bibliography</h1>
330
+ <div>
331
+ <h2 class="Section3">Bibliography Subsection</h2>
332
+ </div>
333
+ </div>
334
+ </div>
335
+ </body>
336
+ </head>
337
+ </html>
321
338
  OUTPUT
322
339
  end
323
340
 
@@ -347,7 +364,7 @@ OUTPUT
347
364
  <br/>
348
365
  <div class="WordSection3">
349
366
  <p class="zzSTDTitle1"/>
350
- <div id="H"><h1>3.&#160; Terms and Definitions</h1><p>For the purposes of this document,
367
+ <div id="H"><h1>1.&#160; Terms and Definitions</h1><p>For the purposes of this document,
351
368
  the following terms and definitions apply.</p>
352
369
  <p>ISO and IEC maintain terminological databases for use in
353
370
  standardization at the following addresses:</p>
@@ -358,8 +375,8 @@ OUTPUT
358
375
  <li> <p>IEC Electropedia: available at
359
376
  <a href="http://www.electropedia.org">http://www.electropedia.org</a>
360
377
  </p> </li> </ul>
361
- <p class="TermNum" id="J">3.1</p>
362
- <p class="Terms">Term2</p>
378
+ <p class="TermNum" id="J">1.1</p>
379
+ <p class="Terms" style="text-align:left;">Term2</p>
363
380
  </div>
364
381
  </div>
365
382
  </body>
@@ -371,7 +388,7 @@ OUTPUT
371
388
  it "processes terms & definitions with external source" do
372
389
  expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
373
390
  <iso-standard xmlns="http://riboseinc.com/isoxml">
374
- <termdocsource type="inline" bibitemid="ISO712" citeas="ISO 712"/>
391
+ <termdocsource type="inline" target="ISO712"/>
375
392
  <sections>
376
393
  <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
377
394
  <term id="J">
@@ -379,6 +396,7 @@ OUTPUT
379
396
  </term>
380
397
  </terms>
381
398
  </sections>
399
+ <bibliography>
382
400
  <references id="_normative_references" obligation="informative"><title>Normative References</title>
383
401
  <bibitem id="ISO712" type="standard">
384
402
  <title format="text/plain">Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</title>
@@ -390,6 +408,7 @@ OUTPUT
390
408
  </organization>
391
409
  </contributor>
392
410
  </bibitem></references>
411
+ </bibliography>
393
412
  </iso-standard>
394
413
  INPUT
395
414
  <html xmlns:epub="http://www.idpf.org/2007/ops">
@@ -407,11 +426,11 @@ OUTPUT
407
426
  <div class="WordSection3">
408
427
  <p class="zzSTDTitle1"/>
409
428
  <div>
410
- <h1>2.&#160; Normative References</h1>
429
+ <h1>1.&#160; Normative References</h1>
411
430
  <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>
412
431
  <p id="ISO712">ISO 712, <i> Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</i></p>
413
432
  </div>
414
- <div id="H"><h1>3.&#160; Terms and Definitions</h1><p>For the purposes of this document, the terms and definitions
433
+ <div id="H"><h1>2.&#160; Terms and Definitions</h1><p>For the purposes of this document, the terms and definitions
415
434
  given in ISO 712 and the following apply.</p>
416
435
  <p>ISO and IEC maintain terminological databases for use in
417
436
  standardization at the following addresses:</p>
@@ -422,8 +441,8 @@ OUTPUT
422
441
  <li> <p>IEC Electropedia: available at
423
442
  <a href="http://www.electropedia.org">http://www.electropedia.org</a>
424
443
  </p> </li> </ul>
425
- <p class="TermNum" id="J">3.1</p>
426
- <p class="Terms">Term2</p>
444
+ <p class="TermNum" id="J">2.1</p>
445
+ <p class="Terms" style="text-align:left;">Term2</p>
427
446
  </div>
428
447
  </div>
429
448
  </body>
@@ -435,13 +454,14 @@ OUTPUT
435
454
  it "processes empty terms & definitions with external source" do
436
455
  expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
437
456
  <iso-standard xmlns="http://riboseinc.com/isoxml">
438
- <termdocsource type="inline" bibitemid="ISO712" citeas="ISO 712"/>
439
- <termdocsource type="inline" bibitemid="ISO712" citeas="ISO 712"/>
440
- <termdocsource type="inline" bibitemid="ISO712" citeas="ISO 712"/>
457
+ <termdocsource type="inline" target="ISO712"/>
458
+ <termdocsource type="inline" target="ISO712"/>
459
+ <termdocsource type="inline" target="ISO712"/>
441
460
  <sections>
442
461
  <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
443
462
  </terms>
444
463
  </sections>
464
+ <bibliography>
445
465
  <references id="_normative_references" obligation="informative"><title>Normative References</title>
446
466
  <bibitem id="ISO712" type="standard">
447
467
  <title format="text/plain">Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</title>
@@ -453,6 +473,7 @@ OUTPUT
453
473
  </organization>
454
474
  </contributor>
455
475
  </bibitem></references>
476
+ </bibliography>
456
477
  </iso-standard>
457
478
  INPUT
458
479
  <html xmlns:epub="http://www.idpf.org/2007/ops">
@@ -470,11 +491,11 @@ OUTPUT
470
491
  <div class="WordSection3">
471
492
  <p class="zzSTDTitle1"/>
472
493
  <div>
473
- <h1>2.&#160; Normative References</h1>
494
+ <h1>1.&#160; Normative References</h1>
474
495
  <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>
475
496
  <p id="ISO712">ISO 712, <i> Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</i></p>
476
497
  </div>
477
- <div id="H"><h1>3.&#160; Terms and Definitions</h1><p>For the purposes of this document,
498
+ <div id="H"><h1>2.&#160; Terms and Definitions</h1><p>For the purposes of this document,
478
499
  the terms and definitions given in ISO 712, ISO 712 and ISO 712 apply.</p>
479
500
  <p>ISO and IEC maintain terminological databases for use in
480
501
  standardization at the following addresses:</p>
@@ -517,7 +538,7 @@ OUTPUT
517
538
  <br/>
518
539
  <div class="WordSection3">
519
540
  <p class="zzSTDTitle1"/>
520
- <div id="H"><h1>3.&#160; Terms and Definitions</h1><p>No terms and definitions are listed in this document.</p>
541
+ <div id="H"><h1>1.&#160; Terms and Definitions</h1><p>No terms and definitions are listed in this document.</p>
521
542
  <p>ISO and IEC maintain terminological databases for use in
522
543
  standardization at the following addresses:</p>
523
544
 
@@ -539,12 +560,12 @@ OUTPUT
539
560
  expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
540
561
  <iso-standard xmlns="http://riboseinc.com/isoxml">
541
562
  <sections>
542
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><subsection id="N" inline-header="false" obligation="normative">
563
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
543
564
  <title>Introduction</title>
544
- </subsection>
545
- <subsection id="O" inline-header="true" obligation="normative">
565
+ </clause>
566
+ <clause id="O" inline-header="true" obligation="normative">
546
567
  <title>Clause 4.2</title>
547
- </subsection></clause>
568
+ </clause></clause>
548
569
 
549
570
  </sections>
550
571
  </iso-standard>
@@ -564,12 +585,12 @@ OUTPUT
564
585
  <div class="WordSection3">
565
586
  <p class="zzSTDTitle1"/>
566
587
  <div id="M">
567
- <h1>4.&#160; Clause 4</h1>
588
+ <h1>1.&#160; Clause 4</h1>
568
589
  <div id="N">
569
- <h2>4.1. Introduction</h2>
590
+ <h2>1.1. Introduction</h2>
570
591
  </div>
571
592
  <div id="O">
572
- <span class="zzMoveToFollowing"><b>4.2. Clause 4.2 </b></span>
593
+ <span class="zzMoveToFollowing"><b>1.2. Clause 4.2 </b></span>
573
594
  </div>
574
595
  </div>
575
596
  </div>