isodoc 1.2.1 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +1 -0
  3. data/lib/isodoc-yaml/i18n-fr.yaml +1 -1
  4. data/lib/isodoc/base_style/all.css +1 -1
  5. data/lib/isodoc/base_style/metanorma_word.css +6 -0
  6. data/lib/isodoc/base_style/metanorma_word.scss +6 -0
  7. data/lib/isodoc/base_style/reset.css +1 -1
  8. data/lib/isodoc/base_style/reset.scss +1 -1
  9. data/lib/isodoc/convert.rb +1 -1
  10. data/lib/isodoc/function/blocks.rb +1 -0
  11. data/lib/isodoc/function/cleanup.rb +1 -1
  12. data/lib/isodoc/function/references.rb +4 -2
  13. data/lib/isodoc/function/section.rb +13 -1
  14. data/lib/isodoc/function/table.rb +1 -0
  15. data/lib/isodoc/function/to_word_html.rb +3 -0
  16. data/lib/isodoc/function/utils.rb +1 -1
  17. data/lib/isodoc/html_function/html.rb +1 -0
  18. data/lib/isodoc/i18n.rb +8 -50
  19. data/lib/isodoc/metadata.rb +49 -35
  20. data/lib/isodoc/metadata_date.rb +5 -0
  21. data/lib/isodoc/presentation_function/bibdata.rb +24 -0
  22. data/lib/isodoc/presentation_function/block.rb +14 -0
  23. data/lib/isodoc/presentation_function/inline.rb +27 -14
  24. data/lib/isodoc/presentation_xml_convert.rb +4 -0
  25. data/lib/isodoc/version.rb +1 -1
  26. data/lib/isodoc/word_function/body.rb +1 -0
  27. data/lib/isodoc/word_function/postprocess.rb +1 -1
  28. data/lib/isodoc/word_function/table.rb +3 -2
  29. data/lib/isodoc/xref.rb +1 -0
  30. data/lib/isodoc/xref/xref_anchor.rb +8 -3
  31. data/lib/isodoc/xref/xref_counter.rb +21 -7
  32. data/lib/isodoc/xref/xref_gen.rb +29 -6
  33. data/lib/isodoc/xref/xref_sect_gen.rb +1 -1
  34. data/lib/isodoc/xslfo_convert.rb +6 -1
  35. data/spec/assets/i18n.yaml +9 -0
  36. data/spec/isodoc/blocks_spec.rb +281 -13
  37. data/spec/isodoc/cleanup_spec.rb +3 -1
  38. data/spec/isodoc/i18n_spec.rb +43 -5
  39. data/spec/isodoc/inline_spec.rb +47 -5
  40. data/spec/isodoc/metadata_spec.rb +24 -15
  41. data/spec/isodoc/postproc_spec.rb +39 -3
  42. data/spec/isodoc/ref_spec.rb +4 -1
  43. data/spec/isodoc/section_spec.rb +134 -10
  44. data/spec/isodoc/table_spec.rb +306 -207
  45. data/spec/isodoc/terms_spec.rb +1 -1
  46. data/spec/isodoc/xref_spec.rb +46 -18
  47. data/spec/spec_helper.rb +4 -0
  48. metadata +17 -2
@@ -1084,6 +1084,7 @@ INPUT
1084
1084
  [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
1085
1085
  [/TERMREF]</p>
1086
1086
  <p>[TERMREF] Termbase IEV, term ID xyz [/TERMREF]</p>
1087
+ <p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION] [/TERMREF]</p>
1087
1088
  <p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION]with adjustments [/TERMREF]</p>
1088
1089
  <p class="TermNum" id="paddy">1.2.</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
1089
1090
  <p class="AltTerms" style="text-align:left;">rough rice</p>
@@ -1140,7 +1141,8 @@ INPUT
1140
1141
  <a href='#ISO7301'>ISO 7301:2011, Clause 3.1</a>
1141
1142
  , modified &mdash; The term "cargo rice" is shown as deprecated, and
1142
1143
  Note 1 to entry is not included here; Termbase IEV, term ID xyz;
1143
- Termbase IEV, term ID xyz, modified &mdash; with adjustments]
1144
+ Termbase IEV, term ID xyz, modified; Termbase IEV, term ID xyz,
1145
+ modified &mdash; with adjustments]
1144
1146
  </p>
1145
1147
  <p class='TermNum' id='paddy'>1.2.</p>
1146
1148
  <p class='Terms' style='text-align:left;'>paddy</p>
@@ -68,10 +68,13 @@ RSpec.describe IsoDoc do
68
68
  INPUT
69
69
 
70
70
  presxml = <<~"PRESXML"
71
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
71
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
72
72
  <bibdata>
73
73
  <language>en</language>
74
74
  </bibdata>
75
+ <local_bibdata>
76
+ <language>en</language>
77
+ </local_bibdata>
75
78
  <preface>
76
79
  <foreword obligation='informative'>
77
80
  <title>Foreword</title>
@@ -296,10 +299,13 @@ PRESXML
296
299
  </iso-standard>
297
300
  INPUT
298
301
  <?xml version='1.0'?>
299
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
302
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
300
303
  <bibdata>
301
304
  <language>tlh</language>
302
305
  </bibdata>
306
+ <local_bibdata>
307
+ <language>tlh</language>
308
+ </local_bibdata>
303
309
  <preface>
304
310
  <foreword obligation='informative'>
305
311
  <title>Foreword</title>
@@ -449,10 +455,13 @@ PRESXML
449
455
  INPUT
450
456
 
451
457
  presxml = <<~"PRESXML"
452
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
458
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
453
459
  <bibdata>
454
460
  <language>fr</language>
455
461
  </bibdata>
462
+ <local_bibdata>
463
+ <language>fr</language>
464
+ </local_bibdata>
456
465
  <preface>
457
466
  <foreword obligation='informative'>
458
467
  <title>Foreword</title>
@@ -689,11 +698,15 @@ PRESXML
689
698
  INPUT
690
699
 
691
700
  presxml = <<~"PRESXML"
692
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
701
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
693
702
  <bibdata>
694
703
  <language>zh</language>
695
704
  <script>Hans</script>
696
705
  </bibdata>
706
+ <local_bibdata>
707
+ <language>zh</language>
708
+ <script>Hans</script>
709
+ </local_bibdata>
697
710
  <preface>
698
711
  <foreword obligation='informative'>
699
712
  <title>Foreword</title>
@@ -872,6 +885,13 @@ PRESXML
872
885
  <bibdata>
873
886
  <language>eo</language>
874
887
  <script>Latn</script>
888
+ <status>
889
+ <stage>published</stage>
890
+ <substage>withdrawn</substage>
891
+ </status>
892
+ <ext>
893
+ <doctype>brochure</doctype>
894
+ </ext>
875
895
  </bibdata>
876
896
  <preface>
877
897
  <foreword obligation="informative">
@@ -944,11 +964,29 @@ PRESXML
944
964
  INPUT
945
965
 
946
966
  presxml = <<~OUTPUT
947
- <iso-standard xmlns="http://riboseinc.com/isoxml">
967
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
948
968
  <bibdata>
949
969
  <language>eo</language>
950
970
  <script>Latn</script>
971
+ <status>
972
+ <stage>published</stage>
973
+ <substage>withdrawn</substage>
974
+ </status>
975
+ <ext>
976
+ <doctype>brochure</doctype>
977
+ </ext>
951
978
  </bibdata>
979
+ <local_bibdata>
980
+ <language>eo</language>
981
+ <script>Latn</script>
982
+ <status>
983
+ <stage>publikigita</stage>
984
+ <substage>fortirita</substage>
985
+ </status>
986
+ <ext>
987
+ <doctype>bro&#x15D;uro</doctype>
988
+ </ext>
989
+ </local_bibdata>
952
990
  <preface>
953
991
  <foreword obligation="informative">
954
992
  <title>Foreword</title>
@@ -20,7 +20,7 @@ RSpec.describe IsoDoc do
20
20
  </iso-standard>
21
21
  INPUT
22
22
  <?xml version='1.0'?>
23
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
23
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
24
24
  <sections>
25
25
  <clause id='A'>
26
26
  <title>1.</title>
@@ -57,6 +57,48 @@ INPUT
57
57
  OUTPUT
58
58
  end
59
59
 
60
+ it "droplocs xrefs" do
61
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
62
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
63
+ <sections>
64
+ <clause id="A">
65
+ <formula id="B">
66
+ </formula>
67
+ </clause>
68
+ <clause id="C">
69
+ <p>This is <xref target="A"/> and <xref target="B"/>.
70
+ This is <xref target="A" droploc="true"/> and <xref target="B" droploc="true"/>.</p>
71
+ </clause>
72
+ </sections>
73
+ </iso-standard>
74
+ INPUT
75
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
76
+ <sections>
77
+ <clause id='A'>
78
+ <title>1.</title>
79
+ <formula id='B'>
80
+ <name>1</name>
81
+ </formula>
82
+ </clause>
83
+ <clause id='C'>
84
+ <title>2.</title>
85
+ <p>
86
+ This is
87
+ <xref target='A'>kla&#x16D;zo 1</xref>
88
+ and
89
+ <xref target='B'>kla&#x16D;zo 1, Formula (1)</xref>
90
+ . This is
91
+ <xref target='A' droploc='true'>1</xref>
92
+ and
93
+ <xref target='B' droploc='true'>(1)</xref>
94
+ .
95
+ </p>
96
+ </clause>
97
+ </sections>
98
+ </iso-standard>
99
+ OUTPUT
100
+ end
101
+
60
102
  it "processes inline formatting" do
61
103
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
62
104
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -238,7 +280,7 @@ end
238
280
  </iso-standard>
239
281
  INPUT
240
282
  presxml = <<~OUTPUT
241
- <iso-standard xmlns="http://riboseinc.com/isoxml">
283
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
242
284
  <preface><foreword>
243
285
  <p>
244
286
  <ul>
@@ -606,7 +648,7 @@ OUTPUT
606
648
  </iso-standard>
607
649
  INPUT
608
650
  presxml = <<~OUTPUT
609
- <iso-standard xmlns="http://riboseinc.com/isoxml">
651
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
610
652
  <preface><foreword>
611
653
  <p>
612
654
  <eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
@@ -728,7 +770,7 @@ html = <<~OUTPUT
728
770
  </iso-standard>
729
771
  INPUT
730
772
  presxml = <<~OUTPUT
731
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
773
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
732
774
  <preface>
733
775
  <foreword>
734
776
  <p>
@@ -955,7 +997,7 @@ it "cases xrefs" do
955
997
  </iso-standard>
956
998
  INPUT
957
999
  <?xml version='1.0'?>
958
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1000
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
959
1001
  <sections>
960
1002
  <clause id='A'>
961
1003
  <title>1.</title>
@@ -7,7 +7,7 @@ RSpec.describe IsoDoc do
7
7
  arr = c.convert_init(<<~"INPUT", "test", false)
8
8
  <iso-standard xmlns="http://riboseinc.com/isoxml">
9
9
  INPUT
10
- expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT"
10
+ expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
11
11
  <iso-standard xmlns="http://riboseinc.com/isoxml">
12
12
  <bibdata type="standard">
13
13
  <title>The Incredible Mr Ripley</title>
@@ -73,6 +73,9 @@ RSpec.describe IsoDoc do
73
73
  </name>
74
74
  </person>
75
75
  </contributor>
76
+ <note type="title-footnote"><p>A footnote</p></note>
77
+ <note type="iso"><p>A note</p></note>
78
+ <note type="title-footnote"><p>Another footnote</p></note>
76
79
  <language>en</language>
77
80
  <script>Latn</script>
78
81
  <status>
@@ -95,6 +98,8 @@ RSpec.describe IsoDoc do
95
98
  <doctype>international-standard</doctype>
96
99
  </ext>
97
100
  </bibdata>
101
+ <local_bibdata type="standard">
102
+ </local_bibdata>
98
103
  </iso-standard>
99
104
  INPUT
100
105
  {:accesseddate=>"2012",
@@ -123,13 +128,13 @@ INPUT
123
128
  :obsoleteddate=>"2014",
124
129
  :pdf=>"URL D",
125
130
  :publisheddate=>"2011",
126
- :publisher=>"",
127
131
  :receiveddate=>"XXX",
128
132
  :revdate=>"2016-05-01",
129
133
  :revdate_monthyear=>"May 2016",
130
- :stage=>"Committee draft",
134
+ :stage=>"Committee Draft",
131
135
  :stageabbr=>"CD",
132
136
  :substage=>"Withdrawn",
137
+ :title_footnote=>["A footnote", "Another footnote"],
133
138
  :transmitteddate=>"2020",
134
139
  :unchangeddate=>"2019",
135
140
  :unpublished=>true,
@@ -146,7 +151,7 @@ OUTPUT
146
151
  arr = c.convert_init(<<~"INPUT", "test", false)
147
152
  <iso-standard xmlns="http://riboseinc.com/isoxml">
148
153
  INPUT
149
- expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT"
154
+ expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
150
155
  <iso-standard xmlns="http://riboseinc.com/isoxml">
151
156
  <bibdata type="standard">
152
157
  <title language="fr" format="text/plain">Céréales et légumineuses</ti>
@@ -167,7 +172,15 @@ OUTPUT
167
172
  <role type="publisher"/>
168
173
  <organization>
169
174
  <name>International Organization for Standardization</name>
175
+ <subdivision>Subdivision</subdivision>
170
176
  <abbreviation>ISO</abbreviation>
177
+ <address>
178
+ <formattedAddress>1 Infinity Loop + California</formattedAddress>
179
+ </address>
180
+ <phone>3333333</phone>
181
+ <phone type='fax'>4444444</phone>
182
+ <email>x@example.com</email>
183
+ <uri>http://www.example.com</uri>
171
184
  </organization>
172
185
  </contributor>
173
186
  <contributor>
@@ -213,8 +226,6 @@ OUTPUT
213
226
  INPUT
214
227
  {:accesseddate=>"XXX",
215
228
  :agency=>"ISO/IEC/IEEE",
216
- :authors=>[],
217
- :authors_affiliations=>{},
218
229
  :circulateddate=>"XXX",
219
230
  :confirmeddate=>"XXX",
220
231
  :copieddate=>"XXX",
@@ -226,20 +237,24 @@ INPUT
226
237
  :docyear=>"2016",
227
238
  :draft=>"12",
228
239
  :draftinfo=>" (draft 12, 2016-05)",
229
- :edition=>nil,
230
240
  :implementeddate=>"XXX",
231
241
  :issueddate=>"XXX",
232
- :keywords=>[],
233
242
  :obsoleteddate=>"XXX",
234
243
  :obsoletes=>"IEC 8121",
235
244
  :obsoletes_part=>"3.1",
236
245
  :partof=>"IEC 8122",
246
+ :pub_address=>"1 Infinity Loop + California",
247
+ :pub_email=>"x@example.com",
248
+ :pub_fax=>"4444444",
249
+ :pub_phone=>"3333333",
250
+ :pub_uri=>"http://www.example.com",
237
251
  :publisheddate=>"2011-01",
238
252
  :publisher=>"International Organization for Standardization, International Electrotechnical Commission and Institute of Electrical and Electronics Engineers",
239
253
  :receiveddate=>"XXX",
240
254
  :revdate=>"2016-05",
241
255
  :revdate_monthyear=>"May 2016",
242
256
  :stage=>"Published",
257
+ :subdivision=>"Subdivision",
243
258
  :transmitteddate=>"XXX",
244
259
  :unchangeddate=>"XXX",
245
260
  :unpublished=>false,
@@ -259,7 +274,7 @@ OUTPUT
259
274
  </bibdata>
260
275
  </iso-standard>
261
276
  INPUT
262
- expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT"
277
+ expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
263
278
  <iso-standard xmlns="http://riboseinc.com/isoxml">
264
279
  <bibdata type="standard">
265
280
  <title language="fr" format="text/plain">Céréales et légumineuses</ti>
@@ -306,8 +321,6 @@ OUTPUT
306
321
  INPUT
307
322
  {:accesseddate=>"XXX",
308
323
  :agency=>"ISO/IEC",
309
- :authors=>[],
310
- :authors_affiliations=>{},
311
324
  :circulateddate=>"XXX",
312
325
  :confirmeddate=>"XXX",
313
326
  :copieddate=>"XXX",
@@ -316,12 +329,8 @@ INPUT
316
329
  :docnumeric=>"17301",
317
330
  :doctitle=>"Cereals and pulses",
318
331
  :docyear=>"2016",
319
- :draft=>nil,
320
- :draftinfo=>"",
321
- :edition=>nil,
322
332
  :implementeddate=>"XXX",
323
333
  :issueddate=>"XXX",
324
- :keywords=>[],
325
334
  :obsoleteddate=>"XXX",
326
335
  :publisheddate=>"2011-01",
327
336
  :publisher=>"International Organization for Standardization et International Electrotechnical Commission",
@@ -846,6 +846,14 @@ TOCLEVEL
846
846
  <formula id="_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62">
847
847
  <stem type="AsciiMath">D1</stem>
848
848
  </formula>
849
+ <dl id="_f8fb7ed7-7874-44a8-933f-06e0e86fb264">
850
+ <dt>
851
+ <em>n</em>
852
+ </dt>
853
+ <dd>
854
+ <p id="_a27281a4-b20e-4d0b-a780-bab9e851b03e">is the number of coating layers</p>
855
+ </dd>
856
+ </dl>
849
857
  </ul></li>
850
858
  </ol>
851
859
  </foreword></preface>
@@ -901,6 +909,23 @@ TOCLEVEL
901
909
  </div>
902
910
  </div>
903
911
  </div>
912
+ <div class='ListContLevel2'>
913
+ <table class='dl'>
914
+ <tr>
915
+ <td valign='top' align='left'>
916
+ <p align='left' style='margin-left:0pt;text-align:left;' class='MsoNormal'>
917
+ <i>n</i>
918
+ </p>
919
+ </td>
920
+ <td valign='top'>
921
+ <p class='MsoNormal'>
922
+ <a name='_a27281a4-b20e-4d0b-a780-bab9e851b03e' id='_a27281a4-b20e-4d0b-a780-bab9e851b03e'/>
923
+ is the number of coating layers
924
+ </p>
925
+ </td>
926
+ </tr>
927
+ </table>
928
+ </div>
904
929
  </p>
905
930
  </div>
906
931
  <p class='MsoNormal'>&#xA0;</p>
@@ -1062,9 +1087,20 @@ word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="
1062
1087
  <thead>
1063
1088
  <tr>
1064
1089
  <td rowspan="2" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:solid windowtext 1.0pt;">
1065
- <p class="MsoNormal"><a name="_c47d9b39-adb2-431d-9320-78cb148fdb56" id="_c47d9b39-adb2-431d-9320-78cb148fdb56"></a>Output wavelength <span class="stem"><m:oMath>
1066
- <m:r><m:t>(&#x3BC;m)</m:t></m:r>
1067
- </m:oMath>
1090
+ <p class="MsoNormal"><a name="_c47d9b39-adb2-431d-9320-78cb148fdb56" id="_c47d9b39-adb2-431d-9320-78cb148fdb56"></a>Output wavelength <span class="stem">
1091
+ <m:oMath>
1092
+ <span style='font-style:normal;'>
1093
+ <m:r>
1094
+ <m:rPr>
1095
+ <m:sty m:val='p'/>
1096
+ </m:rPr>
1097
+ <m:t>(</m:t>
1098
+ </m:r>
1099
+ </span>
1100
+ <m:r>
1101
+ <m:t>&#x3BC;m)</m:t>
1102
+ </m:r>
1103
+ </m:oMath>
1068
1104
  </span></p>
1069
1105
  </td>
1070
1106
  <th colspan="3" align="left" style="font-weight:bold;border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Predictive wavelengths</th>
@@ -125,10 +125,13 @@ RSpec.describe IsoDoc do
125
125
  </iso-standard>
126
126
  INPUT
127
127
  presxml = <<~PRESXML
128
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
128
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
129
129
  <bibdata>
130
130
  <language>en</language>
131
131
  </bibdata>
132
+ <local_bibdata>
133
+ <language>en</language>
134
+ </local_bibdata>
132
135
  <preface>
133
136
  <foreword>
134
137
  <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
@@ -1,6 +1,131 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
+ it "processes prefatory blocks" do
5
+ input = <<~INPUT
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <preface>
8
+ <abstract id="A"><title>abstract</title></abstract>
9
+ <introduction id="B"><title>introduction</title></introduction>
10
+ <note id="C">note</note>
11
+ </preface>
12
+ <sections>
13
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
14
+ <title>Introduction</title>
15
+ </clause>
16
+ <clause id="O" inline-header="true" obligation="normative">
17
+ <title>Clause 4.2</title>
18
+ </clause></clause>
19
+ <admonition id="L" type="caution"><p>admonition</p></admonition>
20
+ </sections>
21
+ </iso-standard>
22
+ INPUT
23
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
24
+ <html lang='en'>
25
+ <head/>
26
+ <body lang='en'>
27
+ <div class='title-section'>
28
+ <p>&#160;</p>
29
+ </div>
30
+ <br/>
31
+ <div class='prefatory-section'>
32
+ <p>&#160;</p>
33
+ </div>
34
+ <br/>
35
+ <div class='main-section'>
36
+ <div id='C' class='Note'>note</div>
37
+ <br/>
38
+ <div id='A'>
39
+ <h1 class='AbstractTitle'>abstract</h1>
40
+ </div>
41
+ <br/>
42
+ <div class='Section3' id='B'>
43
+ <h1 class='IntroTitle'>introduction</h1>
44
+ </div>
45
+ <p class='zzSTDTitle1'/>
46
+ <div id='L' class='Admonition'>
47
+ <p class='AdmonitionTitle' style='text-align:center;'>CAUTION</p>
48
+ <p>admonition</p>
49
+ </div>
50
+ <div id='M'>
51
+ <h1>Clause 4</h1>
52
+ <div id='N'>
53
+ <h2>Introduction</h2>
54
+ </div>
55
+ <div id='O'>
56
+ <span class='zzMoveToFollowing'>
57
+ <b>Clause 4.2&#160; </b>
58
+ </span>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </body>
63
+ </html>
64
+ OUTPUT
65
+ expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
66
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
67
+ <head>
68
+ <style>
69
+ </style>
70
+ </head>
71
+ <body lang='EN-US' link='blue' vlink='#954F72'>
72
+ <div class='WordSection1'>
73
+ <p>&#160;</p>
74
+ </div>
75
+ <p>
76
+ <br clear='all' class='section'/>
77
+ </p>
78
+ <div class='WordSection2'>
79
+ <div id='C' class='Note'>
80
+ <p class='Note'>
81
+ <span class='note_label'/>
82
+ <span style='mso-tab-count:1'>&#160; </span>
83
+ </p>
84
+ note
85
+ </div>
86
+ <p>
87
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
88
+ </p>
89
+ <div id='A'>
90
+ <h1 class='AbstractTitle'>abstract</h1>
91
+ </div>
92
+ <p>
93
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
94
+ </p>
95
+ <div class='Section3' id='B'>
96
+ <h1 class='IntroTitle'>introduction</h1>
97
+ </div>
98
+ <p>&#160;</p>
99
+ </div>
100
+ <p>
101
+ <br clear='all' class='section'/>
102
+ </p>
103
+ <div class='WordSection3'>
104
+ <p class='zzSTDTitle1'/>
105
+ <div id='L' class='Admonition'>
106
+ <p class='AdmonitionTitle' style='text-align:center;'>CAUTION</p>
107
+ <p>admonition</p>
108
+ </div>
109
+ <div id='M'>
110
+ <h1>Clause 4</h1>
111
+ <div id='N'>
112
+ <h2>Introduction</h2>
113
+ </div>
114
+ <div id='O'>
115
+ <span class='zzMoveToFollowing'>
116
+ <b>
117
+ Clause 4.2
118
+ <span style='mso-tab-count:1'>&#160; </span>
119
+ </b>
120
+ </span>
121
+ </div>
122
+ </div>
123
+ </div>
124
+ </body>
125
+ </html>
126
+ OUTPUT
127
+ end
128
+
4
129
  it "processes document with no content" do
5
130
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
131
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -135,7 +260,7 @@ RSpec.describe IsoDoc do
135
260
  INPUT
136
261
 
137
262
  presxml = <<~"PRESXML"
138
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
263
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
139
264
  <boilerplate>
140
265
  <copyright-statement>
141
266
  <clause>
@@ -630,7 +755,7 @@ OUTPUT
630
755
  </iso-standard>
631
756
  INPUT
632
757
  <?xml version='1.0'?>
633
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
758
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
634
759
  <preface>
635
760
  <foreword obligation='informative'>
636
761
  <title>Foreword</title>
@@ -724,7 +849,7 @@ OUTPUT
724
849
  </iso-standard>
725
850
  INPUT
726
851
  <?xml version='1.0'?>
727
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
852
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
728
853
  <preface>
729
854
  <introduction id='B' obligation='informative'>
730
855
  <title>Introduction</title>
@@ -751,7 +876,7 @@ OUTPUT
751
876
  INPUT
752
877
 
753
878
  presxml = <<~"OUTPUT"
754
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
879
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
755
880
  <sections>
756
881
  <terms id='H' obligation='normative'>
757
882
  <title depth='1'>1.<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
@@ -796,7 +921,7 @@ OUTPUT
796
921
  INPUT
797
922
 
798
923
  presxml = <<~"PRESXML"
799
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
924
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
800
925
  <sections>
801
926
  <clause id='M' inline-header='false' obligation='normative'>
802
927
  <title depth='1'>1.<tab/>Clause 4</title>
@@ -848,7 +973,7 @@ OUTPUT
848
973
  </iso-standard>
849
974
  INPUT
850
975
  <?xml version='1.0'?>
851
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
976
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
852
977
  <sections>
853
978
  <clause id='M' inline-header='false' obligation='normative'>
854
979
  <title depth="1">Clause 4</title>
@@ -866,7 +991,7 @@ OUTPUT
866
991
 
867
992
  it "processes sections without titles" do
868
993
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
869
- <iso-standard xmlns="http://riboseinc.com/isoxml">
994
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
870
995
  <preface>
871
996
  <introduction id="M" inline-header="false" obligation="normative"><clause id="N" inline-header="false" obligation="normative">
872
997
  <title>Intro</title>
@@ -884,7 +1009,7 @@ OUTPUT
884
1009
  </iso-standard>
885
1010
  INPUT
886
1011
  <?xml version='1.0'?>
887
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1012
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
888
1013
  <preface>
889
1014
  <introduction id='M' inline-header='false' obligation='normative'>
890
1015
  <clause id='N' inline-header='false' obligation='normative'>
@@ -934,7 +1059,7 @@ OUTPUT
934
1059
  </iso-standard>
935
1060
  INPUT
936
1061
  presxml = <<~OUTPUT
937
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1062
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
938
1063
  <bibliography>
939
1064
  <clause id="D" obligation="informative">
940
1065
  <title depth="1">Bibliography</title>
@@ -989,5 +1114,4 @@ OUTPUT
989
1114
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
990
1115
  end
991
1116
 
992
-
993
1117
  end