metanorma-iso 1.8.0 → 1.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -13
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -8
  5. data/lib/asciidoctor/iso/base.rb +14 -11
  6. data/lib/asciidoctor/iso/biblio.rng +1 -0
  7. data/lib/asciidoctor/iso/cleanup.rb +40 -24
  8. data/lib/asciidoctor/iso/front.rb +28 -16
  9. data/lib/asciidoctor/iso/front_id.rb +66 -50
  10. data/lib/asciidoctor/iso/isodoc.rng +191 -3
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +12 -0
  13. data/lib/asciidoctor/iso/section.rb +2 -1
  14. data/lib/asciidoctor/iso/validate.rb +22 -110
  15. data/lib/asciidoctor/iso/validate_image.rb +97 -0
  16. data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
  17. data/lib/asciidoctor/iso/validate_section.rb +55 -29
  18. data/lib/asciidoctor/iso/validate_style.rb +36 -24
  19. data/lib/asciidoctor/iso/validate_title.rb +2 -4
  20. data/lib/isodoc/iso/base_convert.rb +20 -14
  21. data/lib/isodoc/iso/html/isodoc.css +475 -20
  22. data/lib/isodoc/iso/html/isodoc.scss +456 -23
  23. data/lib/isodoc/iso/html/wordstyle.css +202 -31
  24. data/lib/isodoc/iso/html/wordstyle.scss +194 -32
  25. data/lib/isodoc/iso/iso.amendment.xsl +666 -193
  26. data/lib/isodoc/iso/iso.international-standard.xsl +666 -193
  27. data/lib/isodoc/iso/metadata.rb +3 -2
  28. data/lib/isodoc/iso/presentation_xml_convert.rb +15 -14
  29. data/lib/isodoc/iso/sts_convert.rb +10 -13
  30. data/lib/isodoc/iso/word_convert.rb +153 -39
  31. data/lib/isodoc/iso/xref.rb +44 -29
  32. data/lib/metanorma/iso/processor.rb +1 -0
  33. data/lib/metanorma/iso/version.rb +1 -1
  34. data/metanorma-iso.gemspec +3 -3
  35. data/spec/asciidoctor/base_spec.rb +426 -305
  36. data/spec/asciidoctor/blocks_spec.rb +96 -34
  37. data/spec/asciidoctor/cleanup_spec.rb +383 -25
  38. data/spec/asciidoctor/section_spec.rb +0 -14
  39. data/spec/asciidoctor/validate_spec.rb +218 -83
  40. data/spec/isodoc/amd_spec.rb +193 -201
  41. data/spec/isodoc/blocks_spec.rb +100 -88
  42. data/spec/isodoc/i18n_spec.rb +36 -36
  43. data/spec/isodoc/inline_spec.rb +2 -2
  44. data/spec/isodoc/iso_spec.rb +86 -138
  45. data/spec/isodoc/postproc_spec.rb +492 -442
  46. data/spec/isodoc/ref_spec.rb +6 -6
  47. data/spec/isodoc/section_spec.rb +301 -306
  48. data/spec/isodoc/table_spec.rb +166 -231
  49. data/spec/isodoc/terms_spec.rb +11 -8
  50. data/spec/isodoc/xref_spec.rb +147 -118
  51. data/spec/spec_helper.rb +16 -15
  52. metadata +8 -7
@@ -75,7 +75,7 @@ RSpec.describe IsoDoc do
75
75
  </ext>
76
76
  </bibdata>
77
77
  <preface>
78
- <foreword>
78
+ <foreword displayorder="1">
79
79
  <p>
80
80
  <xref target="N">Scope, Note</xref>
81
81
  <xref target="note1">Widgets, 1, Note 1</xref>
@@ -87,7 +87,7 @@ RSpec.describe IsoDoc do
87
87
  </foreword>
88
88
  </preface>
89
89
  <sections>
90
- <clause id="scope">
90
+ <clause id="scope" displayorder="3">
91
91
  <title depth="1">Scope</title>
92
92
  <note id="N">
93
93
  <name>NOTE</name>
@@ -99,8 +99,8 @@ RSpec.describe IsoDoc do
99
99
  <xref target="N">Note</xref>
100
100
  </p>
101
101
  </clause>
102
- <terms id="terms"/>
103
- <clause id="widgets">
102
+ <terms id="terms" displayorder="2"/>
103
+ <clause id="widgets" displayorder="4">
104
104
  <title depth="1">Widgets</title>
105
105
  <clause id="widgets1" inline-header="true">
106
106
  <note id="note1">
@@ -122,7 +122,7 @@ RSpec.describe IsoDoc do
122
122
  </clause>
123
123
  </clause>
124
124
  </sections>
125
- <annex id="annex1">
125
+ <annex id="annex1" displayorder="5">
126
126
  <title>
127
127
  <strong>Annex A</strong>
128
128
  <br/>(informative)</title>
@@ -235,97 +235,102 @@ RSpec.describe IsoDoc do
235
235
  INPUT
236
236
  expect(xmlpp(output).sub(%r{<localized-strings>.*</localized-strings>}m, ""))
237
237
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
238
- <?xml version='1.0'?>
239
- <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
240
- <bibdata>
241
- <ext>
242
- <doctype language="">amendment</doctype>
243
- </ext>
244
- </bibdata>
245
- <preface>
246
- <foreword obligation="informative">
247
- <title>Foreword</title>
248
- <p id="A">This is a preamble
249
-
250
- <xref target="C">0.1</xref>
251
- <xref target="C1">0.2</xref>
252
- <xref target="D">Scope</xref>
253
- <xref target="H">[H]</xref>
254
- <xref target="I">[I]</xref>
255
- <xref target="J">[J]</xref>
256
- <xref target="K">[K]</xref>
257
- <xref target="L">[L]</xref>
258
- <xref target="M">Clause 4</xref>
259
- <xref target="N">Introduction</xref>
260
- <xref target="O">Clause 4.2</xref>
261
- <xref target="P">Annex A</xref>
262
- <xref target="Q">A.1</xref>
263
- <xref target="Q1">A.1.1</xref>
264
- <xref target="Q2">Annex A, Appendix 1</xref>
265
- <xref target="R">[R]</xref></p>
266
- </foreword>
267
- <introduction id="B" obligation="informative">
268
- <title depth="1">Introduction</title>
269
- <clause id="C" inline-header="false" obligation="informative">
270
- <title depth="2">Introduction Subsection</title>
271
- </clause>
272
- <clause id="C1" inline-header="true" obligation="informative">Text</clause>
273
- </introduction>
274
- </preface>
275
- <sections>
276
- <clause id="D" obligation="normative" type="scope">
277
- <title depth="1">Scope</title>
278
- <p id="E">Text</p>
279
- </clause>
280
- <clause id="M" inline-header="false" obligation="normative">
281
- <title depth="1">Clause 4</title>
282
- <clause id="N" inline-header="false" obligation="normative">
283
- <title depth="2">Introduction</title>
284
- </clause>
285
- <clause id="O" inline-header="false" obligation="normative">
286
- <title depth="2">Clause 4.2</title>
287
- </clause>
288
- </clause>
289
- </sections>
290
- <annex id="P" inline-header="false" obligation="normative">
291
- <title>
292
- <strong>Annex A</strong>
293
- <br/>(normative)
294
-
295
- <br/>
296
- <br/>
297
- <strong>Annex</strong></title>
298
- <clause id="Q" inline-header="false" obligation="normative">
299
- <title depth="2">A.1
300
-
301
- <tab/>
302
- Annex A.1</title>
303
- <clause id="Q1" inline-header="false" obligation="normative">
304
- <title depth="3">A.1.1
305
-
306
- <tab/>
307
- Annex A.1a</title>
308
- </clause>
309
- </clause>
310
- <appendix id="Q2" inline-header="false" obligation="normative">
311
- <title depth="2">Appendix 1
312
-
313
- <tab/>
314
- An Appendix</title>
315
- </appendix>
316
- </annex>
317
- <bibliography>
318
- <references id="R" normative="true" obligation="informative">
319
- <title depth="1">Normative References</title>
320
- </references>
321
- <clause id="S" obligation="informative">
322
- <title depth="1">Bibliography</title>
323
- <references id="T" normative="false" obligation="informative">
324
- <title depth="2">Bibliography Subsection</title>
325
- </references>
326
- </clause>
327
- </bibliography>
328
- </iso-standard>
238
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
239
+ <bibdata>
240
+ <ext>
241
+ <doctype language=''>amendment</doctype>
242
+ </ext>
243
+ </bibdata>
244
+
245
+ <preface>
246
+ <foreword obligation='informative' displayorder='1'>
247
+ <title>Foreword</title>
248
+ <p id='A'>
249
+ This is a preamble
250
+ <xref target='C'>0.1</xref>
251
+ <xref target='C1'>0.2</xref>
252
+ <xref target='D'>Scope</xref>
253
+ <xref target='H'>[H]</xref>
254
+ <xref target='I'>[I]</xref>
255
+ <xref target='J'>[J]</xref>
256
+ <xref target='K'>[K]</xref>
257
+ <xref target='L'>[L]</xref>
258
+ <xref target='M'>Clause 4</xref>
259
+ <xref target='N'>Introduction</xref>
260
+ <xref target='O'>Clause 4.2</xref>
261
+ <xref target='P'>Annex A</xref>
262
+ <xref target='Q'>A.1</xref>
263
+ <xref target='Q1'>A.1.1</xref>
264
+ <xref target='Q2'>Annex A, Appendix 1</xref>
265
+ <xref target='R'>[R]</xref>
266
+ </p>
267
+ </foreword>
268
+ <introduction id='B' obligation='informative' displayorder='2'>
269
+ <title depth='1'>Introduction</title>
270
+ <clause id='C' inline-header='false' obligation='informative'>
271
+ <title depth='2'>Introduction Subsection</title>
272
+ </clause>
273
+ <clause id='C1' inline-header='true' obligation='informative'>Text</clause>
274
+ </introduction>
275
+ </preface>
276
+ <sections>
277
+ <clause id='D' obligation='normative' type='scope' displayorder='3'>
278
+ <title depth='1'>Scope</title>
279
+ <p id='E'>Text</p>
280
+ </clause>
281
+ <clause id='M' inline-header='false' obligation='normative' displayorder='5'>
282
+ <title depth='1'>Clause 4</title>
283
+ <clause id='N' inline-header='false' obligation='normative'>
284
+ <title depth='2'>Introduction</title>
285
+ </clause>
286
+ <clause id='O' inline-header='false' obligation='normative'>
287
+ <title depth='2'>Clause 4.2</title>
288
+ </clause>
289
+ </clause>
290
+ </sections>
291
+ <annex id='P' inline-header='false' obligation='normative' displayorder='6'>
292
+ <title>
293
+ <strong>Annex A</strong>
294
+ <br/>
295
+ (normative)
296
+ <br/>
297
+ <br/>
298
+ <strong>Annex</strong>
299
+ </title>
300
+ <clause id='Q' inline-header='false' obligation='normative'>
301
+ <title depth='2'>
302
+ A.1
303
+ <tab/>
304
+ Annex A.1
305
+ </title>
306
+ <clause id='Q1' inline-header='false' obligation='normative'>
307
+ <title depth='3'>
308
+ A.1.1
309
+ <tab/>
310
+ Annex A.1a
311
+ </title>
312
+ </clause>
313
+ </clause>
314
+ <appendix id='Q2' inline-header='false' obligation='normative'>
315
+ <title depth='2'>
316
+ Appendix 1
317
+ <tab/>
318
+ An Appendix
319
+ </title>
320
+ </appendix>
321
+ </annex>
322
+ <bibliography>
323
+ <references id='R' normative='true' obligation='informative' displayorder='4'>
324
+ <title depth='1'>Normative References</title>
325
+ </references>
326
+ <clause id='S' obligation='informative' displayorder='7'>
327
+ <title depth='1'>Bibliography</title>
328
+ <references id='T' normative='false' obligation='informative'>
329
+ <title depth='2'>Bibliography Subsection</title>
330
+ </references>
331
+ </clause>
332
+ </bibliography>
333
+ </iso-standard>
329
334
  OUTPUT
330
335
  end
331
336
 
@@ -423,109 +428,96 @@ RSpec.describe IsoDoc do
423
428
  </iso-standard>
424
429
  INPUT
425
430
  presxml = <<~OUTPUT
426
- <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
427
- <bibdata>
428
- <ext>
429
- <doctype language="">amendment</doctype>
430
- </ext>
431
- </bibdata>
432
- <boilerplate>
433
- <copyright-statement>
434
- <clause>
435
- <title depth="1">Copyright</title>
436
- </clause>
437
- </copyright-statement>
438
- <license-statement>
439
- <clause>
440
- <title depth="1">License</title>
441
- </clause>
442
- </license-statement>
443
- <legal-statement>
444
- <clause>
445
- <title depth="1">Legal</title>
446
- </clause>
447
- </legal-statement>
448
- <feedback-statement>
449
- <clause>
450
- <title depth="1">Feedback</title>
451
- </clause>
452
- </feedback-statement>
453
- </boilerplate>
454
- <preface>
455
- <abstract obligation="informative">
456
- <title>Abstract</title>
457
- </abstract>
458
- <foreword obligation="informative">
459
- <title>Foreword</title>
460
- <p id="A">This is a preamble</p>
461
- </foreword>
462
- <introduction id="B" obligation="informative">
463
- <title depth="1">Introduction</title>
464
- <clause id="C" inline-header="false" obligation="informative">
465
- <title depth="2">Introduction Subsection</title>
466
- </clause>
467
- </introduction>
468
- <clause id="B1">
469
- <title depth="1">Dedication</title>
470
- </clause>
471
- <clause id="B2">
472
- <title depth="1">Note to reader</title>
473
- </clause>
474
- <acknowledgements obligation="informative">
475
- <title>Acknowledgements</title>
476
- </acknowledgements>
477
- </preface>
478
- <sections>
479
- <clause id="M" inline-header="false" obligation="normative">
480
- <title depth="1">Clause 4</title>
481
- <clause id="N" inline-header="false" obligation="normative">
482
- <title depth="2">Introduction</title>
483
- </clause>
484
- <clause id="O" inline-header="false" obligation="normative">
485
- <title depth="2">Clause 4.2</title>
486
- </clause>
487
- <clause id="O1" inline-header="true" obligation="normative"/>
488
- </clause>
489
- <clause id="D" obligation="normative">
490
- <title depth="1">Scope</title>
491
- <p id="E">Text</p>
492
- </clause>
493
- </sections>
494
- <annex id="P" inline-header="false" obligation="normative">
495
- <title>
496
- <strong>Annex A</strong>
497
- <br/>(normative)
498
- <br/>
499
- <br/>
500
- <strong>Annex</strong></title>
501
- <clause id="Q" inline-header="false" obligation="normative">
502
- <title depth="2">A.1
503
- <tab/>
504
- Annex A.1</title>
505
- <clause id="Q1" inline-header="false" obligation="normative">
506
- <title depth="3">A.1.1
507
- <tab/>
508
- Annex A.1a</title>
509
- </clause>
510
- </clause>
511
- </annex>
512
- <annex id="P1" inline-header="false" obligation="normative">
513
- <title>
514
- <strong>Annex B</strong>
515
- <br/>(normative)</title>
516
- </annex>
517
- <bibliography>
518
- <references id="R" normative="true" obligation="informative">
519
- <title depth="1">Normative References</title>
520
- </references>
521
- <clause id="S" obligation="informative">
522
- <title depth="1">Bibliography</title>
523
- <references id="T" normative="false" obligation="informative">
524
- <title depth="2">Bibliography Subsection</title>
525
- </references>
526
- </clause>
527
- </bibliography>
528
- </iso-standard>
431
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
432
+ <bibdata>
433
+ <ext>
434
+ <doctype language="">amendment</doctype>
435
+ </ext>
436
+ </bibdata>
437
+ <boilerplate>
438
+ <copyright-statement>
439
+ <clause>
440
+ <title depth="1">Copyright</title>
441
+ </clause>
442
+ </copyright-statement>
443
+ <license-statement>
444
+ <clause>
445
+ <title depth="1">License</title>
446
+ </clause>
447
+ </license-statement>
448
+ <legal-statement>
449
+ <clause>
450
+ <title depth="1">Legal</title>
451
+ </clause>
452
+ </legal-statement>
453
+ <feedback-statement>
454
+ <clause>
455
+ <title depth="1">Feedback</title>
456
+ </clause>
457
+ </feedback-statement>
458
+ </boilerplate>
459
+ <preface>
460
+ <abstract obligation="informative" displayorder="1">
461
+ <title>Abstract</title>
462
+ </abstract>
463
+ <foreword obligation="informative" displayorder="2">
464
+ <title>Foreword</title>
465
+ <p id="A">This is a preamble</p>
466
+ </foreword>
467
+ <introduction id="B" obligation="informative" displayorder="3">
468
+ <title depth="1">Introduction</title>
469
+ <clause id="C" inline-header="false" obligation="informative">
470
+ <title depth="2">Introduction Subsection</title>
471
+ </clause>
472
+ </introduction>
473
+ <clause id="B1" displayorder="4">
474
+ <title depth="1">Dedication</title>
475
+ </clause>
476
+ <clause id="B2" displayorder="5">
477
+ <title depth="1">Note to reader</title>
478
+ </clause>
479
+ <acknowledgements obligation="informative" displayorder="6">
480
+ <title>Acknowledgements</title>
481
+ </acknowledgements>
482
+ </preface>
483
+ <sections>
484
+ <clause id="M" inline-header="false" obligation="normative" displayorder="8">
485
+ <title depth="1">Clause 4</title>
486
+ <clause id="N" inline-header="false" obligation="normative">
487
+ <title depth="2">Introduction</title>
488
+ </clause>
489
+ <clause id="O" inline-header="false" obligation="normative">
490
+ <title depth="2">Clause 4.2</title>
491
+ </clause>
492
+ <clause id="O1" inline-header="true" obligation="normative"/>
493
+ </clause>
494
+ <clause id="D" obligation="normative" displayorder="9">
495
+ <title depth="1">Scope</title>
496
+ <p id="E">Text</p>
497
+ </clause>
498
+ </sections>
499
+ <annex id="P" inline-header="false" obligation="normative" displayorder="10">
500
+ <title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
501
+ <clause id="Q" inline-header="false" obligation="normative">
502
+ <title depth="2">A.1<tab/>Annex A.1</title>
503
+ <clause id="Q1" inline-header="false" obligation="normative">
504
+ <title depth="3">A.1.1<tab/>Annex A.1a</title>
505
+ </clause>
506
+ </clause>
507
+ </annex>
508
+ <annex id="P1" inline-header="false" obligation="normative" displayorder="11"><title><strong>Annex B</strong><br/>(normative)</title></annex>
509
+ <bibliography>
510
+ <references id="R" normative="true" obligation="informative" displayorder="7">
511
+ <title depth="1">Normative References</title>
512
+ </references>
513
+ <clause id="S" obligation="informative" displayorder="12">
514
+ <title depth="1">Bibliography</title>
515
+ <references id="T" normative="false" obligation="informative">
516
+ <title depth="2">Bibliography Subsection</title>
517
+ </references>
518
+ </clause>
519
+ </bibliography>
520
+ </iso-standard>
529
521
  OUTPUT
530
522
  html = <<~OUTPUT
531
523
  <html lang="en" xmlns:epub="http://www.idpf.org/2007/ops">
@@ -617,9 +609,9 @@ RSpec.describe IsoDoc do
617
609
  <br/>
618
610
  <b>Annex</b></h1>
619
611
  <div id="Q">
620
- <h2>A.1 &#160; Annex A.1</h2>
612
+ <h2>A.1&#160; Annex A.1</h2>
621
613
  <div id="Q1">
622
- <h3>A.1.1 &#160; Annex A.1a</h3>
614
+ <h3>A.1.1&#160; Annex A.1a</h3>
623
615
  </div>
624
616
  </div>
625
617
  </div>
@@ -1,8 +1,8 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
- it "renders figures (HTML)" do
5
- output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
4
+ it "renders figures" do
5
+ input = <<~INPUT
6
6
  <iso-standard xmlns='http://riboseinc.com/isoxml'>
7
7
  <preface>
8
8
  <foreword id='fwd'>
@@ -57,7 +57,7 @@ RSpec.describe IsoDoc do
57
57
  </annex>
58
58
  </iso-standard>
59
59
  INPUT
60
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
60
+ html = <<~OUTPUT
61
61
  #{HTML_HDR}
62
62
  <br/>
63
63
  <div id="fwd">
@@ -113,6 +113,85 @@ RSpec.describe IsoDoc do
113
113
  </body>
114
114
  </html>
115
115
  OUTPUT
116
+ word = <<~OUTPUT
117
+ <body lang='EN-US' link='blue' vlink='#954F72'>
118
+ <div class='WordSection1'>
119
+ <p>&#xA0;</p>
120
+ </div>
121
+ <p>
122
+ <br clear='all' class='section'/>
123
+ </p>
124
+ <div class='WordSection2'>
125
+ <p>
126
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
127
+ </p>
128
+ <div id='fwd'>
129
+ <h1 class='ForewordTitle'>Foreword</h1>
130
+ <p class='ForewordText'> </p>
131
+ </div>
132
+ <p>&#xA0;</p>
133
+ </div>
134
+ <p>
135
+ <br clear='all' class='section'/>
136
+ </p>
137
+ <div class='WordSection3'>
138
+ <p class='zzSTDTitle1'/>
139
+ <div id='scope'>
140
+ <h1>Scope</h1>
141
+ <div id='N' class='figure'>
142
+ <img src='rice_images/rice_image1.png'/>
143
+ <p class='FigureTitle' style='text-align:center;'>Figure 1&#xA0;&#x2014; Split-it-right sample divider</p>
144
+ </div>
145
+ <p> </p>
146
+ </div>
147
+ <div id='terms'>
148
+ <h1/>
149
+ </div>
150
+ <div id='widgets'>
151
+ <h1>Widgets</h1>
152
+ <div id='widgets1'>
153
+ <div id='note1' class='figure'>
154
+ <img src='rice_images/rice_image1.png'/>
155
+ <p class='FigureTitle' style='text-align:center;'>Figure 2&#xA0;&#x2014; Split-it-right sample divider</p>
156
+ </div>
157
+ <div id='note2' class='figure'>
158
+ <img src='rice_images/rice_image1.png'/>
159
+ <p class='FigureTitle' style='text-align:center;'>Figure 3&#xA0;&#x2014; Split-it-right sample divider</p>
160
+ </div>
161
+ <p> </p>
162
+ </div>
163
+ </div>
164
+ <p>
165
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
166
+ </p>
167
+ <div id='annex1' class='Section3'>
168
+ <div id='annex1a'>
169
+ <div id='AN' class='figure'>
170
+ <img src='rice_images/rice_image1.png'/>
171
+ <p class='AnnexFigureTitle' style='text-align:center;'>Figure A.1&#xA0;&#x2014; Split-it-right sample divider</p>
172
+ </div>
173
+ </div>
174
+ <div id='annex1b'>
175
+ <div id='Anote1' class='figure'>
176
+ <img src='rice_images/rice_image1.png'/>
177
+ <p class='AnnexFigureTitle' style='text-align:center;'>Figure A.2&#xA0;&#x2014; Split-it-right sample divider</p>
178
+ </div>
179
+ <div id='Anote2' class='figure'>
180
+ <img src='rice_images/rice_image1.png'/>
181
+ <p class='AnnexFigureTitle' style='text-align:center;'>Figure A.3&#xA0;&#x2014; Split-it-right sample divider</p>
182
+ </div>
183
+ </div>
184
+ </div>
185
+ </div>
186
+ <br clear='all' style='page-break-before:left;mso-break-type:section-break'/>
187
+ <div class='colophon'/>
188
+ </body>
189
+ OUTPUT
190
+ output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", input, true)
191
+ expect(xmlpp(output)).to be_equivalent_to xmlpp(html)
192
+ output = IsoDoc::Iso::WordConvert.new({}).convert("test", input, true)
193
+ expect(xmlpp(Nokogiri::XML(output).at("//body").to_xml))
194
+ .to be_equivalent_to xmlpp(word)
116
195
  end
117
196
 
118
197
  it "renders subfigures (HTML)" do
@@ -250,8 +329,8 @@ RSpec.describe IsoDoc do
250
329
  OUTPUT
251
330
  end
252
331
 
253
- it "processes formulae (Presentation XML)" do
254
- output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)
332
+ it "processes formulae" do
333
+ input = <<~INPUT
255
334
  <iso-standard xmlns="http://riboseinc.com/isoxml">
256
335
  <preface>
257
336
  <foreword>
@@ -282,11 +361,11 @@ RSpec.describe IsoDoc do
282
361
  </preface>
283
362
  </iso-standard>
284
363
  INPUT
285
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
364
+ presxml = <<~OUTPUT
286
365
  <?xml version='1.0'?>
287
366
  <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
288
367
  <preface>
289
- <foreword>
368
+ <foreword displayorder="1">
290
369
  <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true">
291
370
  <stem type="AsciiMath">r = 1 %</stem>
292
371
  <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
@@ -319,45 +398,8 @@ RSpec.describe IsoDoc do
319
398
  </preface>
320
399
  </iso-standard>
321
400
  OUTPUT
322
- end
323
401
 
324
- it "processes formulae (HTML)" do
325
- output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
326
- <iso-standard xmlns="http://riboseinc.com/isoxml">
327
- <preface>
328
- <foreword>
329
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true">
330
- <stem type="AsciiMath">r = 1 %</stem>
331
- <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
332
- <dt>
333
- <stem type="AsciiMath">r</stem>
334
- </dt>
335
- <dd>
336
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
337
- </dd>
338
- <dt>
339
- <stem type="AsciiMath">s_1</stem>
340
- </dt>
341
- <dd>
342
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the other repeatability limit.</p>
343
- </dd>
344
- </dl>
345
- <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
346
- <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the &quot;P&quot;
347
- prefix. &quot;P&quot; is unnecessary because between &quot;G&quot; and &quot;U&quot; duration is
348
- always expressed.
349
- </p>
350
- </note>
351
- </formula>
352
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
353
- <name>1</name>
354
- <stem type="AsciiMath">r = 1 %</stem>
355
- </formula>
356
- </foreword>
357
- </preface>
358
- </iso-standard>
359
- INPUT
360
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
402
+ html = <<~OUTPUT
361
403
  #{HTML_HDR}
362
404
  <br/>
363
405
  <div>
@@ -385,6 +427,7 @@ RSpec.describe IsoDoc do
385
427
  </dl>
386
428
  <div id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0' class='Note'>
387
429
  <p>
430
+ <span class='note_label'>NOTE</span>
388
431
  &#160; [durationUnits] is essentially a duration statement without
389
432
  the "P" prefix. "P" is unnecessary because between "G" and "U"
390
433
  duration is always expressed.
@@ -405,47 +448,8 @@ RSpec.describe IsoDoc do
405
448
  </body>
406
449
  </html>
407
450
  OUTPUT
408
- end
409
451
 
410
- it "processes formulae (Word)" do
411
- output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true)
412
- <iso-standard xmlns="http://riboseinc.com/isoxml">
413
- <preface>
414
- <foreword>
415
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true">
416
- <stem type="AsciiMath">r = 1 %</stem>
417
- <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
418
- <dt>
419
- <stem type="AsciiMath">r</stem>
420
- </dt>
421
- <dd>
422
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
423
- </dd>
424
- <dt>
425
- <stem type="AsciiMath">s_1</stem>
426
- </dt>
427
- <dd>
428
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the other repeatability limit.</p>
429
- </dd>
430
- </dl>
431
- <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
432
- <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the &quot;P&quot;
433
- prefix. &quot;P&quot; is unnecessary because between &quot;G&quot; and &quot;U&quot; duration is
434
- always expressed.
435
- </p>
436
- </note>
437
- </formula>
438
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
439
- <name>1</name>
440
- <stem type="AsciiMath">r = 1 %</stem>
441
- </formula>
442
- </foreword>
443
- </preface>
444
- </iso-standard>
445
- INPUT
446
- expect(xmlpp(output
447
- .sub(%r{^.*<div>\s*<h1 class="ForewordTitle">}m, '<div><h1 class="ForewordTitle">')
448
- .sub(%r{<p>&#160;</p>\s*</div>.*$}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
452
+ word = <<~OUTPUT
449
453
  <div>
450
454
  <h1 class='ForewordTitle'>Foreword</h1>
451
455
  <div id='_be9158af-7e93-4ee2-90c5-26d31c181934'><div class='formula'>
@@ -463,7 +467,7 @@ RSpec.describe IsoDoc do
463
467
  </p>
464
468
  </td>
465
469
  <td valign="top">
466
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
470
+ <p class="ForewordText" id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
467
471
  </td>
468
472
  </tr>
469
473
  <tr>
@@ -473,13 +477,13 @@ RSpec.describe IsoDoc do
473
477
  </p>
474
478
  </td>
475
479
  <td valign="top">
476
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the other repeatability limit.</p>
480
+ <p class="ForewordText" id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the other repeatability limit.</p>
477
481
  </td>
478
482
  </tr>
479
483
  </table>
480
484
  <div id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0' class='Note'>
481
485
  <p class='Note'>
482
- <span class='note_label'/>
486
+ <span class='note_label'>NOTE</span>
483
487
  <span style='mso-tab-count:1'>&#160; </span>
484
488
  [durationUnits] is essentially a duration statement without the "P"
485
489
  prefix. "P" is unnecessary because between "G" and "U" duration is
@@ -497,6 +501,14 @@ RSpec.describe IsoDoc do
497
501
  </div>
498
502
  </div>
499
503
  OUTPUT
504
+ output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)
505
+ expect(xmlpp(output)).to be_equivalent_to xmlpp(presxml)
506
+ output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true)
507
+ expect(xmlpp(output)).to be_equivalent_to xmlpp(html)
508
+ output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
509
+ expect(xmlpp(output
510
+ .sub(%r{^.*<div>\s*<h1 class="ForewordTitle">}m, '<div><h1 class="ForewordTitle">')
511
+ .sub(%r{<p>&#160;</p>\s*</div>.*$}m, ""))).to be_equivalent_to xmlpp(word)
500
512
  end
501
513
 
502
514
  it "processes formulae with single definition list entry" do