isodoc 1.6.3 → 1.6.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +2 -12
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -6
  5. data/isodoc.gemspec +3 -2
  6. data/lib/isodoc-yaml/i18n-en.yaml +1 -0
  7. data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
  8. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  9. data/lib/isodoc.rb +0 -2
  10. data/lib/isodoc/convert.rb +7 -1
  11. data/lib/isodoc/function/blocks.rb +5 -4
  12. data/lib/isodoc/function/cleanup.rb +52 -43
  13. data/lib/isodoc/function/inline.rb +7 -7
  14. data/lib/isodoc/function/references.rb +33 -52
  15. data/lib/isodoc/function/section.rb +28 -16
  16. data/lib/isodoc/function/table.rb +21 -22
  17. data/lib/isodoc/function/terms.rb +6 -7
  18. data/lib/isodoc/function/to_word_html.rb +6 -3
  19. data/lib/isodoc/function/utils.rb +181 -163
  20. data/lib/isodoc/gem_tasks.rb +8 -9
  21. data/lib/isodoc/headlesshtml_convert.rb +8 -7
  22. data/lib/isodoc/html_convert.rb +5 -1
  23. data/lib/isodoc/html_function/comments.rb +14 -12
  24. data/lib/isodoc/html_function/footnotes.rb +14 -7
  25. data/lib/isodoc/html_function/html.rb +30 -26
  26. data/lib/isodoc/html_function/postprocess.rb +191 -182
  27. data/lib/isodoc/html_function/sectionsplit.rb +230 -0
  28. data/lib/isodoc/metadata.rb +22 -20
  29. data/lib/isodoc/metadata_contributor.rb +31 -28
  30. data/lib/isodoc/pdf_convert.rb +11 -13
  31. data/lib/isodoc/presentation_function/bibdata.rb +50 -22
  32. data/lib/isodoc/presentation_function/inline.rb +20 -15
  33. data/lib/isodoc/presentation_function/section.rb +38 -1
  34. data/lib/isodoc/presentation_xml_convert.rb +2 -0
  35. data/lib/isodoc/version.rb +1 -1
  36. data/lib/isodoc/word_function/postprocess.rb +50 -36
  37. data/lib/isodoc/xref.rb +2 -0
  38. data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
  39. data/lib/isodoc/xref/xref_sect_gen.rb +4 -4
  40. data/spec/assets/scripts_override.html +3 -0
  41. data/spec/isodoc/blocks_spec.rb +373 -685
  42. data/spec/isodoc/cleanup_spec.rb +40 -42
  43. data/spec/isodoc/i18n_spec.rb +694 -821
  44. data/spec/isodoc/inline_spec.rb +482 -328
  45. data/spec/isodoc/metadata_spec.rb +384 -379
  46. data/spec/isodoc/postproc_spec.rb +163 -55
  47. data/spec/isodoc/presentation_xml_spec.rb +355 -278
  48. data/spec/isodoc/ref_spec.rb +5 -5
  49. data/spec/isodoc/section_spec.rb +216 -199
  50. data/spec/isodoc/sectionsplit_spec.rb +190 -0
  51. data/spec/isodoc/table_spec.rb +41 -42
  52. data/spec/isodoc/terms_spec.rb +84 -84
  53. data/spec/isodoc/xref_spec.rb +974 -932
  54. metadata +22 -5
@@ -125,7 +125,7 @@ RSpec.describe IsoDoc do
125
125
  <language current="true">en</language>
126
126
  </bibdata>
127
127
  <preface>
128
- <foreword>
128
+ <foreword displayorder="1">
129
129
  <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
130
130
  <eref bibitemid='ISO712'>[110]</eref>
131
131
  <eref bibitemid='ISBN'>[1]</eref>
@@ -139,7 +139,7 @@ RSpec.describe IsoDoc do
139
139
  </foreword>
140
140
  </preface>
141
141
  <bibliography>
142
- <references id='_normative_references' obligation='informative' normative='true'>
142
+ <references id='_normative_references' obligation='informative' normative='true' displayorder="2">
143
143
  <title depth='1'>1.<tab/>Normative References</title>
144
144
  <p>
145
145
  The following documents are referred to in the text in such a way that
@@ -219,7 +219,7 @@ RSpec.describe IsoDoc do
219
219
  <docidentifier type='metanorma'>[5]</docidentifier>
220
220
  </bibitem>
221
221
  </references>
222
- <references id='_bibliography' obligation='informative' normative='false'>
222
+ <references id='_bibliography' obligation='informative' normative='false' displayorder="3">
223
223
  <title depth="1">Bibliography</title>
224
224
  <bibitem id='ISBN' type='ISBN'>
225
225
  <title format='text/plain'>Chemicals for analytical laboratory use</title>
@@ -278,7 +278,7 @@ RSpec.describe IsoDoc do
278
278
  </bibitem>
279
279
  <bibitem id='ref11'>
280
280
  <title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
281
- <docidentifier type='IETF'>RFC 10</docidentifier>
281
+ <docidentifier type='IETF'>IETF RFC 10</docidentifier>
282
282
  </bibitem>
283
283
  <bibitem id='ref12'>
284
284
  <formattedref format='application/x-isodoc+xml'>
@@ -287,7 +287,7 @@ RSpec.describe IsoDoc do
287
287
  .
288
288
  </formattedref>
289
289
  <docidentifier type='metanorma'>[Citn]</docidentifier>
290
- <docidentifier type='IETF'>RFC 20</docidentifier>
290
+ <docidentifier type='IETF'>IETF RFC 20</docidentifier>
291
291
  </bibitem>
292
292
  </references>
293
293
  </bibliography>
@@ -129,30 +129,32 @@ RSpec.describe IsoDoc do
129
129
  end
130
130
 
131
131
  it "processes document with no content" do
132
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
133
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
134
- <iso-standard xmlns="http://riboseinc.com/isoxml">
135
- <preface/>
136
- <sections/>
137
- </iso-standard>
132
+ input = <<~INPUT
133
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
134
+ <preface/>
135
+ <sections/>
136
+ </iso-standard>
138
137
  INPUT
139
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
140
- <head/>
141
- <body lang="en">
142
- <div class="title-section">
143
- <p>&#160;</p>
144
- </div>
145
- <br/>
146
- <div class="prefatory-section">
147
- <p>&#160;</p>
148
- </div>
149
- <br/>
150
- <div class="main-section">
151
- <p class="zzSTDTitle1"/>
152
- </div>
153
- </body>
154
- </html>
138
+ output = <<~OUTPUT
139
+ <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
140
+ <head/>
141
+ <body lang="en">
142
+ <div class="title-section">
143
+ <p>&#160;</p>
144
+ </div>
145
+ <br/>
146
+ <div class="prefatory-section">
147
+ <p>&#160;</p>
148
+ </div>
149
+ <br/>
150
+ <div class="main-section">
151
+ <p class="zzSTDTitle1"/>
152
+ </div>
153
+ </body>
154
+ </html>
155
155
  OUTPUT
156
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
157
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
156
158
  end
157
159
 
158
160
  it "processes section names" do
@@ -261,50 +263,50 @@ RSpec.describe IsoDoc do
261
263
  INPUT
262
264
 
263
265
  presxml = <<~"PRESXML"
264
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
266
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
265
267
  <boilerplate>
266
268
  <copyright-statement>
267
269
  <clause>
268
- <title depth="1">Copyright</title>
270
+ <title depth='1'>Copyright</title>
269
271
  </clause>
270
272
  </copyright-statement>
271
273
  <license-statement>
272
274
  <clause>
273
- <title depth="1">License</title>
275
+ <title depth='1'>License</title>
274
276
  </clause>
275
277
  </license-statement>
276
278
  <legal-statement>
277
279
  <clause>
278
- <title depth="1">Legal</title>
280
+ <title depth='1'>Legal</title>
279
281
  </clause>
280
282
  </legal-statement>
281
283
  <feedback-statement>
282
284
  <clause>
283
- <title depth="1">Feedback</title>
285
+ <title depth='1'>Feedback</title>
284
286
  </clause>
285
287
  </feedback-statement>
286
288
  </boilerplate>
287
289
  <preface>
288
- <abstract obligation='informative'>
290
+ <abstract obligation='informative' displayorder='1'>
289
291
  <title>Abstract</title>
290
292
  </abstract>
291
- <foreword obligation='informative'>
293
+ <foreword obligation='informative' displayorder='2'>
292
294
  <title>Foreword</title>
293
295
  <p id='A'>This is a preamble</p>
294
296
  </foreword>
295
- <introduction id='B' obligation='informative'>
297
+ <introduction id='B' obligation='informative' displayorder='3'>
296
298
  <title>Introduction</title>
297
299
  <clause id='C' inline-header='false' obligation='informative'>
298
300
  <title depth='2'>Introduction Subsection</title>
299
301
  </clause>
300
302
  </introduction>
301
- <clause id='B1'>
303
+ <clause id='B1' displayorder='4'>
302
304
  <title depth='1'>Dedication</title>
303
305
  </clause>
304
- <clause id='B2'>
306
+ <clause id='B2' displayorder='5'>
305
307
  <title depth='1'>Note to reader</title>
306
308
  </clause>
307
- <acknowledgements obligation='informative'>
309
+ <acknowledgements obligation='informative' displayorder='6'>
308
310
  <title>Acknowledgements</title>
309
311
  </acknowledgements>
310
312
  </preface>
@@ -316,11 +318,11 @@ RSpec.describe IsoDoc do
316
318
  <admonition id='NN2' type='warning'>
317
319
  <p>Initial admonition</p>
318
320
  </admonition>
319
- <clause id='D' obligation='normative' type='scope'>
321
+ <clause id='D' obligation='normative' type='scope' displayorder='7'>
320
322
  <title depth='1'>1.<tab/>Scope</title>
321
323
  <p id='E'>Text</p>
322
324
  </clause>
323
- <clause id='H' obligation='normative'>
325
+ <clause id='H' obligation='normative' displayorder='9'>
324
326
  <title depth='1'>3.<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
325
327
  <terms id='I' obligation='normative'>
326
328
  <title depth='2'>3.1.<tab/>Normal Terms</title>
@@ -330,21 +332,21 @@ RSpec.describe IsoDoc do
330
332
  </term>
331
333
  </terms>
332
334
  <definitions id='K'>
333
- <title depth='2'>3.2.<tab/>Definitions</title>
335
+ <title depth='2'>3.2.<tab/>Definitions</title>
334
336
  <dl>
335
337
  <dt>Symbol</dt>
336
338
  <dd>Definition</dd>
337
339
  </dl>
338
340
  </definitions>
339
341
  </clause>
340
- <definitions id='L'>
341
- <title depth='1'>4.<tab/>Symbols and abbreviated terms</title>
342
+ <definitions id='L' displayorder='10'>
343
+ <title depth='1'>4.<tab/>Symbols and abbreviated terms</title>
342
344
  <dl>
343
345
  <dt>Symbol</dt>
344
346
  <dd>Definition</dd>
345
347
  </dl>
346
348
  </definitions>
347
- <clause id='M' inline-header='false' obligation='normative'>
349
+ <clause id='M' inline-header='false' obligation='normative' displayorder='11'>
348
350
  <title depth='1'>5.<tab/>Clause 4</title>
349
351
  <clause id='N' inline-header='false' obligation='normative'>
350
352
  <title depth='2'>5.1.<tab/>Introduction</title>
@@ -357,8 +359,14 @@ RSpec.describe IsoDoc do
357
359
  </clause>
358
360
  </clause>
359
361
  </sections>
360
- <annex id='P' inline-header='false' obligation='normative'>
361
- <title> <strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong>
362
+ <annex id='P' inline-header='false' obligation='normative' displayorder='12'>
363
+ <title>
364
+ <strong>Annex A</strong>
365
+ <br/>
366
+ (normative)
367
+ <br/>
368
+ <br/>
369
+ <strong>Annex</strong>
362
370
  </title>
363
371
  <clause id='Q' inline-header='false' obligation='normative'>
364
372
  <title depth='2'>A.1.<tab/>Annex A.1</title>
@@ -370,17 +378,21 @@ RSpec.describe IsoDoc do
370
378
  </references>
371
379
  </clause>
372
380
  </annex>
373
- <annex id='P1' inline-header='false' obligation='normative'>
374
- <title><strong>Annex B</strong><br/>(normative)</title>
381
+ <annex id='P1' inline-header='false' obligation='normative' displayorder='13'>
382
+ <title>
383
+ <strong>Annex B</strong>
384
+ <br/>
385
+ (normative)
386
+ </title>
375
387
  </annex>
376
388
  <bibliography>
377
- <references id='R' obligation='informative' normative='true'>
378
- <title depth='1'>2.<tab/>Normative References</title>
389
+ <references id='R' obligation='informative' normative='true' displayorder='8'>
390
+ <title depth='1'>2.<tab/>Normative References</title>
379
391
  </references>
380
- <clause id='S' obligation='informative'>
392
+ <clause id='S' obligation='informative' displayorder='14'>
381
393
  <title depth='1'>Bibliography</title>
382
394
  <references id='T' obligation='informative' normative='false'>
383
- <title depth="2">Bibliography Subsection</title>
395
+ <title depth='2'>Bibliography Subsection</title>
384
396
  </references>
385
397
  </clause>
386
398
  </bibliography>
@@ -691,96 +703,95 @@ RSpec.describe IsoDoc do
691
703
  end
692
704
 
693
705
  it "processes section names suppressing section numbering" do
694
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({ suppressheadingnumbers: true })
695
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
696
- <iso-standard xmlns="http://riboseinc.com/isoxml">
697
- <preface>
698
- <foreword obligation="informative">
699
- <title>Foreword</title>
700
- <p id="A">This is a preamble</p>
701
- </foreword>
702
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
703
- <title>Introduction Subsection</title>
704
- </clause>
705
- </introduction></preface><sections>
706
- <clause id="D" obligation="normative" type="scope">
707
- <title>Scope</title>
708
- <p id="E">Text</p>
709
- </clause>
706
+ input = <<~INPUT
707
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
708
+ <preface>
709
+ <foreword obligation="informative">
710
+ <title>Foreword</title>
711
+ <p id="A">This is a preamble</p>
712
+ </foreword>
713
+ <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
714
+ <title>Introduction Subsection</title>
715
+ </clause>
716
+ </introduction></preface><sections>
717
+ <clause id="D" obligation="normative" type="scope">
718
+ <title>Scope</title>
719
+ <p id="E">Text</p>
720
+ </clause>
710
721
 
711
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
712
- <title>Normal Terms</title>
713
- <term id="J">
714
- <preferred>Term2</preferred>
715
- </term>
716
- </terms>
717
- <definitions id="K">
718
- <dl>
719
- <dt>Symbol</dt>
720
- <dd>Definition</dd>
721
- </dl>
722
- </definitions>
723
- </clause>
724
- <definitions id="L">
725
- <dl>
726
- <dt>Symbol</dt>
727
- <dd>Definition</dd>
728
- </dl>
729
- </definitions>
730
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
731
- <title>Introduction</title>
732
- </clause>
733
- <clause id="O" inline-header="false" obligation="normative">
734
- <title>Clause 4.2</title>
735
- </clause>
736
- <clause id="O1" inline-header="false" obligation="normative">
737
- </clause>
738
- </clause>
722
+ <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
723
+ <title>Normal Terms</title>
724
+ <term id="J">
725
+ <preferred>Term2</preferred>
726
+ </term>
727
+ </terms>
728
+ <definitions id="K">
729
+ <dl>
730
+ <dt>Symbol</dt>
731
+ <dd>Definition</dd>
732
+ </dl>
733
+ </definitions>
734
+ </clause>
735
+ <definitions id="L">
736
+ <dl>
737
+ <dt>Symbol</dt>
738
+ <dd>Definition</dd>
739
+ </dl>
740
+ </definitions>
741
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
742
+ <title>Introduction</title>
743
+ </clause>
744
+ <clause id="O" inline-header="false" obligation="normative">
745
+ <title>Clause 4.2</title>
746
+ </clause>
747
+ <clause id="O1" inline-header="false" obligation="normative">
748
+ </clause>
749
+ </clause>
739
750
 
740
- </sections><annex id="P" inline-header="false" obligation="normative">
741
- <title>Annex</title>
742
- <clause id="Q" inline-header="false" obligation="normative">
743
- <title>Annex A.1</title>
744
- <clause id="Q1" inline-header="false" obligation="normative">
745
- <title>Annex A.1a</title>
746
- </clause>
747
- </clause>
748
- </annex><bibliography><references id="R" obligation="informative" normative="true">
749
- <title>Normative References</title>
750
- </references><clause id="S" obligation="informative">
751
- <title>Bibliography</title>
752
- <references id="T" obligation="informative" normative="false">
753
- <title>Bibliography Subsection</title>
754
- </references>
755
- </clause>
756
- </bibliography>
757
- </iso-standard>
751
+ </sections><annex id="P" inline-header="false" obligation="normative">
752
+ <title>Annex</title>
753
+ <clause id="Q" inline-header="false" obligation="normative">
754
+ <title>Annex A.1</title>
755
+ <clause id="Q1" inline-header="false" obligation="normative">
756
+ <title>Annex A.1a</title>
757
+ </clause>
758
+ </clause>
759
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
760
+ <title>Normative References</title>
761
+ </references><clause id="S" obligation="informative">
762
+ <title>Bibliography</title>
763
+ <references id="T" obligation="informative" normative="false">
764
+ <title>Bibliography Subsection</title>
765
+ </references>
766
+ </clause>
767
+ </bibliography>
768
+ </iso-standard>
758
769
  INPUT
759
- <?xml version='1.0'?>
760
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
770
+ output = <<~OUTPUT
771
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
761
772
  <preface>
762
- <foreword obligation='informative'>
773
+ <foreword obligation='informative' displayorder='1'>
763
774
  <title>Foreword</title>
764
775
  <p id='A'>This is a preamble</p>
765
776
  </foreword>
766
- <introduction id='B' obligation='informative'>
777
+ <introduction id='B' obligation='informative' displayorder='2'>
767
778
  <title>Introduction</title>
768
779
  <clause id='C' inline-header='false' obligation='informative'>
769
- <title depth="2">Introduction Subsection</title>
780
+ <title depth='2'>Introduction Subsection</title>
770
781
  </clause>
771
782
  </introduction>
772
783
  </preface>
773
784
  <sections>
774
- <clause id='D' obligation='normative' type="scope">
775
- <title depth="1">Scope</title>
785
+ <clause id='D' obligation='normative' type='scope' displayorder='3'>
786
+ <title depth='1'>Scope</title>
776
787
  <p id='E'>Text</p>
777
788
  </clause>
778
- <clause id='H' obligation='normative'>
779
- <title depth="1">Terms, Definitions, Symbols and Abbreviated Terms</title>
789
+ <clause id='H' obligation='normative' displayorder='5'>
790
+ <title depth='1'>Terms, Definitions, Symbols and Abbreviated Terms</title>
780
791
  <terms id='I' obligation='normative'>
781
- <title depth="2">Normal Terms</title>
792
+ <title depth='2'>Normal Terms</title>
782
793
  <term id='J'>
783
- <name>3.1.1.</name>
794
+ <name>3.1.1.</name>
784
795
  <preferred>Term2</preferred>
785
796
  </term>
786
797
  </terms>
@@ -791,24 +802,24 @@ RSpec.describe IsoDoc do
791
802
  </dl>
792
803
  </definitions>
793
804
  </clause>
794
- <definitions id='L'>
805
+ <definitions id='L' displayorder='6'>
795
806
  <dl>
796
807
  <dt>Symbol</dt>
797
808
  <dd>Definition</dd>
798
809
  </dl>
799
810
  </definitions>
800
- <clause id='M' inline-header='false' obligation='normative'>
801
- <title depth="1">Clause 4</title>
811
+ <clause id='M' inline-header='false' obligation='normative' displayorder='7'>
812
+ <title depth='1'>Clause 4</title>
802
813
  <clause id='N' inline-header='false' obligation='normative'>
803
- <title depth="2">Introduction</title>
814
+ <title depth='2'>Introduction</title>
804
815
  </clause>
805
816
  <clause id='O' inline-header='false' obligation='normative'>
806
- <title depth="2">Clause 4.2</title>
817
+ <title depth='2'>Clause 4.2</title>
807
818
  </clause>
808
819
  <clause id='O1' inline-header='false' obligation='normative'> </clause>
809
820
  </clause>
810
821
  </sections>
811
- <annex id='P' inline-header='false' obligation='normative'>
822
+ <annex id='P' inline-header='false' obligation='normative' displayorder='8'>
812
823
  <title>
813
824
  <strong>Annex A</strong>
814
825
  <br/>
@@ -818,51 +829,55 @@ RSpec.describe IsoDoc do
818
829
  <strong>Annex</strong>
819
830
  </title>
820
831
  <clause id='Q' inline-header='false' obligation='normative'>
821
- <title depth="2">Annex A.1</title>
832
+ <title depth='2'>Annex A.1</title>
822
833
  <clause id='Q1' inline-header='false' obligation='normative'>
823
- <title depth="3">Annex A.1a</title>
834
+ <title depth='3'>Annex A.1a</title>
824
835
  </clause>
825
836
  </clause>
826
837
  </annex>
827
838
  <bibliography>
828
- <references id='R' obligation='informative' normative='true'>
829
- <title depth="1">Normative References</title>
839
+ <references id='R' obligation='informative' normative='true' displayorder='4'>
840
+ <title depth='1'>Normative References</title>
830
841
  </references>
831
- <clause id='S' obligation='informative'>
832
- <title depth="1">Bibliography</title>
842
+ <clause id='S' obligation='informative' displayorder='9'>
843
+ <title depth='1'>Bibliography</title>
833
844
  <references id='T' obligation='informative' normative='false'>
834
- <title depth="2">Bibliography Subsection</title>
845
+ <title depth='2'>Bibliography Subsection</title>
835
846
  </references>
836
847
  </clause>
837
848
  </bibliography>
838
849
  </iso-standard>
839
850
  OUTPUT
851
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({ suppressheadingnumbers: true })
852
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
840
853
  end
841
854
 
842
855
  it "processes section titles without ID" do
843
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({ suppressheadingnumbers: true })
844
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
845
- <iso-standard xmlns="http://riboseinc.com/isoxml">
846
- <preface>
847
- <introduction id="B" obligation="informative"><title>Introduction</title><clause obligation="informative">
848
- <title>Introduction Subsection</title>
849
- </clause>
850
- </introduction>
851
- </preface>
852
- </iso-standard>
856
+ input = <<~INPUT
857
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
858
+ <preface>
859
+ <introduction id="B" obligation="informative"><title>Introduction</title><clause obligation="informative">
860
+ <title>Introduction Subsection</title>
861
+ </clause>
862
+ </introduction>
863
+ </preface>
864
+ </iso-standard>
853
865
  INPUT
854
- <?xml version='1.0'?>
855
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
856
- <preface>
857
- <introduction id='B' obligation='informative'>
858
- <title>Introduction</title>
859
- <clause obligation='informative'>
860
- <title depth="1">Introduction Subsection</title>
861
- </clause>
862
- </introduction>
863
- </preface>
864
- </iso-standard>
866
+ output = <<~OUTPUT
867
+ <?xml version='1.0'?>
868
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
869
+ <preface>
870
+ <introduction id='B' obligation='informative' displayorder="1">
871
+ <title>Introduction</title>
872
+ <clause obligation='informative'>
873
+ <title depth="1">Introduction Subsection</title>
874
+ </clause>
875
+ </introduction>
876
+ </preface>
877
+ </iso-standard>
865
878
  OUTPUT
879
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({ suppressheadingnumbers: true })
880
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
866
881
  end
867
882
 
868
883
  it "processes simple terms & definitions" do
@@ -881,7 +896,7 @@ RSpec.describe IsoDoc do
881
896
  presxml = <<~"OUTPUT"
882
897
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
883
898
  <sections>
884
- <terms id='H' obligation='normative'>
899
+ <terms id='H' obligation='normative' displayorder="1">
885
900
  <title depth='1'>1.<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
886
901
  <term id='J'>
887
902
  <name>1.1.</name>
@@ -928,7 +943,7 @@ RSpec.describe IsoDoc do
928
943
  presxml = <<~"PRESXML"
929
944
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
930
945
  <sections>
931
- <clause id='M' inline-header='false' obligation='normative'>
946
+ <clause id='M' inline-header='false' obligation='normative' displayorder="1">
932
947
  <title depth='1'>1.<tab/>Clause 4</title>
933
948
  <clause id='N' inline-header='false' obligation='normative'>
934
949
  <title depth='2'>1.1.<tab/>Introduction</title>
@@ -983,7 +998,7 @@ RSpec.describe IsoDoc do
983
998
  <?xml version='1.0'?>
984
999
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
985
1000
  <sections>
986
- <clause id='M' inline-header='false' obligation='normative'>
1001
+ <clause id='M' inline-header='false' obligation='normative' displayorder="1">
987
1002
  <title depth="1">Clause 4</title>
988
1003
  <clause id='N' inline-header='false' obligation='normative'>
989
1004
  <title depth="2">Introduction</title>
@@ -998,48 +1013,50 @@ RSpec.describe IsoDoc do
998
1013
  end
999
1014
 
1000
1015
  it "processes sections without titles" do
1001
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1002
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1003
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
1004
- <preface>
1005
- <introduction id="M" inline-header="false" obligation="normative"><clause id="N" inline-header="false" obligation="normative">
1006
- <title>Intro</title>
1007
- </clause>
1008
- <clause id="O" inline-header="true" obligation="normative">
1009
- </clause></clause>
1010
- </preface>
1011
- <sections>
1012
- <clause id="M1" inline-header="false" obligation="normative"><clause id="N1" inline-header="false" obligation="normative">
1013
- </clause>
1014
- <clause id="O1" inline-header="true" obligation="normative">
1015
- </clause></clause>
1016
- </sections>
1016
+ input = <<~INPUT
1017
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
1018
+ <preface>
1019
+ <introduction id="M" inline-header="false" obligation="normative"><clause id="N" inline-header="false" obligation="normative">
1020
+ <title>Intro</title>
1021
+ </clause>
1022
+ <clause id="O" inline-header="true" obligation="normative">
1023
+ </clause></clause>
1024
+ </preface>
1025
+ <sections>
1026
+ <clause id="M1" inline-header="false" obligation="normative"><clause id="N1" inline-header="false" obligation="normative">
1027
+ </clause>
1028
+ <clause id="O1" inline-header="true" obligation="normative">
1029
+ </clause></clause>
1030
+ </sections>
1017
1031
 
1018
- </iso-standard>
1019
- INPUT
1020
- <?xml version='1.0'?>
1021
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1022
- <preface>
1023
- <introduction id='M' inline-header='false' obligation='normative'>
1024
- <clause id='N' inline-header='false' obligation='normative'>
1025
- <title depth="2">Intro</title>
1026
- </clause>
1027
- <clause id='O' inline-header='true' obligation='normative'> </clause>
1028
- </introduction>
1029
- </preface>
1030
- <sections>
1031
- <clause id='M1' inline-header='false' obligation='normative'>
1032
- <title>1.</title>
1033
- <clause id='N1' inline-header='false' obligation='normative'>
1034
- <title>1.1.</title>
1035
- </clause>
1036
- <clause id='O1' inline-header='true' obligation='normative'>
1037
- <title>1.2.</title>
1038
- </clause>
1032
+ </iso-standard>
1033
+ INPUT
1034
+ output = <<~OUTPUT
1035
+ <?xml version='1.0'?>
1036
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1037
+ <preface>
1038
+ <introduction id='M' inline-header='false' obligation='normative' displayorder="1">
1039
+ <clause id='N' inline-header='false' obligation='normative'>
1040
+ <title depth="2">Intro</title>
1039
1041
  </clause>
1040
- </sections>
1041
- </iso-standard>
1042
- OUTPUT
1042
+ <clause id='O' inline-header='true' obligation='normative'> </clause>
1043
+ </introduction>
1044
+ </preface>
1045
+ <sections>
1046
+ <clause id='M1' inline-header='false' obligation='normative' displayorder="2">
1047
+ <title>1.</title>
1048
+ <clause id='N1' inline-header='false' obligation='normative'>
1049
+ <title>1.1.</title>
1050
+ </clause>
1051
+ <clause id='O1' inline-header='true' obligation='normative'>
1052
+ <title>1.2.</title>
1053
+ </clause>
1054
+ </clause>
1055
+ </sections>
1056
+ </iso-standard>
1057
+ OUTPUT
1058
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1059
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1043
1060
  end
1044
1061
 
1045
1062
  it "processes clauses containing normative references" do
@@ -1070,7 +1087,7 @@ RSpec.describe IsoDoc do
1070
1087
  presxml = <<~OUTPUT
1071
1088
  <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
1072
1089
  <bibliography>
1073
- <clause id="D" obligation="informative">
1090
+ <clause id="D" obligation="informative" displayorder="2">
1074
1091
  <title depth="1">Bibliography</title>
1075
1092
  <references id="E" obligation="informative" normative="false">
1076
1093
  <title depth="2">Bibliography Subsection 1</title>
@@ -1079,7 +1096,7 @@ RSpec.describe IsoDoc do
1079
1096
  <title depth="2">Bibliography Subsection 2</title>
1080
1097
  </references>
1081
1098
  </clause>
1082
- <clause id="A" obligation="informative"><title depth="1">1.<tab/>First References</title>
1099
+ <clause id="A" obligation="informative" displayorder="1"><title depth="1">1.<tab/>First References</title>
1083
1100
  <references id="B" obligation="informative" normative="true">
1084
1101
  <title depth="2">1.1.<tab/>Normative References 1</title>
1085
1102
  </references>