metanorma-iso 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/html2doc/lists.rb +142 -10
  3. data/lib/isodoc/iso/base_convert.rb +10 -0
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -0
  5. data/lib/isodoc/iso/html/isodoc-dis.css +170 -252
  6. data/lib/isodoc/iso/html/isodoc-dis.scss +170 -245
  7. data/lib/isodoc/iso/html/isodoc.css +38 -13
  8. data/lib/isodoc/iso/html/isodoc.scss +38 -12
  9. data/lib/isodoc/iso/html/style-human.css +14 -1
  10. data/lib/isodoc/iso/html/style-human.scss +10 -1
  11. data/lib/isodoc/iso/html/style-iso.css +35 -23
  12. data/lib/isodoc/iso/html/style-iso.scss +31 -23
  13. data/lib/isodoc/iso/html/word_iso_intro-dis.html +1 -6
  14. data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +24 -13
  15. data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +58 -0
  16. data/lib/isodoc/iso/html/word_iso_titlepage.html +6 -2
  17. data/lib/isodoc/iso/html_convert.rb +5 -0
  18. data/lib/isodoc/iso/i18n-en.yaml +32 -4
  19. data/lib/isodoc/iso/i18n-fr.yaml +29 -3
  20. data/lib/isodoc/iso/i18n-ru.yaml +32 -4
  21. data/lib/isodoc/iso/i18n-zh-Hans.yaml +32 -3
  22. data/lib/isodoc/iso/i18n.rb +1 -1
  23. data/lib/isodoc/iso/iso.amendment.xsl +332 -187
  24. data/lib/isodoc/iso/iso.international-standard.xsl +332 -187
  25. data/lib/isodoc/iso/metadata.rb +63 -63
  26. data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
  27. data/lib/isodoc/iso/presentation_xml_convert.rb +14 -3
  28. data/lib/isodoc/iso/presentation_xref.rb +8 -2
  29. data/lib/isodoc/iso/sections.rb +1 -1
  30. data/lib/isodoc/iso/word_cleanup.rb +3 -0
  31. data/lib/isodoc/iso/word_convert.rb +6 -3
  32. data/lib/isodoc/iso/word_dis_cleanup.rb +235 -0
  33. data/lib/isodoc/iso/word_dis_convert.rb +47 -108
  34. data/lib/isodoc/iso/xref.rb +34 -6
  35. data/lib/metanorma/iso/base.rb +20 -1
  36. data/lib/metanorma/iso/biblio.rng +32 -34
  37. data/lib/metanorma/iso/boilerplate-fr.xml +3 -0
  38. data/lib/metanorma/iso/boilerplate-ru.xml +3 -0
  39. data/lib/metanorma/iso/boilerplate.xml +3 -0
  40. data/lib/metanorma/iso/cleanup.rb +28 -1
  41. data/lib/metanorma/iso/front.rb +31 -6
  42. data/lib/metanorma/iso/front_id.rb +2 -0
  43. data/lib/metanorma/iso/isodoc.rng +9 -0
  44. data/lib/metanorma/iso/isostandard.rng +30 -12
  45. data/lib/metanorma/iso/macros.rb +29 -0
  46. data/lib/metanorma/iso/version.rb +1 -1
  47. data/spec/isodoc/amd_spec.rb +4 -30
  48. data/spec/isodoc/blocks_spec.rb +499 -2
  49. data/spec/isodoc/i18n_spec.rb +145 -80
  50. data/spec/isodoc/iso_spec.rb +50 -169
  51. data/spec/isodoc/metadata_spec.rb +224 -83
  52. data/spec/isodoc/postproc_spec.rb +41 -5
  53. data/spec/isodoc/section_spec.rb +12 -6
  54. data/spec/isodoc/word_dis_spec.rb +1273 -147
  55. data/spec/isodoc/xref_spec.rb +87 -13
  56. data/spec/metanorma/amd_spec.rb +53 -1
  57. data/spec/metanorma/base_spec.rb +185 -10
  58. data/spec/metanorma/blocks_spec.rb +54 -0
  59. data/spec/metanorma/lists_spec.rb +2 -2
  60. data/spec/metanorma/section_spec.rb +2 -2
  61. data/spec/spec_helper.rb +13 -4
  62. data/spec/vcr_cassettes/withdrawn_iso.yml +27 -27
  63. metadata +7 -8
  64. data/docs/asciiiso-syntax.adoc +0 -307
  65. data/docs/guidance.adoc +0 -487
  66. data/docs/navigation.adoc +0 -23
  67. data/docs/quickstart.adoc +0 -179
  68. data/lib/isodoc/iso/presentation_inline.rb +0 -90
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "2.1.1".freeze
3
+ VERSION = "2.1.2".freeze
4
4
  end
5
5
  end
@@ -745,11 +745,7 @@ RSpec.describe IsoDoc do
745
745
  </iso-standard>
746
746
  INPUT
747
747
  output = <<~OUTPUT
748
- {:accesseddate=>"XXX",
749
- :agency=>"ISO",
750
- :circulateddate=>"XXX",
751
- :confirmeddate=>"XXX",
752
- :copieddate=>"XXX",
748
+ {:agency=>"ISO",
753
749
  :createddate=>"2016-05-01",
754
750
  :docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1",
755
751
  :docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)",
@@ -779,13 +775,8 @@ RSpec.describe IsoDoc do
779
775
  :edition=>"2",
780
776
  :editorialgroup=>["A 1", "B 2", "C 3"],
781
777
  :ics=>"1, 2, 3",
782
- :implementeddate=>"XXX",
783
- :issueddate=>"XXX",
784
778
  :lang=>"en",
785
- :obsoleteddate=>"XXX",
786
- :publisheddate=>"XXX",
787
779
  :publisher=>"International Organization for Standardization",
788
- :receiveddate=>"XXX",
789
780
  :revdate=>"2000-01-01",
790
781
  :revdate_monthyear=>"January 2000",
791
782
  :sc=>"B 2",
@@ -795,13 +786,9 @@ RSpec.describe IsoDoc do
795
786
  :stage_int=>10,
796
787
  :stageabbr=>"NWIP",
797
788
  :statusabbr=>"PreNWIP3",
789
+ :substage_int=>"20",
798
790
  :tc=>"A 1",
799
- :transmitteddate=>"XXX",
800
- :unchangeddate=>"XXX",
801
791
  :unpublished=>true,
802
- :updateddate=>"XXX",
803
- :vote_endeddate=>"XXX",
804
- :vote_starteddate=>"XXX",
805
792
  :wg=>"C 3"}
806
793
  OUTPUT
807
794
  expect(metadata(c.info(Nokogiri::XML(input), nil)))
@@ -910,11 +897,7 @@ RSpec.describe IsoDoc do
910
897
  </iso-standard>
911
898
  INPUT
912
899
  output = <<~OUTPUT
913
- {:accesseddate=>"XXX",
914
- :agency=>"ISO",
915
- :circulateddate=>"XXX",
916
- :confirmeddate=>"XXX",
917
- :copieddate=>"XXX",
900
+ {:agency=>"ISO",
918
901
  :createddate=>"2016-05-01",
919
902
  :docnumber=>"ISO/PreNWIP3 17301-1:2016/Amd.1",
920
903
  :docnumber_lang=>"ISO/PreNWIP3 17301-1:2016/Amd.1(E)",
@@ -944,13 +927,8 @@ RSpec.describe IsoDoc do
944
927
  :edition=>"2",
945
928
  :editorialgroup=>["A 1", "B 2", "C 3"],
946
929
  :ics=>"1, 2, 3",
947
- :implementeddate=>"XXX",
948
- :issueddate=>"XXX",
949
930
  :lang=>"fr",
950
- :obsoleteddate=>"XXX",
951
- :publisheddate=>"XXX",
952
931
  :publisher=>"International Organization for Standardization",
953
- :receiveddate=>"XXX",
954
932
  :revdate=>"2000-01-01",
955
933
  :revdate_monthyear=>"Janvier 2000",
956
934
  :sc=>"B 2",
@@ -960,13 +938,9 @@ RSpec.describe IsoDoc do
960
938
  :stage_int=>10,
961
939
  :stageabbr=>"NWIP",
962
940
  :statusabbr=>"PreNWIP3",
941
+ :substage_int=>"20",
963
942
  :tc=>"A 1",
964
- :transmitteddate=>"XXX",
965
- :unchangeddate=>"XXX",
966
943
  :unpublished=>true,
967
- :updateddate=>"XXX",
968
- :vote_endeddate=>"XXX",
969
- :vote_starteddate=>"XXX",
970
944
  :wg=>"C 3"}
971
945
  OUTPUT
972
946
  expect(metadata(c.info(Nokogiri::XML(input), nil)))
@@ -1,6 +1,183 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
+ it "processes examples" do
5
+ input = <<~INPUT
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <preface>
8
+ <foreword>
9
+ <example id="samplecode">
10
+ <name>Title</name>
11
+ <p>Hello</p>
12
+ </example>
13
+ </foreword>
14
+ </preface>
15
+ </iso-standard>
16
+ INPUT
17
+ presxml = <<~OUTPUT
18
+ <?xml version='1.0'?>
19
+ <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
20
+ <preface>
21
+ <foreword displayorder="1">
22
+ <example id="samplecode">
23
+ <name>EXAMPLE — Title</name>
24
+ <p>Hello</p>
25
+ </example>
26
+ </foreword>
27
+ </preface>
28
+ </iso-standard>
29
+ OUTPUT
30
+
31
+ html = <<~OUTPUT
32
+ #{HTML_HDR}
33
+ <br/>
34
+ <div>
35
+ <h1 class="ForewordTitle">Foreword</h1>
36
+ <div id="samplecode" class="example">
37
+ <p><span class="example_label">EXAMPLE&#160;&#8212; Title</span>&#160; Hello</p>
38
+ </div>
39
+ </div>
40
+ <p class="zzSTDTitle1"/>
41
+ </div>
42
+ </body>
43
+ </html>
44
+ OUTPUT
45
+
46
+ word = <<~OUTPUT
47
+ <body lang="EN-US" link="blue" vlink="#954F72">
48
+ <div class="WordSection1">
49
+ <p>&#160;</p>
50
+ </div>
51
+ <p>
52
+ <br clear="all" class="section"/>
53
+ </p>
54
+ <div class="WordSection2">
55
+ <p>
56
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
57
+ </p>
58
+ <div>
59
+ <h1 class="ForewordTitle">Foreword</h1>
60
+ <div id="samplecode" class="example">
61
+ <p><span class="example_label">EXAMPLE&#160;&#8212; Title</span><span style="mso-tab-count:1">&#160; </span>Hello</p>
62
+ </div>
63
+ </div>
64
+ <p>&#160;</p>
65
+ </div>
66
+ <p>
67
+ <br clear="all" class="section"/>
68
+ </p>
69
+ <div class="WordSection3">
70
+ <p class="zzSTDTitle1"/>
71
+ </div>
72
+ <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
73
+ <div class="colophon"/>
74
+ </body>
75
+ OUTPUT
76
+ expect(IsoDoc::Iso::PresentationXMLConvert.new({})
77
+ .convert("test", input, true)).to be_equivalent_to xmlpp(presxml)
78
+ expect(IsoDoc::Iso::HtmlConvert.new({})
79
+ .convert("test", presxml, true)).to be_equivalent_to xmlpp(html)
80
+ output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
81
+ expect(xmlpp(output
82
+ .sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
83
+ .to be_equivalent_to xmlpp(word)
84
+ end
85
+
86
+ it "processes sequences of examples" do
87
+ input = <<~INPUT
88
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
89
+ <preface>
90
+ <foreword>
91
+ <example id="samplecode">
92
+ <quote>Hello</quote>
93
+ </example>
94
+ <example id="samplecode2">
95
+ <name>Title</name>
96
+ <p>Hello</p>
97
+ </example>
98
+ </foreword>
99
+ </preface>
100
+ </iso-standard>
101
+ INPUT
102
+ presxml = <<~OUTPUT
103
+ <?xml version='1.0'?>
104
+ <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
105
+ <preface>
106
+ <foreword displayorder="1">
107
+ <example id="samplecode">
108
+ <name>EXAMPLE 1</name>
109
+ <quote>Hello</quote>
110
+ </example>
111
+ <example id="samplecode2">
112
+ <name>EXAMPLE 2 — Title</name>
113
+ <p>Hello</p>
114
+ </example>
115
+ </foreword>
116
+ </preface>
117
+ </iso-standard>
118
+ OUTPUT
119
+ html = <<~OUTPUT
120
+ #{HTML_HDR}
121
+ <br/>
122
+ <div>
123
+ <h1 class="ForewordTitle">Foreword</h1>
124
+ <div id="samplecode" class="example">
125
+ <p><span class="example_label">EXAMPLE 1</span>&#160; </p>
126
+ <div class="Quote">Hello</div>
127
+ </div>
128
+ <div id="samplecode2" class="example">
129
+ <p><span class="example_label">EXAMPLE 2&#160;&#8212; Title</span>&#160; Hello</p>
130
+ </div>
131
+ </div>
132
+ <p class="zzSTDTitle1"/>
133
+ </div>
134
+ </body>
135
+ </html>
136
+ OUTPUT
137
+ word = <<~OUTPUT
138
+ <body lang="EN-US" link="blue" vlink="#954F72">
139
+ <div class="WordSection1">
140
+ <p>&#160;</p>
141
+ </div>
142
+ <p>
143
+ <br clear="all" class="section"/>
144
+ </p>
145
+ <div class="WordSection2">
146
+ <p>
147
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
148
+ </p>
149
+ <div>
150
+ <h1 class="ForewordTitle">Foreword</h1>
151
+ <div id="samplecode" class="example">
152
+ <p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">&#160; </span></p>
153
+ <div class="Quote">Hello</div>
154
+ </div>
155
+ <div id="samplecode2" class="example">
156
+ <p><span class="example_label">EXAMPLE 2&#160;&#8212; Title</span><span style="mso-tab-count:1">&#160; </span>Hello</p>
157
+ </div>
158
+ </div>
159
+ <p>&#160;</p>
160
+ </div>
161
+ <p>
162
+ <br clear="all" class="section"/>
163
+ </p>
164
+ <div class="WordSection3">
165
+ <p class="zzSTDTitle1"/>
166
+ </div>
167
+ <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
168
+ <div class="colophon"/>
169
+ </body>
170
+ OUTPUT
171
+ expect(IsoDoc::Iso::PresentationXMLConvert.new({})
172
+ .convert("test", input, true)).to be_equivalent_to xmlpp(presxml)
173
+ expect(IsoDoc::Iso::HtmlConvert.new({})
174
+ .convert("test", presxml, true)).to be_equivalent_to xmlpp(html)
175
+ output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
176
+ expect(xmlpp(output
177
+ .sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
178
+ .to be_equivalent_to xmlpp(word)
179
+ end
180
+
4
181
  it "processes admonitions" do
5
182
  input = <<~INPUT
6
183
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -105,6 +282,75 @@ RSpec.describe IsoDoc do
105
282
  .to be_equivalent_to xmlpp(output)
106
283
  end
107
284
 
285
+ it "processes editorial notes" do
286
+ input = <<~INPUT
287
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
288
+ <preface><foreword>
289
+ <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="editorial">
290
+ <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
291
+ <p id="_e94663cc-2473-4ccc-9a72-983a74d989f3">Para 2.</p>
292
+ </admonition>
293
+ </foreword></preface>
294
+ </iso-standard>
295
+ INPUT
296
+ presxml = <<~INPUT
297
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
298
+ <preface><foreword displayorder="1">
299
+ <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="editorial">
300
+ <p id='_e94663cc-2473-4ccc-9a72-983a74d989f2'>
301
+ Only use paddy or parboiled rice for the
302
+ determination of husked rice yield.
303
+ </p>
304
+ <p id="_e94663cc-2473-4ccc-9a72-983a74d989f3">Para 2.</p>
305
+ </admonition>
306
+ </foreword></preface>
307
+ </iso-standard>
308
+ INPUT
309
+ html = <<~OUTPUT
310
+ #{HTML_HDR}
311
+ <br/>
312
+ <div>
313
+ <h1 class='ForewordTitle'>Foreword</h1>
314
+ <div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' class='zzHelp'>
315
+ <p>
316
+ Only use paddy or parboiled rice for the
317
+ determination of husked rice yield.
318
+ </p>
319
+ <p id='_e94663cc-2473-4ccc-9a72-983a74d989f3'>Para 2.</p>
320
+ </div>
321
+ </div>
322
+ <p class='zzSTDTitle1'/>
323
+ </div>
324
+ </body>
325
+ </html>
326
+ OUTPUT
327
+ word = <<~OUTPUT
328
+ <div class='WordSection2'>
329
+ <p>
330
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
331
+ </p>
332
+ <div>
333
+ <h1 class='ForewordTitle'>Foreword</h1>
334
+ <div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' class='zzHelp'>
335
+ <p> Only use paddy or parboiled rice for the determination of husked rice yield. </p>
336
+ <p class='ForewordText' id='_e94663cc-2473-4ccc-9a72-983a74d989f3'>Para 2.</p>
337
+ </div>
338
+ </div>
339
+ <p> </p>
340
+ </div>
341
+ OUTPUT
342
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
343
+ .convert("test", input, true)))
344
+ .to be_equivalent_to xmlpp(presxml)
345
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
346
+ .convert("test", presxml, true)))
347
+ .to be_equivalent_to xmlpp(html)
348
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::WordConvert.new({})
349
+ .convert("test", presxml, true))
350
+ .at("//div[@class = 'WordSection2']").to_xml))
351
+ .to be_equivalent_to xmlpp(word)
352
+ end
353
+
108
354
  it "renders figures" do
109
355
  input = <<~INPUT
110
356
  <iso-standard xmlns='http://riboseinc.com/isoxml'>
@@ -618,8 +864,8 @@ RSpec.describe IsoDoc do
618
864
  end
619
865
 
620
866
  it "processes formulae with single definition list entry" do
621
- output = IsoDoc::Iso::HtmlConvert.new({}).convert("test",
622
- <<~"INPUT", true)
867
+ output = IsoDoc::Iso::HtmlConvert.new({})
868
+ .convert("test", <<~"INPUT", true)
623
869
  <iso-standard xmlns="http://riboseinc.com/isoxml">
624
870
  <preface>
625
871
  <foreword>
@@ -674,4 +920,255 @@ RSpec.describe IsoDoc do
674
920
  </html>
675
921
  OUTPUT
676
922
  end
923
+
924
+ it "adds ordered list classes for HTML" do
925
+ input = <<~INPUT
926
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
927
+ <preface><foreword>
928
+ <ol>
929
+ <li><p>A</p></li>
930
+ <li><p>B</p></li>
931
+ <li><ol>
932
+ <li>C</li>
933
+ <li>D</li>
934
+ <li><ol>
935
+ <li>E</li>
936
+ <li>F</li>
937
+ <li><ol>
938
+ <li>G</li>
939
+ <li>H</li>
940
+ <li><ol>
941
+ <li>I</li>
942
+ <li>J</li>
943
+ <li><ol>
944
+ <li>K</li>
945
+ <li>L</li>
946
+ <li>M</li>
947
+ </ol></li>
948
+ <li>N</li>
949
+ </ol></li>
950
+ <li>O</li>
951
+ </ol></li>
952
+ <li>P</li>
953
+ </ol></li>
954
+ <li>Q</li>
955
+ </ol></li>
956
+ <li>R</li>
957
+ </ol>
958
+ </foreword></preface>
959
+ </iso-standard>
960
+ INPUT
961
+ presxml = <<~INPUT
962
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
963
+ <preface>
964
+ <foreword displayorder='1'>
965
+ <ol type='alphabet'>
966
+ <li>
967
+ <p>A</p>
968
+ </li>
969
+ <li>
970
+ <p>B</p>
971
+ </li>
972
+ <li>
973
+ <ol type='arabic'>
974
+ <li>C</li>
975
+ <li>D</li>
976
+ <li>
977
+ <ol type='roman'>
978
+ <li>E</li>
979
+ <li>F</li>
980
+ <li>
981
+ <ol type='alphabet_upper'>
982
+ <li>G</li>
983
+ <li>H</li>
984
+ <li>
985
+ <ol type='roman_upper'>
986
+ <li>I</li>
987
+ <li>J</li>
988
+ <li>
989
+ <ol type='alphabet'>
990
+ <li>K</li>
991
+ <li>L</li>
992
+ <li>M</li>
993
+ </ol>
994
+ </li>
995
+ <li>N</li>
996
+ </ol>
997
+ </li>
998
+ <li>O</li>
999
+ </ol>
1000
+ </li>
1001
+ <li>P</li>
1002
+ </ol>
1003
+ </li>
1004
+ <li>Q</li>
1005
+ </ol>
1006
+ </li>
1007
+ <li>R</li>
1008
+ </ol>
1009
+ </foreword>
1010
+ </preface>
1011
+ </iso-standard>
1012
+ INPUT
1013
+ html = <<~OUTPUT
1014
+ #{HTML_HDR}
1015
+ <br/>
1016
+ <div>
1017
+ <h1 class='ForewordTitle'>Foreword</h1>
1018
+ <ol type='a' class='alphabet'>
1019
+ <li>
1020
+ <p>A</p>
1021
+ </li>
1022
+ <li>
1023
+ <p>B</p>
1024
+ </li>
1025
+ <li>
1026
+ <ol type='1' class='arabic'>
1027
+ <li>C</li>
1028
+ <li>D</li>
1029
+ <li>
1030
+ <ol type='i' class='roman'>
1031
+ <li>E</li>
1032
+ <li>F</li>
1033
+ <li>
1034
+ <ol type='A' class='alphabet_upper'>
1035
+ <li>G</li>
1036
+ <li>H</li>
1037
+ <li>
1038
+ <ol type='I' class='roman_upper'>
1039
+ <li>I</li>
1040
+ <li>J</li>
1041
+ <li>
1042
+ <ol type='a' class='alphabet'>
1043
+ <li>K</li>
1044
+ <li>L</li>
1045
+ <li>M</li>
1046
+ </ol>
1047
+ </li>
1048
+ <li>N</li>
1049
+ </ol>
1050
+ </li>
1051
+ <li>O</li>
1052
+ </ol>
1053
+ </li>
1054
+ <li>P</li>
1055
+ </ol>
1056
+ </li>
1057
+ <li>Q</li>
1058
+ </ol>
1059
+ </li>
1060
+ <li>R</li>
1061
+ </ol>
1062
+ </div>
1063
+ <p class='zzSTDTitle1'/>
1064
+ </div>
1065
+ </body>
1066
+ </html>
1067
+ OUTPUT
1068
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
1069
+ .convert("test", input, true)))
1070
+ .to be_equivalent_to xmlpp(presxml)
1071
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
1072
+ .convert("test", presxml, true)))
1073
+ .to be_equivalent_to xmlpp(html)
1074
+ end
1075
+
1076
+ it "processes ordered lists with start" do
1077
+ input = <<~INPUT
1078
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1079
+ <preface><foreword>
1080
+ <ol start="4">
1081
+ <li>List</li>
1082
+ </ol>
1083
+ </foreword></preface>
1084
+ </iso-standard>
1085
+ INPUT
1086
+ presxml = <<~INPUT
1087
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
1088
+ <preface>
1089
+ <foreword displayorder='1'>
1090
+ <ol start='4' type='alphabet'>
1091
+ <li>List</li>
1092
+ </ol>
1093
+ </foreword>
1094
+ </preface>
1095
+ </iso-standard>
1096
+ INPUT
1097
+ html = <<~OUTPUT
1098
+ #{HTML_HDR}
1099
+ <br/>
1100
+ <div>
1101
+ <h1 class='ForewordTitle'>Foreword</h1>
1102
+ <ol type='a' start='4' class='alphabet'>
1103
+ <li>List</li>
1104
+ </ol>
1105
+ </div>
1106
+ <p class='zzSTDTitle1'/>
1107
+ </div>
1108
+ </body>
1109
+ </html>
1110
+ OUTPUT
1111
+ word = <<~OUTPUT
1112
+ <div class='WordSection2'>
1113
+ <p>
1114
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1115
+ </p>
1116
+ <div>
1117
+ <h1 class='ForewordTitle'>Foreword</h1>
1118
+ <ol type='a' start='4'>
1119
+ <li>List</li>
1120
+ </ol>
1121
+ </div>
1122
+ <p> </p>
1123
+ </div>
1124
+ OUTPUT
1125
+
1126
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
1127
+ .convert("test", input, true)))
1128
+ .to be_equivalent_to xmlpp(presxml)
1129
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
1130
+ .convert("test", presxml, true)))
1131
+ .to be_equivalent_to xmlpp(html)
1132
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::WordConvert.new({})
1133
+ .convert("test", presxml, true))
1134
+ .at("//div[@class = 'WordSection2']").to_xml))
1135
+ .to be_equivalent_to xmlpp(word)
1136
+ end
1137
+
1138
+ it "ignores intervening ul in numbering ol" do
1139
+ input = <<~INPUT
1140
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1141
+ <preface><foreword>
1142
+ <ul>
1143
+ <li>A</li>
1144
+ <li>
1145
+ <ol>
1146
+ <li>List</li>
1147
+ </ol>
1148
+ </li>
1149
+ </ul>
1150
+ </foreword></preface>
1151
+ </iso-standard>
1152
+ INPUT
1153
+ presxml = <<~INPUT
1154
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1155
+ <preface>
1156
+ <foreword displayorder='1'>
1157
+ <ul>
1158
+ <li>A</li>
1159
+ <li>
1160
+ <ol type='alphabet'>
1161
+ <li>List</li>
1162
+ </ol>
1163
+ </li>
1164
+ </ul>
1165
+ </foreword>
1166
+ </preface>
1167
+ </iso-standard>
1168
+ INPUT
1169
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
1170
+ .convert("test", input, true)))
1171
+ .to be_equivalent_to xmlpp(presxml)
1172
+
1173
+ end
677
1174
  end