isodoc 1.1.3 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc-yaml/i18n-en.yaml +4 -1
  3. data/lib/isodoc-yaml/i18n-fr.yaml +4 -1
  4. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +4 -1
  5. data/lib/isodoc.rb +1 -0
  6. data/lib/isodoc/common.rb +0 -2
  7. data/lib/isodoc/convert.rb +38 -37
  8. data/lib/isodoc/function/blocks.rb +10 -22
  9. data/lib/isodoc/function/blocks_example_note.rb +14 -15
  10. data/lib/isodoc/function/cleanup.rb +5 -4
  11. data/lib/isodoc/function/inline.rb +6 -76
  12. data/lib/isodoc/function/references.rb +10 -9
  13. data/lib/isodoc/function/reqt.rb +12 -11
  14. data/lib/isodoc/function/section.rb +51 -54
  15. data/lib/isodoc/function/table.rb +1 -6
  16. data/lib/isodoc/function/terms.rb +13 -6
  17. data/lib/isodoc/function/to_word_html.rb +2 -0
  18. data/lib/isodoc/function/utils.rb +5 -4
  19. data/lib/isodoc/html_function/html.rb +1 -1
  20. data/lib/isodoc/{function/i18n.rb → i18n.rb} +37 -36
  21. data/lib/isodoc/metadata.rb +4 -3
  22. data/lib/isodoc/metadata_date.rb +1 -1
  23. data/lib/isodoc/presentation_function/block.rb +138 -0
  24. data/lib/isodoc/presentation_function/inline.rb +131 -0
  25. data/lib/isodoc/presentation_function/section.rb +46 -0
  26. data/lib/isodoc/presentation_xml_convert.rb +38 -5
  27. data/lib/isodoc/version.rb +1 -1
  28. data/lib/isodoc/word_function/body.rb +13 -8
  29. data/lib/isodoc/word_function/inline.rb +3 -1
  30. data/lib/isodoc/xref.rb +5 -3
  31. data/lib/isodoc/xref/xref_sect_gen.rb +3 -3
  32. data/spec/assets/i18n.yaml +12 -1
  33. data/spec/isodoc/blocks_spec.rb +1101 -147
  34. data/spec/isodoc/cleanup_spec.rb +5 -3
  35. data/spec/isodoc/footnotes_spec.rb +2 -2
  36. data/spec/isodoc/i18n_spec.rb +679 -110
  37. data/spec/isodoc/inline_spec.rb +323 -142
  38. data/spec/isodoc/lists_spec.rb +2 -2
  39. data/spec/isodoc/postproc_spec.rb +1311 -1333
  40. data/spec/isodoc/ref_spec.rb +181 -3
  41. data/spec/isodoc/section_spec.rb +633 -681
  42. data/spec/isodoc/table_spec.rb +155 -4
  43. data/spec/isodoc/terms_spec.rb +111 -79
  44. data/spec/isodoc/xref_spec.rb +1569 -1186
  45. metadata +6 -3
@@ -1,8 +1,8 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
- it "processes IsoXML bibliographies" do
5
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
4
+ it "processes Relaton bibliographies" do
5
+ input = <<~INPUT
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <bibdata>
8
8
  <language>en</language>
@@ -124,6 +124,182 @@ RSpec.describe IsoDoc do
124
124
  </bibliography>
125
125
  </iso-standard>
126
126
  INPUT
127
+ presxml = <<~PRESXML
128
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
129
+ <bibdata>
130
+ <language>en</language>
131
+ </bibdata>
132
+ <preface>
133
+ <foreword>
134
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
135
+ <eref bibitemid='ISO712'>[110]</eref>
136
+ <eref bibitemid='ISBN'>[1]</eref>
137
+ <eref bibitemid='ISSN'>[2]</eref>
138
+ <eref bibitemid='ISO16634'>ISO 16634:-- (all parts)</eref>
139
+ <eref bibitemid='ref1'>ICC 167</eref>
140
+ <eref bibitemid='ref10'>[10]</eref>
141
+ <eref bibitemid='ref12'>Citn</eref>
142
+ <eref bibitemid='zip_ffs'>[5]</eref>
143
+ </p>
144
+ </foreword>
145
+ </preface>
146
+ <bibliography>
147
+ <references id='_normative_references' obligation='informative' normative='true'>
148
+ <title depth='1'>1.<tab/>Normative References</title>
149
+ <p>
150
+ The following documents are referred to in the text in such a way that
151
+ some or all of their content constitutes requirements of this document.
152
+ For dated references, only the edition cited applies. For undated
153
+ references, the latest edition of the referenced document (including any
154
+ amendments) applies.
155
+ </p>
156
+ <bibitem id='ISO712' type='standard'>
157
+ <title format='text/plain'>Cereals or cereal products</title>
158
+ <title type='main' format='text/plain'>Cereals and cereal products</title>
159
+ <docidentifier type='ISO'>ISO 712</docidentifier>
160
+ <docidentifier type='metanorma'>[110]</docidentifier>
161
+ <contributor>
162
+ <role type='publisher'/>
163
+ <organization>
164
+ <name>International Organization for Standardization</name>
165
+ </organization>
166
+ </contributor>
167
+ </bibitem>
168
+ <bibitem id='ISO16634' type='standard'>
169
+ <title language='x' format='text/plain'>
170
+ Cereals, pulses, milled cereal products, xxxx, oilseeds and animal
171
+ feeding stuffs
172
+ </title>
173
+ <title language='en' format='text/plain'>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</title>
174
+ <docidentifier type='ISO'>ISO 16634:-- (all parts)</docidentifier>
175
+ <date type='published'>
176
+ <on>--</on>
177
+ </date>
178
+ <contributor>
179
+ <role type='publisher'/>
180
+ <organization>
181
+ <abbreviation>ISO</abbreviation>
182
+ </organization>
183
+ </contributor>
184
+ <note format='text/plain' type='ISO DATE' reference='1'>Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
185
+ <extent type='part'>
186
+ <referenceFrom>all</referenceFrom>
187
+ </extent>
188
+ </bibitem>
189
+ <bibitem id='ISO20483' type='standard'>
190
+ <title format='text/plain'>Cereals and pulses</title>
191
+ <docidentifier type='ISO'>ISO 20483:2013-2014</docidentifier>
192
+ <date type='published'>
193
+ <from>2013</from>
194
+ <to>2014</to>
195
+ </date>
196
+ <contributor>
197
+ <role type='publisher'/>
198
+ <organization>
199
+ <name>International Organization for Standardization</name>
200
+ </organization>
201
+ </contributor>
202
+ </bibitem>
203
+ <bibitem id='ref1'>
204
+ <formattedref format='application/x-isodoc+xml'>
205
+ <smallcap>Standard No I.C.C 167</smallcap>
206
+ .
207
+ <em>
208
+ Determination of the protein content in cereal and cereal products
209
+ for food and animal feeding stuffs according to the Dumas combustion
210
+ method
211
+ </em>
212
+ (see
213
+ <link target='http://www.icc.or.at'/>
214
+ )
215
+ </formattedref>
216
+ <docidentifier type='ICC'>167</docidentifier>
217
+ </bibitem>
218
+ <note>
219
+ <name>NOTE</name>
220
+ <p>This is an annotation of ISO 20483:2013-2014</p>
221
+ </note>
222
+ <bibitem id='zip_ffs'>
223
+ <formattedref format='application/x-isodoc+xml'>Title 5</formattedref>
224
+ <docidentifier type='metanorma'>[5]</docidentifier>
225
+ </bibitem>
226
+ </references>
227
+ <references id='_bibliography' obligation='informative' normative='false'>
228
+ <title depth="1">Bibliography</title>
229
+ <bibitem id='ISBN' type='ISBN'>
230
+ <title format='text/plain'>Chemicals for analytical laboratory use</title>
231
+ <docidentifier type='ISBN'>ISBN</docidentifier>
232
+ <docidentifier type='metanorma'>[1]</docidentifier>
233
+ <contributor>
234
+ <role type='publisher'/>
235
+ <organization>
236
+ <abbreviation>ISBN</abbreviation>
237
+ </organization>
238
+ </contributor>
239
+ </bibitem>
240
+ <bibitem id='ISSN' type='ISSN'>
241
+ <title format='text/plain'>Instruments for analytical laboratory use</title>
242
+ <docidentifier type='ISSN'>ISSN</docidentifier>
243
+ <docidentifier type='metanorma'>[2]</docidentifier>
244
+ <contributor>
245
+ <role type='publisher'/>
246
+ <organization>
247
+ <abbreviation>ISSN</abbreviation>
248
+ </organization>
249
+ </contributor>
250
+ </bibitem>
251
+ <note>
252
+ <name>NOTE</name>
253
+ <p>This is an annotation of document ISSN.</p>
254
+ </note>
255
+ <note>
256
+ <name>NOTE</name>
257
+ <p>This is another annotation of document ISSN.</p>
258
+ </note>
259
+ <bibitem id='ISO3696' type='standard'>
260
+ <title format='text/plain'>Water for analytical laboratory use</title>
261
+ <docidentifier type='ISO'>ISO 3696</docidentifier>
262
+ <contributor>
263
+ <role type='publisher'/>
264
+ <organization>
265
+ <abbreviation>ISO</abbreviation>
266
+ </organization>
267
+ </contributor>
268
+ </bibitem>
269
+ <bibitem id='ref10'>
270
+ <formattedref format='application/x-isodoc+xml'>
271
+ <smallcap>Standard No I.C.C 167</smallcap>
272
+ .
273
+ <em>
274
+ Determination of the protein content in cereal and cereal products
275
+ for food and animal feeding stuffs according to the Dumas combustion
276
+ method
277
+ </em>
278
+ (see
279
+ <link target='http://www.icc.or.at'/>
280
+ )
281
+ </formattedref>
282
+ <docidentifier type='metanorma'>[10]</docidentifier>
283
+ </bibitem>
284
+ <bibitem id='ref11'>
285
+ <title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
286
+ <docidentifier type='IETF'>RFC 10</docidentifier>
287
+ </bibitem>
288
+ <bibitem id='ref12'>
289
+ <formattedref format='application/x-isodoc+xml'>
290
+ CitationWorks. 2019.
291
+ <em>How to cite a reference</em>
292
+ .
293
+ </formattedref>
294
+ <docidentifier type='metanorma'>[Citn]</docidentifier>
295
+ <docidentifier type='IETF'>RFC 20</docidentifier>
296
+ </bibitem>
297
+ </references>
298
+ </bibliography>
299
+ </iso-standard>
300
+ PRESXML
301
+
302
+ html = <<~OUTPUT
127
303
  #{HTML_HDR}
128
304
  <br/>
129
305
  <div>
@@ -141,7 +317,7 @@ RSpec.describe IsoDoc do
141
317
  </div>
142
318
  <p class='zzSTDTitle1'/>
143
319
  <div>
144
- <h1>1.&#160; Normative references</h1>
320
+ <h1>1.&#160; Normative References</h1>
145
321
  <p>
146
322
  The following documents are referred to in the text in such a way that
147
323
  some or all of their content constitutes requirements of this
@@ -244,6 +420,8 @@ RSpec.describe IsoDoc do
244
420
  </html>
245
421
 
246
422
  OUTPUT
423
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
424
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
247
425
  end
248
426
 
249
427
  end
@@ -1,6 +1,131 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
+ it "processes prefatory blocks" do
5
+ input = <<~INPUT
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <preface>
8
+ <abstract id="A"><title>abstract</title></abstract>
9
+ <introduction id="B"><title>introduction</title></introduction>
10
+ <note id="C">note</note>
11
+ </preface>
12
+ <sections>
13
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
14
+ <title>Introduction</title>
15
+ </clause>
16
+ <clause id="O" inline-header="true" obligation="normative">
17
+ <title>Clause 4.2</title>
18
+ </clause></clause>
19
+ <admonition id="L" type="caution"><p>admonition</p></admonition>
20
+ </sections>
21
+ </iso-standard>
22
+ INPUT
23
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
24
+ <html lang='en'>
25
+ <head/>
26
+ <body lang='en'>
27
+ <div class='title-section'>
28
+ <p>&#160;</p>
29
+ </div>
30
+ <br/>
31
+ <div class='prefatory-section'>
32
+ <p>&#160;</p>
33
+ </div>
34
+ <br/>
35
+ <div class='main-section'>
36
+ <div id='C' class='Note'>note</div>
37
+ <br/>
38
+ <div id='A'>
39
+ <h1 class='AbstractTitle'>abstract</h1>
40
+ </div>
41
+ <br/>
42
+ <div class='Section3' id='B'>
43
+ <h1 class='IntroTitle'>introduction</h1>
44
+ </div>
45
+ <p class='zzSTDTitle1'/>
46
+ <div id='L' class='Admonition'>
47
+ <p class='AdmonitionTitle' style='text-align:center;'>CAUTION</p>
48
+ <p>admonition</p>
49
+ </div>
50
+ <div id='M'>
51
+ <h1>Clause 4</h1>
52
+ <div id='N'>
53
+ <h2>Introduction</h2>
54
+ </div>
55
+ <div id='O'>
56
+ <span class='zzMoveToFollowing'>
57
+ <b>Clause 4.2&#160; </b>
58
+ </span>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </body>
63
+ </html>
64
+ OUTPUT
65
+ expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
66
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
67
+ <head>
68
+ <style>
69
+ </style>
70
+ </head>
71
+ <body lang='EN-US' link='blue' vlink='#954F72'>
72
+ <div class='WordSection1'>
73
+ <p>&#160;</p>
74
+ </div>
75
+ <p>
76
+ <br clear='all' class='section'/>
77
+ </p>
78
+ <div class='WordSection2'>
79
+ <div id='C' class='Note'>
80
+ <p class='Note'>
81
+ <span class='note_label'/>
82
+ <span style='mso-tab-count:1'>&#160; </span>
83
+ </p>
84
+ note
85
+ </div>
86
+ <p>
87
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
88
+ </p>
89
+ <div id='A'>
90
+ <h1 class='AbstractTitle'>abstract</h1>
91
+ </div>
92
+ <p>
93
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
94
+ </p>
95
+ <div class='Section3' id='B'>
96
+ <h1 class='IntroTitle'>introduction</h1>
97
+ </div>
98
+ <p>&#160;</p>
99
+ </div>
100
+ <p>
101
+ <br clear='all' class='section'/>
102
+ </p>
103
+ <div class='WordSection3'>
104
+ <p class='zzSTDTitle1'/>
105
+ <div id='L' class='Admonition'>
106
+ <p class='AdmonitionTitle' style='text-align:center;'>CAUTION</p>
107
+ <p>admonition</p>
108
+ </div>
109
+ <div id='M'>
110
+ <h1>Clause 4</h1>
111
+ <div id='N'>
112
+ <h2>Introduction</h2>
113
+ </div>
114
+ <div id='O'>
115
+ <span class='zzMoveToFollowing'>
116
+ <b>
117
+ Clause 4.2
118
+ <span style='mso-tab-count:1'>&#160; </span>
119
+ </b>
120
+ </span>
121
+ </div>
122
+ </div>
123
+ </div>
124
+ </body>
125
+ </html>
126
+ OUTPUT
127
+ end
128
+
4
129
  it "processes document with no content" do
5
130
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
131
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -27,8 +152,8 @@ RSpec.describe IsoDoc do
27
152
  OUTPUT
28
153
  end
29
154
 
30
- it "processes section names" do
31
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
155
+ it "processes section names" do
156
+ input = <<~"INPUT"
32
157
  <iso-standard xmlns="http://riboseinc.com/isoxml">
33
158
  <boilerplate>
34
159
  <copyright-statement>
@@ -54,7 +179,7 @@ RSpec.describe IsoDoc do
54
179
  </boilerplate>
55
180
  <preface>
56
181
  <abstract obligation="informative">
57
- <title>Foreword</title>
182
+ <title>Abstract</title>
58
183
  </abstract>
59
184
  <foreword obligation="informative">
60
185
  <title>Foreword</title>
@@ -72,7 +197,7 @@ RSpec.describe IsoDoc do
72
197
  </preface><sections>
73
198
  <note id="NN1"><p>Initial note</p></note>
74
199
  <admonition id="NN2" type="warning"><p>Initial admonition</p></admonition>
75
- <clause id="D" obligation="normative">
200
+ <clause id="D" obligation="normative" type="scope">
76
201
  <title>Scope</title>
77
202
  <p id="E">Text</p>
78
203
  </clause>
@@ -92,6 +217,7 @@ RSpec.describe IsoDoc do
92
217
  </definitions>
93
218
  </clause>
94
219
  <definitions id="L">
220
+ <title>Symbols and abbreviated terms</title>
95
221
  <dl>
96
222
  <dt>Symbol</dt>
97
223
  <dd>Definition</dd>
@@ -114,7 +240,9 @@ RSpec.describe IsoDoc do
114
240
  <clause id="Q1" inline-header="false" obligation="normative">
115
241
  <title>Annex A.1a</title>
116
242
  </clause>
117
- <references id="Q2" normative="false"><title>Annex Bibliography</title></references>
243
+ <references id="Q2" normative="false">
244
+ <title>Annex Bibliography</title>
245
+ </references>
118
246
  </clause>
119
247
  </annex>
120
248
  <annex id="P1" inline-header="false" obligation="normative">
@@ -130,6 +258,135 @@ RSpec.describe IsoDoc do
130
258
  </bibliography>
131
259
  </iso-standard>
132
260
  INPUT
261
+
262
+ presxml = <<~"PRESXML"
263
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
264
+ <boilerplate>
265
+ <copyright-statement>
266
+ <clause>
267
+ <title depth="1">Copyright</title>
268
+ </clause>
269
+ </copyright-statement>
270
+ <license-statement>
271
+ <clause>
272
+ <title depth="1">License</title>
273
+ </clause>
274
+ </license-statement>
275
+ <legal-statement>
276
+ <clause>
277
+ <title depth="1">Legal</title>
278
+ </clause>
279
+ </legal-statement>
280
+ <feedback-statement>
281
+ <clause>
282
+ <title depth="1">Feedback</title>
283
+ </clause>
284
+ </feedback-statement>
285
+ </boilerplate>
286
+ <preface>
287
+ <abstract obligation='informative'>
288
+ <title>Abstract</title>
289
+ </abstract>
290
+ <foreword obligation='informative'>
291
+ <title>Foreword</title>
292
+ <p id='A'>This is a preamble</p>
293
+ </foreword>
294
+ <introduction id='B' obligation='informative'>
295
+ <title>Introduction</title>
296
+ <clause id='C' inline-header='false' obligation='informative'>
297
+ <title depth='2'>Introduction Subsection</title>
298
+ </clause>
299
+ </introduction>
300
+ <clause id='B1'>
301
+ <title depth='1'>Dedication</title>
302
+ </clause>
303
+ <clause id='B2'>
304
+ <title depth='1'>Note to reader</title>
305
+ </clause>
306
+ <acknowledgements obligation='informative'>
307
+ <title>Acknowledgements</title>
308
+ </acknowledgements>
309
+ </preface>
310
+ <sections>
311
+ <note id='NN1'>
312
+ <name>NOTE</name>
313
+ <p>Initial note</p>
314
+ </note>
315
+ <admonition id='NN2' type='warning'>
316
+ <p>Initial admonition</p>
317
+ </admonition>
318
+ <clause id='D' obligation='normative' type='scope'>
319
+ <title depth='1'>1.<tab/>Scope</title>
320
+ <p id='E'>Text</p>
321
+ </clause>
322
+ <clause id='H' obligation='normative'>
323
+ <title depth='1'>3.<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
324
+ <terms id='I' obligation='normative'>
325
+ <title depth='2'>3.1.<tab/>Normal Terms</title>
326
+ <term id='J'>
327
+ <name>3.1.1.</name>
328
+ <preferred>Term2</preferred>
329
+ </term>
330
+ </terms>
331
+ <definitions id='K'>
332
+ <title depth='2'>3.2.<tab/>Definitions</title>
333
+ <dl>
334
+ <dt>Symbol</dt>
335
+ <dd>Definition</dd>
336
+ </dl>
337
+ </definitions>
338
+ </clause>
339
+ <definitions id='L'>
340
+ <title depth='1'>4.<tab/>Symbols and abbreviated terms</title>
341
+ <dl>
342
+ <dt>Symbol</dt>
343
+ <dd>Definition</dd>
344
+ </dl>
345
+ </definitions>
346
+ <clause id='M' inline-header='false' obligation='normative'>
347
+ <title depth='1'>5.<tab/>Clause 4</title>
348
+ <clause id='N' inline-header='false' obligation='normative'>
349
+ <title depth='2'>5.1.<tab/>Introduction</title>
350
+ </clause>
351
+ <clause id='O' inline-header='false' obligation='normative'>
352
+ <title depth='2'>5.2.<tab/>Clause 4.2</title>
353
+ </clause>
354
+ <clause id='O1' inline-header='false' obligation='normative'>
355
+ <title>5.3.</title>
356
+ </clause>
357
+ </clause>
358
+ </sections>
359
+ <annex id='P' inline-header='false' obligation='normative'>
360
+ <title> <strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong>
361
+ </title>
362
+ <clause id='Q' inline-header='false' obligation='normative'>
363
+ <title depth='2'>A.1.<tab/>Annex A.1</title>
364
+ <clause id='Q1' inline-header='false' obligation='normative'>
365
+ <title depth='3'>A.1.1.<tab/>Annex A.1a</title>
366
+ </clause>
367
+ <references id='Q2' normative='false'>
368
+ <title depth='3'>A.1.2.<tab/>Annex Bibliography</title>
369
+ </references>
370
+ </clause>
371
+ </annex>
372
+ <annex id='P1' inline-header='false' obligation='normative'>
373
+ <title><strong>Annex B</strong><br/>(normative)</title>
374
+ </annex>
375
+ <bibliography>
376
+ <references id='R' obligation='informative' normative='true'>
377
+ <title depth='1'>2.<tab/>Normative References</title>
378
+ </references>
379
+ <clause id='S' obligation='informative'>
380
+ <title depth='1'>Bibliography</title>
381
+ <references id='T' obligation='informative' normative='false'>
382
+ <title depth="2">Bibliography Subsection</title>
383
+ </references>
384
+ </clause>
385
+ </bibliography>
386
+ </iso-standard>
387
+ PRESXML
388
+
389
+ html = <<~"OUTPUT"
133
390
  #{HTML_HDR}
134
391
  <div class='authority'>
135
392
  <div class='boilerplate-copyright'>
@@ -185,7 +442,7 @@ RSpec.describe IsoDoc do
185
442
  <p class="zzSTDTitle1"/>
186
443
  <div id='NN1' class='Note'>
187
444
  <p>
188
- <span class='note_label'>NOTE</span>
445
+ <span class='note_label'>NOTE</span>
189
446
  &#160; Initial note
190
447
  </p>
191
448
  </div>
@@ -198,7 +455,7 @@ RSpec.describe IsoDoc do
198
455
  <p id="E">Text</p>
199
456
  </div>
200
457
  <div>
201
- <h1>2.&#160; Normative references</h1>
458
+ <h1>2.&#160; Normative References</h1>
202
459
  </div>
203
460
  <div id="H"><h1>3.&#160; Terms, Definitions, Symbols and Abbreviated Terms</h1>
204
461
  <div id="I">
@@ -227,7 +484,7 @@ RSpec.describe IsoDoc do
227
484
  <h2>5.2.&#160; Clause 4.2</h2>
228
485
  </div>
229
486
  <div id="O1">
230
- <h2>5.3.&#160; </h2>
487
+ <h2>5.3.</h2>
231
488
  </div>
232
489
  </div>
233
490
  <br/>
@@ -238,7 +495,7 @@ RSpec.describe IsoDoc do
238
495
  <div id="Q1">
239
496
  <h3>A.1.1.&#160; Annex A.1a</h3>
240
497
  </div>
241
- <div><h3>A.1.2.&#160; Annex Bibliography</h3></div>
498
+ <div><h3 class="Section3">A.1.2.&#160; Annex Bibliography</h3></div>
242
499
  </div>
243
500
 
244
501
  </div>
@@ -248,9 +505,6 @@ RSpec.describe IsoDoc do
248
505
  <b>Annex B</b>
249
506
  <br/>
250
507
  (normative)
251
- <br/>
252
- <br/>
253
- <b/>
254
508
  </h1>
255
509
  </div>
256
510
  <br/>
@@ -264,557 +518,179 @@ RSpec.describe IsoDoc do
264
518
  </body>
265
519
  </html>
266
520
  OUTPUT
267
- end
268
521
 
269
- it "processes section names (Word)" do
270
- expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
271
- <iso-standard xmlns="http://riboseinc.com/isoxml">
272
- <boilerplate>
273
- <copyright-statement>
274
- <clause>
275
- <title>Copyright</title>
276
- </clause>
277
- </copyright-statement>
278
- <license-statement>
279
- <clause>
280
- <title>License</title>
281
- </clause>
282
- </license-statement>
283
- <legal-statement>
284
- <clause>
285
- <title>Legal</title>
286
- </clause>
287
- </legal-statement>
288
- <feedback-statement>
289
- <clause>
290
- <title>Feedback</title>
291
- </clause>
292
- </feedback-statement>
293
- </boilerplate>
294
- <preface>
295
- <abstract obligation="informative">
296
- <title>Foreword</title>
297
- </abstract>
298
- <foreword obligation="informative">
299
- <title>Foreword</title>
300
- <p id="A">This is a preamble</p>
301
- </foreword>
302
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
303
- <title>Introduction Subsection</title>
304
- </clause>
305
- </introduction>
306
- <clause id="B1"><title>Dedication</title></clause>
307
- <clause id="B2"><title>Note to reader</title></clause>
308
- <acknowledgements obligation="informative">
309
- <title>Acknowledgements</title>
310
- </acknowledgements>
311
- </preface><sections>
312
- <clause id="D" obligation="normative">
313
- <title>Scope</title>
314
- <p id="E">Text</p>
315
- </clause>
316
-
317
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
318
- <title>Normal Terms</title>
319
- <term id="J">
320
- <preferred>Term2</preferred>
321
- </term>
322
- </terms>
323
- <definitions id="K">
324
- <dl>
325
- <dt>Symbol</dt>
326
- <dd>Definition</dd>
327
- </dl>
328
- </definitions>
329
- </clause>
330
- <definitions id="L">
331
- <dl>
332
- <dt>Symbol</dt>
333
- <dd>Definition</dd>
334
- </dl>
335
- </definitions>
336
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
337
- <title>Introduction</title>
338
- </clause>
339
- <clause id="O" inline-header="false" obligation="normative">
340
- <title>Clause 4.2</title>
341
- </clause>
342
- <clause id="O1" inline-header="false" obligation="normative">
343
- </clause>
344
- </clause>
345
-
346
- </sections><annex id="P" inline-header="false" obligation="normative">
347
- <title>Annex</title>
348
- <clause id="Q" inline-header="false" obligation="normative">
349
- <title>Annex A.1</title>
350
- <clause id="Q1" inline-header="false" obligation="normative">
351
- <title>Annex A.1a</title>
352
- </clause>
353
- </clause>
354
- </annex>
355
- <annex id="P1" inline-header="false" obligation="normative">
356
- </annex>
357
- <bibliography><references id="R" obligation="informative" normative="true">
358
- <title>Normative References</title>
359
- </references><clause id="S" obligation="informative">
360
- <title>Bibliography</title>
361
- <references id="T" obligation="informative" normative="false">
362
- <title>Bibliography Subsection</title>
363
- </references>
364
- </clause>
365
- </bibliography>
366
- </iso-standard>
367
- INPUT
522
+ word = <<~"OUTPUT"
368
523
  <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
369
524
  <head><style/></head>
370
- <body lang="EN-US" link="blue" vlink="#954F72">
371
- <div class="WordSection1">
372
- <p>&#160;</p>
373
- </div>
374
- <p><br clear="all" class="section"/></p>
375
- <div class="WordSection2">
376
- <div class='authority'>
377
- <div class='boilerplate-copyright'>
378
- <div>
379
- <h1>Copyright</h1>
380
- </div>
381
- </div>
382
- <div class='boilerplate-license'>
383
- <div>
384
- <h1>License</h1>
385
- </div>
386
- </div>
387
- <div class='boilerplate-legal'>
388
- <div>
389
- <h1>Legal</h1>
390
- </div>
391
- </div>
392
- <div class='boilerplate-feedback'>
393
- <div>
394
- <h1>Feedback</h1>
395
- </div>
396
- </div>
397
- </div>
398
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
399
- <div>
400
- <h1 class="AbstractTitle">Abstract</h1>
401
- </div>
402
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
403
- <div>
404
- <h1 class="ForewordTitle">Foreword</h1>
405
- <p id="A">This is a preamble</p>
406
- </div>
407
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
408
- <div class="Section3" id="B">
409
- <h1 class="IntroTitle">Introduction</h1>
410
- <div id="C">
411
- <h2>Introduction Subsection</h2>
412
- </div>
413
- </div>
414
- <p>
415
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
416
- </p>
417
- <div class='Section3' id='B1'>
418
- <h1 class='IntroTitle'>Dedication</h1>
419
- </div>
420
- <p>
421
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
422
- </p>
423
- <div class='Section3' id='B2'>
424
- <h1 class='IntroTitle'>Note to reader</h1>
425
- </div>
426
- <p>
427
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
428
- </p>
429
- <div class='Section3' id=''>
430
- <h1 class='IntroTitle'>Acknowledgements</h1>
431
- </div>
432
- <p>&#160;</p>
433
- </div>
434
- <p><br clear="all" class="section"/></p>
435
- <div class="WordSection3">
436
- <p class="zzSTDTitle1"/>
437
- <div id="D">
438
- <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
439
- <p id="E">Text</p>
440
- </div>
441
- <div>
442
- <h1>2.<span style="mso-tab-count:1">&#160; </span>Normative references</h1>
443
- </div>
444
- <div id="H"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms, Definitions, Symbols and Abbreviated Terms</h1>
445
- <div id="I">
446
- <h2>3.1.<span style="mso-tab-count:1">&#160; </span>Normal Terms</h2>
447
- <p class="TermNum" id="J">3.1.1.</p>
448
- <p class="Terms" style="text-align:left;">Term2</p>
525
+ <body lang="EN-US" link="blue" vlink="#954F72">
526
+ <div class="WordSection1">
527
+ <p>&#160;</p>
528
+ </div>
529
+ <p>
530
+ <br clear="all" class="section"/>
531
+ </p>
532
+ <div class="WordSection2">
533
+ <div class="authority">
534
+ <div class="boilerplate-copyright">
535
+ <div><h1>Copyright</h1>
449
536
 
450
- </div><div id="K"><h2>3.2.<span style="mso-tab-count:1">&#160; </span>Symbols and abbreviated terms</h2>
451
- <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>
452
- </div></div>
453
- <div id="L" class="Symbols">
454
- <h1>4.<span style="mso-tab-count:1">&#160; </span>Symbols and abbreviated terms</h1>
455
- <table class="dl">
456
- <tr>
457
- <td valign="top" align="left">
458
- <p align="left" style="margin-left:0pt;text-align:left;">Symbol</p>
459
- </td>
460
- <td valign="top">Definition</td>
461
- </tr>
462
- </table>
463
- </div>
464
- <div id="M">
465
- <h1>5.<span style="mso-tab-count:1">&#160; </span>Clause 4</h1>
466
- <div id="N">
467
- <h2>5.1.<span style="mso-tab-count:1">&#160; </span>Introduction</h2>
468
- </div>
469
- <div id="O">
470
- <h2>5.2.<span style="mso-tab-count:1">&#160; </span>Clause 4.2</h2>
471
- </div>
472
- <div id="O1">
473
- <h2>5.3.<span style="mso-tab-count:1">&#160; </span></h2>
474
- </div>
475
- </div>
476
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
477
- <div id="P" class="Section3">
478
- <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
479
- <div id="Q">
480
- <h2>A.1.<span style="mso-tab-count:1">&#160; </span>Annex A.1</h2>
481
- <div id="Q1">
482
- <h3>A.1.1.<span style="mso-tab-count:1">&#160; </span>Annex A.1a</h3>
537
+ </div>
538
+ </div>
539
+ <div class="boilerplate-license">
540
+ <div><h1>License</h1>
541
+
542
+ </div>
543
+ </div>
544
+ <div class="boilerplate-legal">
545
+ <div><h1>Legal</h1>
546
+
547
+ </div>
548
+ </div>
549
+ <div class="boilerplate-feedback">
550
+ <div><h1>Feedback</h1>
551
+
552
+ </div>
553
+ </div>
483
554
  </div>
484
- </div>
485
- </div>
486
- <p>
487
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
488
- </p>
489
- <div id='P1' class='Section3'>
490
- <h1 class='Annex'>
491
- <b>Annex B</b>
492
- <br/>
493
- (normative)
494
- <br/>
495
- <br/>
496
- <b/>
497
- </h1>
498
- </div>
499
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
500
- <div>
501
- <h1 class="Section3">Bibliography</h1>
502
- <div>
503
- <h2 class="Section3">Bibliography Subsection</h2>
504
- </div>
505
- </div>
506
- </div>
507
- </body>
508
- </html>
509
- OUTPUT
510
- end
555
+ <p>
556
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
557
+ </p>
558
+ <div>
559
+ <h1 class="AbstractTitle">Abstract</h1>
560
+ </div>
561
+ <p>
562
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
563
+ </p>
564
+ <div>
565
+ <h1 class="ForewordTitle">Foreword</h1>
566
+ <p id="A">This is a preamble</p>
567
+ </div>
568
+ <p>
569
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
570
+ </p>
571
+ <div class="Section3" id="B">
572
+ <h1 class="IntroTitle">Introduction</h1>
573
+ <div id="C"><h2>Introduction Subsection</h2>
511
574
 
512
- it "processes footnotes in section names" do
513
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true).gsub(%r{<aside .*</aside>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
514
- <iso-standard xmlns="http://riboseinc.com/isoxml">
515
- <boilerplate>
516
- <copyright-statement>
517
- <clause>
518
- <title>Copyright<fn reference="1"><p>A</p></fn></title>
519
- </clause>
520
- </copyright-statement>
521
- <license-statement>
522
- <clause>
523
- <title>License<fn reference="2"><p>A</p></fn></title>
524
- </clause>
525
- </license-statement>
526
- <legal-statement>
527
- <clause>
528
- <title>Legal<fn reference="3"><p>A</p></fn></title>
529
- </clause>
530
- </legal-statement>
531
- <feedback-statement>
532
- <clause>
533
- <title>Feedback<fn reference="4"><p>A</p></fn></title>
534
- </clause>
535
- </feedback-statement>
536
- </boilerplate>
537
- <preface>
538
- <abstract obligation="informative">
539
- <title>Foreword<fn reference="5"><p>A</p></fn></title>
540
- </abstract>
541
- <foreword obligation="informative">
542
- <title>Foreword<fn reference="6"><p>A</p></fn></title>
543
- <p id="A">This is a preamble</p>
544
- </foreword>
545
- <introduction id="B" obligation="informative">
546
- <title>Introduction<fn reference="7"><p>A</p></fn></title><clause id="C" inline-header="false" obligation="informative">
547
- <title>Introduction Subsection<fn reference="8"><p>A</p></fn></title>
548
- </clause>
549
- </introduction></preface><sections>
550
- <clause id="D" obligation="normative">
551
- <title>Scope<fn reference="9"><p>A</p></fn></title>
552
- <p id="E">Text</p>
553
- </clause>
575
+ </div>
576
+ </div>
577
+ <p>
578
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
579
+ </p>
580
+ <div class="Section3" id="B1">
581
+ <h1 class="IntroTitle">Dedication</h1>
582
+ </div>
583
+ <p>
584
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
585
+ </p>
586
+ <div class="Section3" id="B2">
587
+ <h1 class="IntroTitle">Note to reader</h1>
588
+ </div>
589
+ <p>
590
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
591
+ </p>
592
+ <div class="Section3" id="">
593
+ <h1 class="IntroTitle">Acknowledgements</h1>
594
+ </div>
595
+ <p>&#160;</p>
596
+ </div>
597
+ <p>
598
+ <br clear="all" class="section"/>
599
+ </p>
600
+ <div class="WordSection3">
601
+ <p class="zzSTDTitle1"/>
602
+ <div id="NN1" class="Note">
603
+ <p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">&#160; </span>Initial note</p>
604
+ </div>
605
+ <div id="NN2" class="Admonition"><p class="AdmonitionTitle" style="text-align:center;">WARNING</p>
606
+ <p>Initial admonition</p>
607
+ </div>
608
+ <div id="D">
609
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
610
+ <p id="E">Text</p>
611
+ </div>
612
+ <div><h1>2.<span style="mso-tab-count:1">&#160; </span>Normative References</h1>
554
613
 
555
- <clause id="H" obligation="normative">
556
- <title>Terms, Definitions, Symbols and Abbreviated Terms<fn reference="10"><p>A</p></fn></title><terms id="I" obligation="normative">
557
- <title>Normal Terms<fn reference="11"><p>A</p></fn></title>
558
- <term id="J">
559
- <preferred>Term2</preferred>
560
- </term>
561
- </terms>
562
- <definitions id="K">
563
- <title>Definitions<fn reference="12"><p>A</p></fn></title>
564
- <dl>
565
- <dt>Symbol</dt>
566
- <dd>Definition</dd>
567
- </dl>
568
- </definitions>
569
- </clause>
570
- <definitions id="L">
571
- <dl>
572
- <dt>Symbol</dt>
573
- <dd>Definition</dd>
574
- </dl>
575
- </definitions>
576
- <clause id="M" inline-header="false" obligation="normative">
577
- <title>Clause 4<fn reference="13"><p>A</p></fn></title><clause id="N" inline-header="false" obligation="normative">
578
- <title>Introduction<fn reference="1"><p>A</p></fn></title>
579
- </clause>
580
- <clause id="O" inline-header="false" obligation="normative">
581
- <title>Clause 4.2<fn reference="14"><p>A</p></fn></title>
582
- </clause>
583
- <clause id="O1" inline-header="false" obligation="normative">
584
- </clause>
585
- </clause>
614
+ </div>
615
+ <div id="H">
616
+ <h1>3.<span style="mso-tab-count:1">&#160; </span>Terms, Definitions, Symbols and Abbreviated Terms</h1>
617
+ <div id="I"><h2>3.1.<span style="mso-tab-count:1">&#160; </span>Normal Terms</h2>
586
618
 
587
- </sections><annex id="P" inline-header="false" obligation="normative">
588
- <title>Annex<fn reference="15"><p>A</p></fn></title>
589
- <clause id="Q" inline-header="false" obligation="normative">
590
- <title>Annex A.1<fn reference="16"><p>A</p></fn></title>
591
- <clause id="Q1" inline-header="false" obligation="normative">
592
- <title>Annex A.1a<fn reference="17"><p>A</p></fn></title>
593
- </clause>
594
- <references id="Q2" normative="false"><title>Annex Bibliography<fn reference="18"><p>A</p></fn></title></references>
595
- </clause>
596
- </annex><bibliography><references id="R" obligation="informative" normative="true">
597
- <title>Normative References<fn reference="19"><p>A</p></fn></title>
598
- </references><clause id="S" obligation="informative">
599
- <title>Bibliography<fn reference="20"><p>A</p></fn></title>
600
- <references id="T" obligation="informative" normative="false">
601
- <title>Bibliography Subsection<fn reference="21"><p>A</p></fn></title>
602
- </references>
603
- </clause>
604
- </bibliography>
605
- </iso-standard>
606
- INPUT
607
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
608
- <head/>
609
- <body lang='en'>
610
- <div class='title-section'>
611
- <p>&#160;</p>
612
- </div>
613
- <br/>
614
- <div class='prefatory-section'>
615
- <p>&#160;</p>
616
- </div>
617
- <br/>
618
- <div class='main-section'>
619
- <div class='authority'>
620
- <div class='boilerplate-copyright'>
621
- <div>
622
- <h1>
623
- Copyright
624
- <a class='FootnoteRef' href='#fn:1'>
625
- <sup>1</sup>
626
- </a>
627
- </h1>
628
- </div>
629
- </div>
630
- <div class='boilerplate-license'>
631
- <div>
632
- <h1>
633
- License
634
- <a class='FootnoteRef' href='#fn:2'>
635
- <sup>2</sup>
636
- </a>
637
- </h1>
638
- </div>
639
- </div>
640
- <div class='boilerplate-legal'>
641
- <div>
642
- <h1>
643
- Legal
644
- <a class='FootnoteRef' href='#fn:3'>
645
- <sup>3</sup>
646
- </a>
647
- </h1>
648
- </div>
649
- </div>
650
- <div class='boilerplate-feedback'>
651
- <div>
652
- <h1>
653
- Feedback
654
- <a class='FootnoteRef' href='#fn:4'>
655
- <sup>4</sup>
656
- </a>
657
- </h1>
658
- </div>
659
- </div>
660
- </div>
661
- <br/>
662
- <div>
663
- <h1 class='AbstractTitle'>Abstract</h1>
664
- </div>
665
- <br/>
666
- <div>
667
- <h1 class='ForewordTitle'>Foreword</h1>
668
- <p id='A'>This is a preamble</p>
669
- </div>
670
- <br/>
671
- <div class='Section3' id='B'>
672
- <h1 class='IntroTitle'>Introduction</h1>
673
- <div id='C'>
674
- <h2>
675
- Introduction Subsection
676
- <a class='FootnoteRef' href='#fn:8'>
677
- <sup>8</sup>
678
- </a>
679
- </h2>
680
- </div>
681
- </div>
682
- <p class='zzSTDTitle1'/>
683
- <div>
684
- <h1>1.&#160; Normative references</h1>
685
- </div>
686
- <div id='H'>
687
- <h1>
688
- 2.&#160; Terms, Definitions, Symbols and Abbreviated Terms
689
- <a class='FootnoteRef' href='#fn:10'>
690
- <sup>10</sup>
691
- </a>
692
- </h1>
693
- <div id='I'>
694
- <h2>
695
- 2.1.&#160; Normal Terms
696
- <a class='FootnoteRef' href='#fn:11'>
697
- <sup>11</sup>
698
- </a>
699
- </h2>
700
- <p class='TermNum' id='J'>2.1.1.</p>
701
- <p class='Terms' style='text-align:left;'>Term2</p>
702
- </div>
703
- <div id='K'>
704
- <h2>
705
- 2.2.&#160; Definitions
706
- <a class='FootnoteRef' href='#fn:12'>
707
- <sup>12</sup>
708
- </a>
709
- </h2>
710
- <dl>
711
- <dt>
712
- <p>Symbol</p>
713
- </dt>
714
- <dd>Definition</dd>
715
- </dl>
716
- </div>
717
- </div>
718
- <div id='L' class='Symbols'>
719
- <h1>3.&#160; Symbols and abbreviated terms</h1>
720
- <dl>
721
- <dt>
722
- <p>Symbol</p>
723
- </dt>
724
- <dd>Definition</dd>
725
- </dl>
726
- </div>
727
- <div id='D'>
728
- <h1>
729
- 4.&#160; Scope
730
- <a class='FootnoteRef' href='#fn:9'>
731
- <sup>9</sup>
732
- </a>
733
- </h1>
734
- <p id='E'>Text</p>
735
- </div>
736
- <div id='M'>
737
- <h1>
738
- 5.&#160; Clause 4
739
- <a class='FootnoteRef' href='#fn:13'>
740
- <sup>13</sup>
741
- </a>
742
- </h1>
743
- <div id='N'>
744
- <h2>
745
- 5.1.&#160; Introduction
746
- <a class='FootnoteRef' href='#fn:1'>
747
- <sup>1</sup>
748
- </a>
749
- </h2>
750
- </div>
751
- <div id='O'>
752
- <h2>
753
- 5.2.&#160; Clause 4.2
754
- <a class='FootnoteRef' href='#fn:14'>
755
- <sup>14</sup>
756
- </a>
757
- </h2>
758
- </div>
759
- <div id='O1'>
760
- <h2>5.3.&#160; </h2>
761
- </div>
762
- </div>
763
- <br/>
764
- <div id='P' class='Section3'>
765
- <h1 class='Annex'>
766
- <b>Annex A</b>
767
- <br/>
768
- (normative)
769
- <br/>
770
- <br/>
771
- <b>
772
- Annex
773
- <a class='FootnoteRef' href='#fn:15'>
774
- <sup>15</sup>
775
- </a>
776
- </b>
777
- </h1>
778
- <div id='Q'>
779
- <h2>
780
- A.1.&#160; Annex A.1
781
- <a class='FootnoteRef' href='#fn:16'>
782
- <sup>16</sup>
783
- </a>
784
- </h2>
785
- <div id='Q1'>
786
- <h3>
787
- A.1.1.&#160; Annex A.1a
788
- <a class='FootnoteRef' href='#fn:17'>
789
- <sup>17</sup>
790
- </a>
791
- </h3>
792
- </div>
793
- <div>
794
- <h3>
795
- A.1.2.&#160; Annex Bibliography
796
- <a class='FootnoteRef' href='#fn:18'>
797
- <sup>18</sup>
798
- </a>
799
- </h3>
800
- </div>
801
- </div>
802
- </div>
803
- <br/>
804
- <div>
805
- <h1 class='Section3'>Bibliography</h1>
806
- <div>
807
- <h2 class='Section3'>Bibliography SubsectionA</h2>
808
- </div>
809
- </div>
810
- </div>
811
- </body>
812
- </html>
619
+ <p class="TermNum" id="J">3.1.1.</p>
620
+
621
+ <p class="Terms" style="text-align:left;">Term2</p>
622
+
623
+ </div>
624
+ <div id="K"><h2>3.2.<span style="mso-tab-count:1">&#160; </span>Definitions</h2>
625
+
626
+ <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>
627
+ </div>
628
+ </div>
629
+ <div id="L" class="Symbols">
630
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Symbols and abbreviated terms</h1>
631
+ <table class="dl">
632
+ <tr>
633
+ <td valign="top" align="left">
634
+ <p align="left" style="margin-left:0pt;text-align:left;">Symbol</p>
635
+ </td>
636
+ <td valign="top">Definition</td>
637
+ </tr>
638
+ </table>
639
+ </div>
640
+ <div id="M">
641
+ <h1>5.<span style="mso-tab-count:1">&#160; </span>Clause 4</h1>
642
+ <div id="N"><h2>5.1.<span style="mso-tab-count:1">&#160; </span>Introduction</h2>
643
+
644
+ </div>
645
+ <div id="O"><h2>5.2.<span style="mso-tab-count:1">&#160; </span>Clause 4.2</h2>
646
+
647
+ </div>
648
+ <div id="O1"><h2>5.3.</h2>
649
+
650
+ </div>
651
+ </div>
652
+ <p>
653
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
654
+ </p>
655
+ <div id="P" class="Section3">
656
+ <h1 class="Annex"> <b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b>
657
+ </h1>
658
+ <div id="Q"><h2>A.1.<span style="mso-tab-count:1">&#160; </span>Annex A.1</h2>
659
+
660
+ <div id="Q1"><h3>A.1.1.<span style="mso-tab-count:1">&#160; </span>Annex A.1a</h3>
661
+
662
+ </div>
663
+ <div><h3 class="Section3">A.1.2.<span style="mso-tab-count:1">&#160; </span>Annex Bibliography</h3>
664
+
665
+ </div>
666
+ </div>
667
+ </div>
668
+ <p>
669
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
670
+ </p>
671
+ <div id="P1" class="Section3">
672
+ <h1 class="Annex"><b>Annex B</b><br/>(normative)</h1>
673
+ </div>
674
+ <p>
675
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
676
+ </p>
677
+ <div><h1 class="Section3">Bibliography</h1>
678
+
679
+ <div><h2 class="Section3">Bibliography Subsection</h2>
680
+
681
+ </div>
682
+ </div>
683
+ </div>
684
+ </body>
685
+ </html>
813
686
  OUTPUT
687
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
688
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
689
+ expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
814
690
  end
815
691
 
816
692
  it "processes section names suppressing section numbering" do
817
- expect(xmlpp(IsoDoc::HtmlConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
693
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
818
694
  <iso-standard xmlns="http://riboseinc.com/isoxml">
819
695
  <preface>
820
696
  <foreword obligation="informative">
@@ -825,7 +701,7 @@ OUTPUT
825
701
  <title>Introduction Subsection</title>
826
702
  </clause>
827
703
  </introduction></preface><sections>
828
- <clause id="D" obligation="normative">
704
+ <clause id="D" obligation="normative" type="scope">
829
705
  <title>Scope</title>
830
706
  <p id="E">Text</p>
831
707
  </clause>
@@ -878,81 +754,91 @@ OUTPUT
878
754
  </bibliography>
879
755
  </iso-standard>
880
756
  INPUT
881
- #{HTML_HDR}
757
+ <?xml version='1.0'?>
758
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
759
+ <preface>
760
+ <foreword obligation='informative'>
761
+ <title>Foreword</title>
762
+ <p id='A'>This is a preamble</p>
763
+ </foreword>
764
+ <introduction id='B' obligation='informative'>
765
+ <title>Introduction</title>
766
+ <clause id='C' inline-header='false' obligation='informative'>
767
+ <title depth="2">Introduction Subsection</title>
768
+ </clause>
769
+ </introduction>
770
+ </preface>
771
+ <sections>
772
+ <clause id='D' obligation='normative' type="scope">
773
+ <title depth="1">Scope</title>
774
+ <p id='E'>Text</p>
775
+ </clause>
776
+ <clause id='H' obligation='normative'>
777
+ <title depth="1">Terms, Definitions, Symbols and Abbreviated Terms</title>
778
+ <terms id='I' obligation='normative'>
779
+ <title depth="2">Normal Terms</title>
780
+ <term id='J'>
781
+ <name>3.1.1.</name>
782
+ <preferred>Term2</preferred>
783
+ </term>
784
+ </terms>
785
+ <definitions id='K'>
786
+ <dl>
787
+ <dt>Symbol</dt>
788
+ <dd>Definition</dd>
789
+ </dl>
790
+ </definitions>
791
+ </clause>
792
+ <definitions id='L'>
793
+ <dl>
794
+ <dt>Symbol</dt>
795
+ <dd>Definition</dd>
796
+ </dl>
797
+ </definitions>
798
+ <clause id='M' inline-header='false' obligation='normative'>
799
+ <title depth="1">Clause 4</title>
800
+ <clause id='N' inline-header='false' obligation='normative'>
801
+ <title depth="2">Introduction</title>
802
+ </clause>
803
+ <clause id='O' inline-header='false' obligation='normative'>
804
+ <title depth="2">Clause 4.2</title>
805
+ </clause>
806
+ <clause id='O1' inline-header='false' obligation='normative'> </clause>
807
+ </clause>
808
+ </sections>
809
+ <annex id='P' inline-header='false' obligation='normative'>
810
+ <title>
811
+ <strong>Annex A</strong>
882
812
  <br/>
883
- <div>
884
- <h1 class="ForewordTitle">Foreword</h1>
885
- <p id="A">This is a preamble</p>
886
- </div>
887
- <br/>
888
- <div class="Section3" id="B">
889
- <h1 class="IntroTitle">Introduction</h1>
890
- <div id="C"><h2>Introduction Subsection</h2>
891
-
892
- </div>
893
- </div>
894
- <p class="zzSTDTitle1"/>
895
- <div id="D">
896
- <h1>Scope</h1>
897
- <p id="E">Text</p>
898
- </div>
899
- <div>
900
- <h1>Normative references</h1>
901
- </div>
902
- <div id="H"><h1>Terms, Definitions, Symbols and Abbreviated Terms</h1>
903
- <div id="I"><h2>Normal Terms</h2>
904
-
905
- <p class="TermNum" id="J">3.1.1.</p>
906
- <p class="Terms" style="text-align:left;">Term2</p>
907
-
908
- </div><div id="K"><h2>Symbols and abbreviated terms</h2>
909
- <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
910
- </div></div>
911
- <div id="L" class="Symbols">
912
- <h1>Symbols and abbreviated terms</h1>
913
- <dl>
914
- <dt>
915
- <p>Symbol</p>
916
- </dt>
917
- <dd>Definition</dd>
918
- </dl>
919
- </div>
920
- <div id="M">
921
- <h1>Clause 4</h1>
922
- <div id="N"><h2>Introduction</h2>
923
-
924
- </div>
925
- <div id="O"><h2>Clause 4.2</h2>
926
-
927
- </div>
928
- <div id="O1"><h2/>
929
- </div>
930
- </div>
931
- <br/>
932
- <div id="P" class="Section3">
933
- <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
934
- <div id="Q"><h2>Annex A.1</h2>
935
-
936
- <div id="Q1"><h3>Annex A.1a</h3>
937
-
938
- </div>
939
- </div>
940
- </div>
941
- <br/>
942
- <div>
943
- <h1 class="Section3">Bibliography</h1>
944
- <div>
945
- <h2 class="Section3">Bibliography Subsection</h2>
946
- </div>
947
- </div>
948
- </div>
949
- </body>
950
- </html>
813
+ (normative)
814
+ <br/>
815
+ <br/>
816
+ <strong>Annex</strong>
817
+ </title>
818
+ <clause id='Q' inline-header='false' obligation='normative'>
819
+ <title depth="2">Annex A.1</title>
820
+ <clause id='Q1' inline-header='false' obligation='normative'>
821
+ <title depth="3">Annex A.1a</title>
822
+ </clause>
823
+ </clause>
824
+ </annex>
825
+ <bibliography>
826
+ <references id='R' obligation='informative' normative='true'>
827
+ <title depth="1">Normative References</title>
828
+ </references>
829
+ <clause id='S' obligation='informative'>
830
+ <title depth="1">Bibliography</title>
831
+ <references id='T' obligation='informative' normative='false'>
832
+ <title depth="2">Bibliography Subsection</title>
833
+ </references>
834
+ </clause>
835
+ </bibliography>
836
+ </iso-standard>
951
837
  OUTPUT
952
838
  end
953
839
 
954
840
  it "processes section titles without ID" do
955
- expect(xmlpp(IsoDoc::HtmlConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
841
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
956
842
  <iso-standard xmlns="http://riboseinc.com/isoxml">
957
843
  <preface>
958
844
  <introduction id="B" obligation="informative"><title>Introduction</title><clause obligation="informative">
@@ -962,23 +848,22 @@ OUTPUT
962
848
  </preface>
963
849
  </iso-standard>
964
850
  INPUT
965
- #{HTML_HDR}
966
- <br/>
967
- <div class='Section3' id='B'>
968
- <h1 class='IntroTitle'>Introduction</h1>
969
- <div>
970
- <h1>Introduction Subsection</h1>
971
- </div>
972
- </div>
973
- <p class='zzSTDTitle1'/>
974
- </div>
975
- </body>
976
- </html>
851
+ <?xml version='1.0'?>
852
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
853
+ <preface>
854
+ <introduction id='B' obligation='informative'>
855
+ <title>Introduction</title>
856
+ <clause obligation='informative'>
857
+ <title depth="1">Introduction Subsection</title>
858
+ </clause>
859
+ </introduction>
860
+ </preface>
861
+ </iso-standard>
977
862
  OUTPUT
978
863
  end
979
864
 
980
- it "processes simple terms & definitions" do
981
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
865
+ it "processes simple terms & definitions" do
866
+ input = <<~"INPUT"
982
867
  <iso-standard xmlns="http://riboseinc.com/isoxml">
983
868
  <sections>
984
869
  <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
@@ -989,6 +874,22 @@ OUTPUT
989
874
  </sections>
990
875
  </iso-standard>
991
876
  INPUT
877
+
878
+ presxml = <<~"OUTPUT"
879
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
880
+ <sections>
881
+ <terms id='H' obligation='normative'>
882
+ <title depth='1'>1.<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
883
+ <term id='J'>
884
+ <name>1.1.</name>
885
+ <preferred>Term2</preferred>
886
+ </term>
887
+ </terms>
888
+ </sections>
889
+ </iso-standard>
890
+ OUTPUT
891
+
892
+ html = <<~"OUTPUT"
992
893
  #{HTML_HDR}
993
894
  <p class="zzSTDTitle1"/>
994
895
  <div id="H"><h1>1.&#160; Terms, Definitions, Symbols and Abbreviated Terms</h1>
@@ -999,11 +900,12 @@ OUTPUT
999
900
  </body>
1000
901
  </html>
1001
902
  OUTPUT
903
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
904
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1002
905
  end
1003
906
 
1004
-
1005
- it "processes inline section headers" do
1006
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
907
+ it "processes inline section headers" do
908
+ input = <<~"INPUT"
1007
909
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1008
910
  <sections>
1009
911
  <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
@@ -1017,6 +919,25 @@ OUTPUT
1017
919
  </sections>
1018
920
  </iso-standard>
1019
921
  INPUT
922
+
923
+ presxml = <<~"PRESXML"
924
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
925
+ <sections>
926
+ <clause id='M' inline-header='false' obligation='normative'>
927
+ <title depth='1'>1.<tab/>Clause 4</title>
928
+ <clause id='N' inline-header='false' obligation='normative'>
929
+ <title depth='2'>1.1.<tab/>Introduction</title>
930
+ </clause>
931
+ <clause id='O' inline-header='true' obligation='normative'>
932
+ <title depth='2'>1.2.<tab/>Clause 4.2</title>
933
+ <p>ABC</p>
934
+ </clause>
935
+ </clause>
936
+ </sections>
937
+ </iso-standard>
938
+ PRESXML
939
+
940
+ output = <<~"OUTPUT"
1020
941
  #{HTML_HDR}
1021
942
  <p class="zzSTDTitle1"/>
1022
943
  <div id="M">
@@ -1033,10 +954,12 @@ OUTPUT
1033
954
  </body>
1034
955
  </html>
1035
956
  OUTPUT
957
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
958
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
1036
959
  end
1037
960
 
1038
961
  it "processes inline section headers with suppressed heading numbering" do
1039
- expect(xmlpp(IsoDoc::HtmlConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
962
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1040
963
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1041
964
  <sections>
1042
965
  <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
@@ -1049,25 +972,25 @@ OUTPUT
1049
972
  </sections>
1050
973
  </iso-standard>
1051
974
  INPUT
1052
- #{HTML_HDR}
1053
- <p class="zzSTDTitle1"/>
1054
- <div id="M">
1055
- <h1>Clause 4</h1>
1056
- <div id="N">
1057
- <h2>Introduction</h2>
1058
- </div>
1059
- <div id="O">
1060
- <span class="zzMoveToFollowing"><b>Clause 4.2&#160; </b></span>
1061
- </div>
1062
- </div>
1063
- </div>
1064
- </body>
1065
- </html>
975
+ <?xml version='1.0'?>
976
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
977
+ <sections>
978
+ <clause id='M' inline-header='false' obligation='normative'>
979
+ <title depth="1">Clause 4</title>
980
+ <clause id='N' inline-header='false' obligation='normative'>
981
+ <title depth="2">Introduction</title>
982
+ </clause>
983
+ <clause id='O' inline-header='true' obligation='normative'>
984
+ <title depth="2">Clause 4.2</title>
985
+ </clause>
986
+ </clause>
987
+ </sections>
988
+ </iso-standard>
1066
989
  OUTPUT
1067
990
  end
1068
991
 
1069
992
  it "processes sections without titles" do
1070
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
993
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1071
994
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1072
995
  <preface>
1073
996
  <introduction id="M" inline-header="false" obligation="normative"><clause id="N" inline-header="false" obligation="normative">
@@ -1085,32 +1008,33 @@ OUTPUT
1085
1008
 
1086
1009
  </iso-standard>
1087
1010
  INPUT
1088
- #{HTML_HDR}
1089
- <br/>
1090
- <div class="Section3" id="M">
1091
- <h1 class="IntroTitle">Introduction</h1>
1092
- <div id="N"><h2>Intro</h2>
1093
-
1094
- </div>
1095
- <div id="O"><span class="zzMoveToFollowing"><b> </b></span>
1096
- </div>
1097
- </div>
1098
- <p class="zzSTDTitle1"/>
1099
- <div id="M1">
1100
- <h1>1.&#160; </h1>
1101
- <div id="N1"><h2>1.1.&#160;</h2>
1102
- </div>
1103
- <div id="O1"><span class="zzMoveToFollowing"><b>1.2.&#160; </b></span>
1104
- </div>
1105
- </div>
1106
- </div>
1107
- </body>
1108
- </html>
1011
+ <?xml version='1.0'?>
1012
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
1013
+ <preface>
1014
+ <introduction id='M' inline-header='false' obligation='normative'>
1015
+ <clause id='N' inline-header='false' obligation='normative'>
1016
+ <title depth="2">Intro</title>
1017
+ </clause>
1018
+ <clause id='O' inline-header='true' obligation='normative'> </clause>
1019
+ </introduction>
1020
+ </preface>
1021
+ <sections>
1022
+ <clause id='M1' inline-header='false' obligation='normative'>
1023
+ <title>1.</title>
1024
+ <clause id='N1' inline-header='false' obligation='normative'>
1025
+ <title>1.1.</title>
1026
+ </clause>
1027
+ <clause id='O1' inline-header='true' obligation='normative'>
1028
+ <title>1.2.</title>
1029
+ </clause>
1030
+ </clause>
1031
+ </sections>
1032
+ </iso-standard>
1109
1033
  OUTPUT
1110
1034
  end
1111
1035
 
1112
1036
  it "processes clauses containing normative references" do
1113
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1037
+ input = <<~INPUT
1114
1038
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1115
1039
  <bibliography>
1116
1040
  <clause id="D" obligation="informative">
@@ -1132,16 +1056,43 @@ OUTPUT
1132
1056
  </clause>
1133
1057
 
1134
1058
  </bibliography>
1059
+ </iso-standard>
1135
1060
  INPUT
1061
+ presxml = <<~OUTPUT
1062
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1063
+ <bibliography>
1064
+ <clause id="D" obligation="informative">
1065
+ <title depth="1">Bibliography</title>
1066
+ <references id="E" obligation="informative" normative="false">
1067
+ <title depth="2">Bibliography Subsection 1</title>
1068
+ </references>
1069
+ <references id="F" obligation="informative" normative="false">
1070
+ <title depth="2">Bibliography Subsection 2</title>
1071
+ </references>
1072
+ </clause>
1073
+ <clause id="A" obligation="informative"><title depth="1">1.<tab/>First References</title>
1074
+ <references id="B" obligation="informative" normative="true">
1075
+ <title depth="2">1.1.<tab/>Normative References 1</title>
1076
+ </references>
1077
+ <references id="C" obligation="informative" normative="false">
1078
+ <title depth="2">1.2.<tab/>Normative References 2</title>
1079
+ </references>
1080
+ </clause>
1081
+
1082
+ </bibliography>
1083
+ </iso-standard>
1084
+ OUTPUT
1085
+
1086
+ html = <<~OUTPUT
1136
1087
  #{HTML_HDR}
1137
1088
  <p class='zzSTDTitle1'/>
1138
1089
  <div>
1139
- <h1>1.&#160; Normative references</h1>
1090
+ <h1>1.&#160; First References</h1>
1140
1091
  <div>
1141
- <h2>1.1.&#160; Normative References 1</h2>
1092
+ <h2 class='Section3'>1.1.&#160; Normative References 1</h2>
1142
1093
  </div>
1143
1094
  <div>
1144
- <h2>1.2.&#160; Normative References 2</h2>
1095
+ <h2 class='Section3'>1.2.&#160; Normative References 2</h2>
1145
1096
  </div>
1146
1097
  </div>
1147
1098
  <br/>
@@ -1159,7 +1110,8 @@ INPUT
1159
1110
  </html>
1160
1111
 
1161
1112
  OUTPUT
1113
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1114
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1162
1115
  end
1163
1116
 
1164
-
1165
1117
  end