isodoc 1.1.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +33 -27
  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 +39 -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 +1 -0
  18. data/lib/isodoc/function/utils.rb +4 -3
  19. data/lib/isodoc/html_function/html.rb +0 -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 +12 -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 +2 -2
  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 +508 -680
  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
@@ -27,8 +27,8 @@ RSpec.describe IsoDoc do
27
27
  OUTPUT
28
28
  end
29
29
 
30
- it "processes section names" do
31
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
30
+ it "processes section names" do
31
+ input = <<~"INPUT"
32
32
  <iso-standard xmlns="http://riboseinc.com/isoxml">
33
33
  <boilerplate>
34
34
  <copyright-statement>
@@ -54,7 +54,7 @@ RSpec.describe IsoDoc do
54
54
  </boilerplate>
55
55
  <preface>
56
56
  <abstract obligation="informative">
57
- <title>Foreword</title>
57
+ <title>Abstract</title>
58
58
  </abstract>
59
59
  <foreword obligation="informative">
60
60
  <title>Foreword</title>
@@ -72,7 +72,7 @@ RSpec.describe IsoDoc do
72
72
  </preface><sections>
73
73
  <note id="NN1"><p>Initial note</p></note>
74
74
  <admonition id="NN2" type="warning"><p>Initial admonition</p></admonition>
75
- <clause id="D" obligation="normative">
75
+ <clause id="D" obligation="normative" type="scope">
76
76
  <title>Scope</title>
77
77
  <p id="E">Text</p>
78
78
  </clause>
@@ -92,6 +92,7 @@ RSpec.describe IsoDoc do
92
92
  </definitions>
93
93
  </clause>
94
94
  <definitions id="L">
95
+ <title>Symbols and abbreviated terms</title>
95
96
  <dl>
96
97
  <dt>Symbol</dt>
97
98
  <dd>Definition</dd>
@@ -114,7 +115,9 @@ RSpec.describe IsoDoc do
114
115
  <clause id="Q1" inline-header="false" obligation="normative">
115
116
  <title>Annex A.1a</title>
116
117
  </clause>
117
- <references id="Q2" normative="false"><title>Annex Bibliography</title></references>
118
+ <references id="Q2" normative="false">
119
+ <title>Annex Bibliography</title>
120
+ </references>
118
121
  </clause>
119
122
  </annex>
120
123
  <annex id="P1" inline-header="false" obligation="normative">
@@ -130,6 +133,135 @@ RSpec.describe IsoDoc do
130
133
  </bibliography>
131
134
  </iso-standard>
132
135
  INPUT
136
+
137
+ presxml = <<~"PRESXML"
138
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
139
+ <boilerplate>
140
+ <copyright-statement>
141
+ <clause>
142
+ <title depth="1">Copyright</title>
143
+ </clause>
144
+ </copyright-statement>
145
+ <license-statement>
146
+ <clause>
147
+ <title depth="1">License</title>
148
+ </clause>
149
+ </license-statement>
150
+ <legal-statement>
151
+ <clause>
152
+ <title depth="1">Legal</title>
153
+ </clause>
154
+ </legal-statement>
155
+ <feedback-statement>
156
+ <clause>
157
+ <title depth="1">Feedback</title>
158
+ </clause>
159
+ </feedback-statement>
160
+ </boilerplate>
161
+ <preface>
162
+ <abstract obligation='informative'>
163
+ <title>Abstract</title>
164
+ </abstract>
165
+ <foreword obligation='informative'>
166
+ <title>Foreword</title>
167
+ <p id='A'>This is a preamble</p>
168
+ </foreword>
169
+ <introduction id='B' obligation='informative'>
170
+ <title>Introduction</title>
171
+ <clause id='C' inline-header='false' obligation='informative'>
172
+ <title depth='2'>Introduction Subsection</title>
173
+ </clause>
174
+ </introduction>
175
+ <clause id='B1'>
176
+ <title depth='1'>Dedication</title>
177
+ </clause>
178
+ <clause id='B2'>
179
+ <title depth='1'>Note to reader</title>
180
+ </clause>
181
+ <acknowledgements obligation='informative'>
182
+ <title>Acknowledgements</title>
183
+ </acknowledgements>
184
+ </preface>
185
+ <sections>
186
+ <note id='NN1'>
187
+ <name>NOTE</name>
188
+ <p>Initial note</p>
189
+ </note>
190
+ <admonition id='NN2' type='warning'>
191
+ <p>Initial admonition</p>
192
+ </admonition>
193
+ <clause id='D' obligation='normative' type='scope'>
194
+ <title depth='1'>1.<tab/>Scope</title>
195
+ <p id='E'>Text</p>
196
+ </clause>
197
+ <clause id='H' obligation='normative'>
198
+ <title depth='1'>3.<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
199
+ <terms id='I' obligation='normative'>
200
+ <title depth='2'>3.1.<tab/>Normal Terms</title>
201
+ <term id='J'>
202
+ <name>3.1.1.</name>
203
+ <preferred>Term2</preferred>
204
+ </term>
205
+ </terms>
206
+ <definitions id='K'>
207
+ <title depth='2'>3.2.<tab/>Definitions</title>
208
+ <dl>
209
+ <dt>Symbol</dt>
210
+ <dd>Definition</dd>
211
+ </dl>
212
+ </definitions>
213
+ </clause>
214
+ <definitions id='L'>
215
+ <title depth='1'>4.<tab/>Symbols and abbreviated terms</title>
216
+ <dl>
217
+ <dt>Symbol</dt>
218
+ <dd>Definition</dd>
219
+ </dl>
220
+ </definitions>
221
+ <clause id='M' inline-header='false' obligation='normative'>
222
+ <title depth='1'>5.<tab/>Clause 4</title>
223
+ <clause id='N' inline-header='false' obligation='normative'>
224
+ <title depth='2'>5.1.<tab/>Introduction</title>
225
+ </clause>
226
+ <clause id='O' inline-header='false' obligation='normative'>
227
+ <title depth='2'>5.2.<tab/>Clause 4.2</title>
228
+ </clause>
229
+ <clause id='O1' inline-header='false' obligation='normative'>
230
+ <title>5.3.</title>
231
+ </clause>
232
+ </clause>
233
+ </sections>
234
+ <annex id='P' inline-header='false' obligation='normative'>
235
+ <title> <strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong>
236
+ </title>
237
+ <clause id='Q' inline-header='false' obligation='normative'>
238
+ <title depth='2'>A.1.<tab/>Annex A.1</title>
239
+ <clause id='Q1' inline-header='false' obligation='normative'>
240
+ <title depth='3'>A.1.1.<tab/>Annex A.1a</title>
241
+ </clause>
242
+ <references id='Q2' normative='false'>
243
+ <title depth='3'>A.1.2.<tab/>Annex Bibliography</title>
244
+ </references>
245
+ </clause>
246
+ </annex>
247
+ <annex id='P1' inline-header='false' obligation='normative'>
248
+ <title><strong>Annex B</strong><br/>(normative)</title>
249
+ </annex>
250
+ <bibliography>
251
+ <references id='R' obligation='informative' normative='true'>
252
+ <title depth='1'>2.<tab/>Normative References</title>
253
+ </references>
254
+ <clause id='S' obligation='informative'>
255
+ <title depth='1'>Bibliography</title>
256
+ <references id='T' obligation='informative' normative='false'>
257
+ <title depth="2">Bibliography Subsection</title>
258
+ </references>
259
+ </clause>
260
+ </bibliography>
261
+ </iso-standard>
262
+ PRESXML
263
+
264
+ html = <<~"OUTPUT"
133
265
  #{HTML_HDR}
134
266
  <div class='authority'>
135
267
  <div class='boilerplate-copyright'>
@@ -185,7 +317,7 @@ RSpec.describe IsoDoc do
185
317
  <p class="zzSTDTitle1"/>
186
318
  <div id='NN1' class='Note'>
187
319
  <p>
188
- <span class='note_label'>NOTE</span>
320
+ <span class='note_label'>NOTE</span>
189
321
  &#160; Initial note
190
322
  </p>
191
323
  </div>
@@ -198,7 +330,7 @@ RSpec.describe IsoDoc do
198
330
  <p id="E">Text</p>
199
331
  </div>
200
332
  <div>
201
- <h1>2.&#160; Normative references</h1>
333
+ <h1>2.&#160; Normative References</h1>
202
334
  </div>
203
335
  <div id="H"><h1>3.&#160; Terms, Definitions, Symbols and Abbreviated Terms</h1>
204
336
  <div id="I">
@@ -227,7 +359,7 @@ RSpec.describe IsoDoc do
227
359
  <h2>5.2.&#160; Clause 4.2</h2>
228
360
  </div>
229
361
  <div id="O1">
230
- <h2>5.3.&#160; </h2>
362
+ <h2>5.3.</h2>
231
363
  </div>
232
364
  </div>
233
365
  <br/>
@@ -238,7 +370,7 @@ RSpec.describe IsoDoc do
238
370
  <div id="Q1">
239
371
  <h3>A.1.1.&#160; Annex A.1a</h3>
240
372
  </div>
241
- <div><h3>A.1.2.&#160; Annex Bibliography</h3></div>
373
+ <div><h3 class="Section3">A.1.2.&#160; Annex Bibliography</h3></div>
242
374
  </div>
243
375
 
244
376
  </div>
@@ -248,9 +380,6 @@ RSpec.describe IsoDoc do
248
380
  <b>Annex B</b>
249
381
  <br/>
250
382
  (normative)
251
- <br/>
252
- <br/>
253
- <b/>
254
383
  </h1>
255
384
  </div>
256
385
  <br/>
@@ -264,557 +393,179 @@ RSpec.describe IsoDoc do
264
393
  </body>
265
394
  </html>
266
395
  OUTPUT
267
- end
268
-
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
396
 
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
397
+ word = <<~"OUTPUT"
368
398
  <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
369
399
  <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>
400
+ <body lang="EN-US" link="blue" vlink="#954F72">
401
+ <div class="WordSection1">
402
+ <p>&#160;</p>
403
+ </div>
404
+ <p>
405
+ <br clear="all" class="section"/>
406
+ </p>
407
+ <div class="WordSection2">
408
+ <div class="authority">
409
+ <div class="boilerplate-copyright">
410
+ <div><h1>Copyright</h1>
449
411
 
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>
412
+ </div>
413
+ </div>
414
+ <div class="boilerplate-license">
415
+ <div><h1>License</h1>
416
+
417
+ </div>
418
+ </div>
419
+ <div class="boilerplate-legal">
420
+ <div><h1>Legal</h1>
421
+
422
+ </div>
423
+ </div>
424
+ <div class="boilerplate-feedback">
425
+ <div><h1>Feedback</h1>
426
+
427
+ </div>
428
+ </div>
483
429
  </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
430
+ <p>
431
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
432
+ </p>
433
+ <div>
434
+ <h1 class="AbstractTitle">Abstract</h1>
435
+ </div>
436
+ <p>
437
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
438
+ </p>
439
+ <div>
440
+ <h1 class="ForewordTitle">Foreword</h1>
441
+ <p id="A">This is a preamble</p>
442
+ </div>
443
+ <p>
444
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
445
+ </p>
446
+ <div class="Section3" id="B">
447
+ <h1 class="IntroTitle">Introduction</h1>
448
+ <div id="C"><h2>Introduction Subsection</h2>
511
449
 
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>
450
+ </div>
451
+ </div>
452
+ <p>
453
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
454
+ </p>
455
+ <div class="Section3" id="B1">
456
+ <h1 class="IntroTitle">Dedication</h1>
457
+ </div>
458
+ <p>
459
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
460
+ </p>
461
+ <div class="Section3" id="B2">
462
+ <h1 class="IntroTitle">Note to reader</h1>
463
+ </div>
464
+ <p>
465
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
466
+ </p>
467
+ <div class="Section3" id="">
468
+ <h1 class="IntroTitle">Acknowledgements</h1>
469
+ </div>
470
+ <p>&#160;</p>
471
+ </div>
472
+ <p>
473
+ <br clear="all" class="section"/>
474
+ </p>
475
+ <div class="WordSection3">
476
+ <p class="zzSTDTitle1"/>
477
+ <div id="NN1" class="Note">
478
+ <p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">&#160; </span>Initial note</p>
479
+ </div>
480
+ <div id="NN2" class="Admonition"><p class="AdmonitionTitle" style="text-align:center;">WARNING</p>
481
+ <p>Initial admonition</p>
482
+ </div>
483
+ <div id="D">
484
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
485
+ <p id="E">Text</p>
486
+ </div>
487
+ <div><h1>2.<span style="mso-tab-count:1">&#160; </span>Normative References</h1>
554
488
 
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>
489
+ </div>
490
+ <div id="H">
491
+ <h1>3.<span style="mso-tab-count:1">&#160; </span>Terms, Definitions, Symbols and Abbreviated Terms</h1>
492
+ <div id="I"><h2>3.1.<span style="mso-tab-count:1">&#160; </span>Normal Terms</h2>
586
493
 
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>
494
+ <p class="TermNum" id="J">3.1.1.</p>
495
+
496
+ <p class="Terms" style="text-align:left;">Term2</p>
497
+
498
+ </div>
499
+ <div id="K"><h2>3.2.<span style="mso-tab-count:1">&#160; </span>Definitions</h2>
500
+
501
+ <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>
502
+ </div>
503
+ </div>
504
+ <div id="L" class="Symbols">
505
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Symbols and abbreviated terms</h1>
506
+ <table class="dl">
507
+ <tr>
508
+ <td valign="top" align="left">
509
+ <p align="left" style="margin-left:0pt;text-align:left;">Symbol</p>
510
+ </td>
511
+ <td valign="top">Definition</td>
512
+ </tr>
513
+ </table>
514
+ </div>
515
+ <div id="M">
516
+ <h1>5.<span style="mso-tab-count:1">&#160; </span>Clause 4</h1>
517
+ <div id="N"><h2>5.1.<span style="mso-tab-count:1">&#160; </span>Introduction</h2>
518
+
519
+ </div>
520
+ <div id="O"><h2>5.2.<span style="mso-tab-count:1">&#160; </span>Clause 4.2</h2>
521
+
522
+ </div>
523
+ <div id="O1"><h2>5.3.</h2>
524
+
525
+ </div>
526
+ </div>
527
+ <p>
528
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
529
+ </p>
530
+ <div id="P" class="Section3">
531
+ <h1 class="Annex"> <b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b>
532
+ </h1>
533
+ <div id="Q"><h2>A.1.<span style="mso-tab-count:1">&#160; </span>Annex A.1</h2>
534
+
535
+ <div id="Q1"><h3>A.1.1.<span style="mso-tab-count:1">&#160; </span>Annex A.1a</h3>
536
+
537
+ </div>
538
+ <div><h3 class="Section3">A.1.2.<span style="mso-tab-count:1">&#160; </span>Annex Bibliography</h3>
539
+
540
+ </div>
541
+ </div>
542
+ </div>
543
+ <p>
544
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
545
+ </p>
546
+ <div id="P1" class="Section3">
547
+ <h1 class="Annex"><b>Annex B</b><br/>(normative)</h1>
548
+ </div>
549
+ <p>
550
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
551
+ </p>
552
+ <div><h1 class="Section3">Bibliography</h1>
553
+
554
+ <div><h2 class="Section3">Bibliography Subsection</h2>
555
+
556
+ </div>
557
+ </div>
558
+ </div>
559
+ </body>
560
+ </html>
813
561
  OUTPUT
562
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
563
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
564
+ expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
814
565
  end
815
566
 
816
567
  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")
568
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
818
569
  <iso-standard xmlns="http://riboseinc.com/isoxml">
819
570
  <preface>
820
571
  <foreword obligation="informative">
@@ -825,7 +576,7 @@ OUTPUT
825
576
  <title>Introduction Subsection</title>
826
577
  </clause>
827
578
  </introduction></preface><sections>
828
- <clause id="D" obligation="normative">
579
+ <clause id="D" obligation="normative" type="scope">
829
580
  <title>Scope</title>
830
581
  <p id="E">Text</p>
831
582
  </clause>
@@ -878,81 +629,91 @@ OUTPUT
878
629
  </bibliography>
879
630
  </iso-standard>
880
631
  INPUT
881
- #{HTML_HDR}
632
+ <?xml version='1.0'?>
633
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
634
+ <preface>
635
+ <foreword obligation='informative'>
636
+ <title>Foreword</title>
637
+ <p id='A'>This is a preamble</p>
638
+ </foreword>
639
+ <introduction id='B' obligation='informative'>
640
+ <title>Introduction</title>
641
+ <clause id='C' inline-header='false' obligation='informative'>
642
+ <title depth="2">Introduction Subsection</title>
643
+ </clause>
644
+ </introduction>
645
+ </preface>
646
+ <sections>
647
+ <clause id='D' obligation='normative' type="scope">
648
+ <title depth="1">Scope</title>
649
+ <p id='E'>Text</p>
650
+ </clause>
651
+ <clause id='H' obligation='normative'>
652
+ <title depth="1">Terms, Definitions, Symbols and Abbreviated Terms</title>
653
+ <terms id='I' obligation='normative'>
654
+ <title depth="2">Normal Terms</title>
655
+ <term id='J'>
656
+ <name>3.1.1.</name>
657
+ <preferred>Term2</preferred>
658
+ </term>
659
+ </terms>
660
+ <definitions id='K'>
661
+ <dl>
662
+ <dt>Symbol</dt>
663
+ <dd>Definition</dd>
664
+ </dl>
665
+ </definitions>
666
+ </clause>
667
+ <definitions id='L'>
668
+ <dl>
669
+ <dt>Symbol</dt>
670
+ <dd>Definition</dd>
671
+ </dl>
672
+ </definitions>
673
+ <clause id='M' inline-header='false' obligation='normative'>
674
+ <title depth="1">Clause 4</title>
675
+ <clause id='N' inline-header='false' obligation='normative'>
676
+ <title depth="2">Introduction</title>
677
+ </clause>
678
+ <clause id='O' inline-header='false' obligation='normative'>
679
+ <title depth="2">Clause 4.2</title>
680
+ </clause>
681
+ <clause id='O1' inline-header='false' obligation='normative'> </clause>
682
+ </clause>
683
+ </sections>
684
+ <annex id='P' inline-header='false' obligation='normative'>
685
+ <title>
686
+ <strong>Annex A</strong>
882
687
  <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>
688
+ (normative)
689
+ <br/>
690
+ <br/>
691
+ <strong>Annex</strong>
692
+ </title>
693
+ <clause id='Q' inline-header='false' obligation='normative'>
694
+ <title depth="2">Annex A.1</title>
695
+ <clause id='Q1' inline-header='false' obligation='normative'>
696
+ <title depth="3">Annex A.1a</title>
697
+ </clause>
698
+ </clause>
699
+ </annex>
700
+ <bibliography>
701
+ <references id='R' obligation='informative' normative='true'>
702
+ <title depth="1">Normative References</title>
703
+ </references>
704
+ <clause id='S' obligation='informative'>
705
+ <title depth="1">Bibliography</title>
706
+ <references id='T' obligation='informative' normative='false'>
707
+ <title depth="2">Bibliography Subsection</title>
708
+ </references>
709
+ </clause>
710
+ </bibliography>
711
+ </iso-standard>
951
712
  OUTPUT
952
713
  end
953
714
 
954
715
  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")
716
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
956
717
  <iso-standard xmlns="http://riboseinc.com/isoxml">
957
718
  <preface>
958
719
  <introduction id="B" obligation="informative"><title>Introduction</title><clause obligation="informative">
@@ -962,23 +723,22 @@ OUTPUT
962
723
  </preface>
963
724
  </iso-standard>
964
725
  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>
726
+ <?xml version='1.0'?>
727
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
728
+ <preface>
729
+ <introduction id='B' obligation='informative'>
730
+ <title>Introduction</title>
731
+ <clause obligation='informative'>
732
+ <title depth="1">Introduction Subsection</title>
733
+ </clause>
734
+ </introduction>
735
+ </preface>
736
+ </iso-standard>
977
737
  OUTPUT
978
738
  end
979
739
 
980
- it "processes simple terms & definitions" do
981
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
740
+ it "processes simple terms & definitions" do
741
+ input = <<~"INPUT"
982
742
  <iso-standard xmlns="http://riboseinc.com/isoxml">
983
743
  <sections>
984
744
  <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
@@ -989,6 +749,22 @@ OUTPUT
989
749
  </sections>
990
750
  </iso-standard>
991
751
  INPUT
752
+
753
+ presxml = <<~"OUTPUT"
754
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
755
+ <sections>
756
+ <terms id='H' obligation='normative'>
757
+ <title depth='1'>1.<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
758
+ <term id='J'>
759
+ <name>1.1.</name>
760
+ <preferred>Term2</preferred>
761
+ </term>
762
+ </terms>
763
+ </sections>
764
+ </iso-standard>
765
+ OUTPUT
766
+
767
+ html = <<~"OUTPUT"
992
768
  #{HTML_HDR}
993
769
  <p class="zzSTDTitle1"/>
994
770
  <div id="H"><h1>1.&#160; Terms, Definitions, Symbols and Abbreviated Terms</h1>
@@ -999,11 +775,12 @@ OUTPUT
999
775
  </body>
1000
776
  </html>
1001
777
  OUTPUT
778
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
779
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1002
780
  end
1003
781
 
1004
-
1005
- it "processes inline section headers" do
1006
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
782
+ it "processes inline section headers" do
783
+ input = <<~"INPUT"
1007
784
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1008
785
  <sections>
1009
786
  <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
@@ -1017,6 +794,25 @@ OUTPUT
1017
794
  </sections>
1018
795
  </iso-standard>
1019
796
  INPUT
797
+
798
+ presxml = <<~"PRESXML"
799
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
800
+ <sections>
801
+ <clause id='M' inline-header='false' obligation='normative'>
802
+ <title depth='1'>1.<tab/>Clause 4</title>
803
+ <clause id='N' inline-header='false' obligation='normative'>
804
+ <title depth='2'>1.1.<tab/>Introduction</title>
805
+ </clause>
806
+ <clause id='O' inline-header='true' obligation='normative'>
807
+ <title depth='2'>1.2.<tab/>Clause 4.2</title>
808
+ <p>ABC</p>
809
+ </clause>
810
+ </clause>
811
+ </sections>
812
+ </iso-standard>
813
+ PRESXML
814
+
815
+ output = <<~"OUTPUT"
1020
816
  #{HTML_HDR}
1021
817
  <p class="zzSTDTitle1"/>
1022
818
  <div id="M">
@@ -1033,10 +829,12 @@ OUTPUT
1033
829
  </body>
1034
830
  </html>
1035
831
  OUTPUT
832
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
833
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
1036
834
  end
1037
835
 
1038
836
  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")
837
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({suppressheadingnumbers: true}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1040
838
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1041
839
  <sections>
1042
840
  <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
@@ -1049,25 +847,25 @@ OUTPUT
1049
847
  </sections>
1050
848
  </iso-standard>
1051
849
  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>
850
+ <?xml version='1.0'?>
851
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
852
+ <sections>
853
+ <clause id='M' inline-header='false' obligation='normative'>
854
+ <title depth="1">Clause 4</title>
855
+ <clause id='N' inline-header='false' obligation='normative'>
856
+ <title depth="2">Introduction</title>
857
+ </clause>
858
+ <clause id='O' inline-header='true' obligation='normative'>
859
+ <title depth="2">Clause 4.2</title>
860
+ </clause>
861
+ </clause>
862
+ </sections>
863
+ </iso-standard>
1066
864
  OUTPUT
1067
865
  end
1068
866
 
1069
867
  it "processes sections without titles" do
1070
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
868
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1071
869
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1072
870
  <preface>
1073
871
  <introduction id="M" inline-header="false" obligation="normative"><clause id="N" inline-header="false" obligation="normative">
@@ -1085,32 +883,33 @@ OUTPUT
1085
883
 
1086
884
  </iso-standard>
1087
885
  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>
886
+ <?xml version='1.0'?>
887
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
888
+ <preface>
889
+ <introduction id='M' inline-header='false' obligation='normative'>
890
+ <clause id='N' inline-header='false' obligation='normative'>
891
+ <title depth="2">Intro</title>
892
+ </clause>
893
+ <clause id='O' inline-header='true' obligation='normative'> </clause>
894
+ </introduction>
895
+ </preface>
896
+ <sections>
897
+ <clause id='M1' inline-header='false' obligation='normative'>
898
+ <title>1.</title>
899
+ <clause id='N1' inline-header='false' obligation='normative'>
900
+ <title>1.1.</title>
901
+ </clause>
902
+ <clause id='O1' inline-header='true' obligation='normative'>
903
+ <title>1.2.</title>
904
+ </clause>
905
+ </clause>
906
+ </sections>
907
+ </iso-standard>
1109
908
  OUTPUT
1110
909
  end
1111
910
 
1112
911
  it "processes clauses containing normative references" do
1113
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
912
+ input = <<~INPUT
1114
913
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1115
914
  <bibliography>
1116
915
  <clause id="D" obligation="informative">
@@ -1132,16 +931,43 @@ OUTPUT
1132
931
  </clause>
1133
932
 
1134
933
  </bibliography>
934
+ </iso-standard>
1135
935
  INPUT
936
+ presxml = <<~OUTPUT
937
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
938
+ <bibliography>
939
+ <clause id="D" obligation="informative">
940
+ <title depth="1">Bibliography</title>
941
+ <references id="E" obligation="informative" normative="false">
942
+ <title depth="2">Bibliography Subsection 1</title>
943
+ </references>
944
+ <references id="F" obligation="informative" normative="false">
945
+ <title depth="2">Bibliography Subsection 2</title>
946
+ </references>
947
+ </clause>
948
+ <clause id="A" obligation="informative"><title depth="1">1.<tab/>First References</title>
949
+ <references id="B" obligation="informative" normative="true">
950
+ <title depth="2">1.1.<tab/>Normative References 1</title>
951
+ </references>
952
+ <references id="C" obligation="informative" normative="false">
953
+ <title depth="2">1.2.<tab/>Normative References 2</title>
954
+ </references>
955
+ </clause>
956
+
957
+ </bibliography>
958
+ </iso-standard>
959
+ OUTPUT
960
+
961
+ html = <<~OUTPUT
1136
962
  #{HTML_HDR}
1137
963
  <p class='zzSTDTitle1'/>
1138
964
  <div>
1139
- <h1>1.&#160; Normative references</h1>
965
+ <h1>1.&#160; First References</h1>
1140
966
  <div>
1141
- <h2>1.1.&#160; Normative References 1</h2>
967
+ <h2 class='Section3'>1.1.&#160; Normative References 1</h2>
1142
968
  </div>
1143
969
  <div>
1144
- <h2>1.2.&#160; Normative References 2</h2>
970
+ <h2 class='Section3'>1.2.&#160; Normative References 2</h2>
1145
971
  </div>
1146
972
  </div>
1147
973
  <br/>
@@ -1159,6 +985,8 @@ INPUT
1159
985
  </html>
1160
986
 
1161
987
  OUTPUT
988
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
989
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1162
990
  end
1163
991
 
1164
992