metanorma-iso 2.0.8.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/lib/html2doc/lists.rb +169 -0
  3. data/lib/isodoc/iso/base_convert.rb +11 -1
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +7 -0
  5. data/lib/isodoc/iso/html/isodoc-dis.css +407 -427
  6. data/lib/isodoc/iso/html/isodoc-dis.scss +482 -438
  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 +3 -1
  14. data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +26 -13
  15. data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +58 -0
  16. data/lib/isodoc/iso/html/word_iso_titlepage.html +16 -6
  17. data/lib/isodoc/iso/html/wordstyle-dis.css +168 -48
  18. data/lib/isodoc/iso/html/wordstyle-dis.scss +158 -43
  19. data/lib/isodoc/iso/html_convert.rb +7 -2
  20. data/lib/isodoc/iso/i18n-en.yaml +33 -4
  21. data/lib/isodoc/iso/i18n-fr.yaml +30 -3
  22. data/lib/isodoc/iso/i18n-ru.yaml +33 -4
  23. data/lib/isodoc/iso/i18n-zh-Hans.yaml +33 -3
  24. data/lib/isodoc/iso/i18n.rb +1 -1
  25. data/lib/isodoc/iso/init.rb +17 -1
  26. data/lib/isodoc/iso/iso.amendment.xsl +1711 -367
  27. data/lib/isodoc/iso/iso.international-standard.xsl +1711 -367
  28. data/lib/isodoc/iso/metadata.rb +72 -78
  29. data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
  30. data/lib/isodoc/iso/presentation_xml_convert.rb +52 -100
  31. data/lib/isodoc/iso/presentation_xref.rb +132 -0
  32. data/lib/isodoc/iso/sections.rb +3 -3
  33. data/lib/isodoc/iso/word_cleanup.rb +17 -0
  34. data/lib/isodoc/iso/word_convert.rb +32 -12
  35. data/lib/isodoc/iso/word_dis_cleanup.rb +235 -0
  36. data/lib/isodoc/iso/word_dis_convert.rb +122 -0
  37. data/lib/isodoc/iso/xref.rb +78 -29
  38. data/lib/metanorma/iso/base.rb +20 -1
  39. data/lib/metanorma/iso/biblio.rng +69 -42
  40. data/lib/metanorma/iso/boilerplate-fr.xml +4 -1
  41. data/lib/metanorma/iso/boilerplate-ru.xml +4 -3
  42. data/lib/metanorma/iso/boilerplate.xml +4 -3
  43. data/lib/metanorma/iso/cleanup.rb +29 -1
  44. data/lib/metanorma/iso/front.rb +31 -6
  45. data/lib/metanorma/iso/front_id.rb +2 -0
  46. data/lib/metanorma/iso/isodoc.rng +65 -0
  47. data/lib/metanorma/iso/isostandard.rng +30 -12
  48. data/lib/metanorma/iso/macros.rb +29 -0
  49. data/lib/metanorma/iso/version.rb +1 -1
  50. data/lib/metanorma-iso.rb +1 -0
  51. data/lib/relaton/render/config.yml +4 -0
  52. data/lib/relaton/render/general.rb +13 -0
  53. data/metanorma-iso.gemspec +1 -1
  54. data/spec/isodoc/amd_spec.rb +35 -60
  55. data/spec/isodoc/blocks_spec.rb +783 -179
  56. data/spec/isodoc/i18n_spec.rb +331 -100
  57. data/spec/isodoc/inline_spec.rb +35 -42
  58. data/spec/isodoc/iso_spec.rb +51 -170
  59. data/spec/isodoc/metadata_spec.rb +240 -99
  60. data/spec/isodoc/postproc_spec.rb +68 -7
  61. data/spec/isodoc/ref_spec.rb +66 -69
  62. data/spec/isodoc/section_spec.rb +88 -80
  63. data/spec/isodoc/table_spec.rb +2 -2
  64. data/spec/isodoc/terms_spec.rb +2 -2
  65. data/spec/isodoc/word_dis_spec.rb +1886 -0
  66. data/spec/isodoc/xref_spec.rb +138 -64
  67. data/spec/metanorma/amd_spec.rb +53 -1
  68. data/spec/metanorma/base_spec.rb +195 -20
  69. data/spec/metanorma/blocks_spec.rb +54 -0
  70. data/spec/metanorma/lists_spec.rb +2 -2
  71. data/spec/metanorma/section_spec.rb +2 -2
  72. data/spec/spec_helper.rb +23 -4
  73. data/spec/vcr_cassettes/withdrawn_iso.yml +25 -25
  74. metadata +15 -10
  75. data/docs/asciiiso-syntax.adoc +0 -307
  76. data/docs/guidance.adoc +0 -487
  77. data/docs/navigation.adoc +0 -23
  78. data/docs/quickstart.adoc +0 -179
  79. data/spec/vcr_cassettes/docrels.yml +0 -385
@@ -1,6 +1,356 @@
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
+
181
+ it "processes admonitions" do
182
+ input = <<~INPUT
183
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
184
+ <preface><foreword>
185
+ <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution">
186
+ <name>CAUTION</name>
187
+ <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
188
+ <p id="_e94663cc-2473-4ccc-9a72-983a74d989f3">Para 2.</p>
189
+ </admonition>
190
+ </foreword></preface>
191
+ </iso-standard>
192
+ INPUT
193
+ presxml = <<~INPUT
194
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
195
+ <preface><foreword displayorder="1">
196
+ <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution">
197
+ <p id='_e94663cc-2473-4ccc-9a72-983a74d989f2'>
198
+ CAUTION — Only use paddy or parboiled rice for the
199
+ determination of husked rice yield.
200
+ </p>
201
+ <p id="_e94663cc-2473-4ccc-9a72-983a74d989f3">Para 2.</p>
202
+ </admonition>
203
+ </foreword></preface>
204
+ </iso-standard>
205
+ INPUT
206
+ output = <<~OUTPUT
207
+ #{HTML_HDR}
208
+ <br/>
209
+ <div>
210
+ <h1 class='ForewordTitle'>Foreword</h1>
211
+ <div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' class='Admonition'>
212
+ <p>
213
+ CAUTION — Only use paddy or parboiled rice for the
214
+ determination of husked rice yield.
215
+ </p>
216
+ <p id='_e94663cc-2473-4ccc-9a72-983a74d989f3'>Para 2.</p>
217
+ </div>
218
+ </div>
219
+ <p class='zzSTDTitle1'/>
220
+ </div>
221
+ </body>
222
+ </html>
223
+ OUTPUT
224
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
225
+ .convert("test", input, true)))
226
+ .to be_equivalent_to xmlpp(presxml)
227
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
228
+ .convert("test", presxml, true)))
229
+ .to be_equivalent_to xmlpp(output)
230
+ end
231
+
232
+ it "processes admonitions with titles" do
233
+ input = <<~INPUT
234
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
235
+ <preface><foreword>
236
+ <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution">
237
+ <name>Title</name>
238
+ <ul>
239
+ <li>List</li>
240
+ </ul>
241
+ <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
242
+ </admonition>
243
+ </foreword></preface>
244
+ </iso-standard>
245
+ INPUT
246
+ presxml = <<~INPUT
247
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
248
+ <preface><foreword displayorder="1">
249
+ <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution">
250
+ <name>Title</name>
251
+ <ul>
252
+ <li>List</li>
253
+ </ul>
254
+ <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
255
+ </admonition>
256
+ </foreword></preface>
257
+ </iso-standard>
258
+ INPUT
259
+ output = <<~OUTPUT
260
+ #{HTML_HDR}
261
+ <br/>
262
+ <div>
263
+ <h1 class='ForewordTitle'>Foreword</h1>
264
+ <div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' class='Admonition'>
265
+ <p>Title — </p>
266
+ <ul>
267
+ <li>List</li>
268
+ </ul>
269
+ <p id='_e94663cc-2473-4ccc-9a72-983a74d989f2'>Only use paddy or parboiled rice for the determination of husked rice yield.</p>
270
+ </div>
271
+ </div>
272
+ <p class='zzSTDTitle1'/>
273
+ </div>
274
+ </body>
275
+ </html>
276
+ OUTPUT
277
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
278
+ .convert("test", input, true)))
279
+ .to be_equivalent_to xmlpp(presxml)
280
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
281
+ .convert("test", input, true)))
282
+ .to be_equivalent_to xmlpp(output)
283
+ end
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
+
4
354
  it "renders figures" do
5
355
  input = <<~INPUT
6
356
  <iso-standard xmlns='http://riboseinc.com/isoxml'>
@@ -114,78 +464,78 @@ RSpec.describe IsoDoc do
114
464
  </html>
115
465
  OUTPUT
116
466
  word = <<~OUTPUT
117
- <body lang='EN-US' link='blue' vlink='#954F72'>
118
- <div class='WordSection1'>
119
- <p>&#xA0;</p>
120
- </div>
467
+ <body lang='EN-US' link='blue' vlink='#954F72'>
468
+ <div class='WordSection1'>
469
+ <p>&#xA0;</p>
470
+ </div>
471
+ <p>
472
+ <br clear='all' class='section'/>
473
+ </p>
474
+ <div class='WordSection2'>
121
475
  <p>
122
- <br clear='all' class='section'/>
476
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
123
477
  </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>
478
+ <div id='fwd'>
479
+ <h1 class='ForewordTitle'>Foreword</h1>
480
+ <p class='ForewordText'> </p>
481
+ </div>
482
+ <p>&#xA0;</p>
483
+ </div>
484
+ <p>
485
+ <br clear='all' class='section'/>
486
+ </p>
487
+ <div class='WordSection3'>
488
+ <p class='zzSTDTitle1'/>
489
+ <div id='scope'>
490
+ <h1>Scope</h1>
491
+ <div id='N' class='figure'>
492
+ <img src='rice_images/rice_image1.png'/>
493
+ <p class='FigureTitle' style='text-align:center;'>Figure 1&#xA0;&#x2014; Split-it-right sample divider</p>
131
494
  </div>
132
- <p>&#xA0;</p>
495
+ <p> </p>
133
496
  </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'>
497
+ <div id='terms'>
498
+ <h1/>
499
+ </div>
500
+ <div id='widgets'>
501
+ <h1>Widgets</h1>
502
+ <div id='widgets1'>
503
+ <div id='note1' class='figure'>
504
+ <img src='rice_images/rice_image1.png'/>
505
+ <p class='FigureTitle' style='text-align:center;'>Figure 2&#xA0;&#x2014; Split-it-right sample divider</p>
506
+ </div>
507
+ <div id='note2' class='figure'>
142
508
  <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>
509
+ <p class='FigureTitle' style='text-align:center;'>Figure 3&#xA0;&#x2014; Split-it-right sample divider</p>
144
510
  </div>
145
511
  <p> </p>
146
512
  </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>
513
+ </div>
514
+ <p>
515
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
516
+ </p>
517
+ <div id='annex1' class='Section3'>
518
+ <div id='annex1a'>
519
+ <div id='AN' class='figure'>
520
+ <img src='rice_images/rice_image1.png'/>
521
+ <p class='AnnexFigureTitle' style='text-align:center;'>Figure A.1&#xA0;&#x2014; Split-it-right sample divider</p>
162
522
  </div>
163
523
  </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>
524
+ <div id='annex1b'>
525
+ <div id='Anote1' class='figure'>
526
+ <img src='rice_images/rice_image1.png'/>
527
+ <p class='AnnexFigureTitle' style='text-align:center;'>Figure A.2&#xA0;&#x2014; Split-it-right sample divider</p>
173
528
  </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>
529
+ <div id='Anote2' class='figure'>
530
+ <img src='rice_images/rice_image1.png'/>
531
+ <p class='AnnexFigureTitle' style='text-align:center;'>Figure A.3&#xA0;&#x2014; Split-it-right sample divider</p>
183
532
  </div>
184
533
  </div>
185
534
  </div>
186
- <br clear='all' style='page-break-before:left;mso-break-type:section-break'/>
187
- <div class='colophon'/>
188
- </body>
535
+ </div>
536
+ <br clear='all' style='page-break-before:left;mso-break-type:section-break'/>
537
+ <div class='colophon'/>
538
+ </body>
189
539
  OUTPUT
190
540
  output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", input, true)
191
541
  expect(xmlpp(output)).to be_equivalent_to xmlpp(html)
@@ -195,64 +545,65 @@ RSpec.describe IsoDoc do
195
545
  end
196
546
 
197
547
  it "renders subfigures (HTML)" do
198
- output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
199
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
200
- <preface>
201
- <foreword id='fwd'>
202
- <p>
203
- <xref target='N'/>
204
- <xref target='note1'/>
205
- <xref target='note2'/>
206
- <xref target='AN'/>
207
- <xref target='Anote1'/>
208
- <xref target='Anote2'/>
209
- </p>
210
- </foreword>
211
- </preface>
212
- <sections>
213
- <clause id='scope' type="scope">
214
- <title>Scope</title>
215
- </clause>
216
- <terms id='terms'/>
217
- <clause id='widgets'>
218
- <title>Widgets</title>
219
- <clause id='widgets1'>
220
- <figure id='N'>
221
- <name>Figure 1</name>
222
- <figure id='note1'>
548
+ output = IsoDoc::Iso::HtmlConvert.new({})
549
+ .convert("test", <<~"INPUT", true)
550
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
551
+ <preface>
552
+ <foreword id='fwd'>
553
+ <p>
554
+ <xref target='N'/>
555
+ <xref target='note1'/>
556
+ <xref target='note2'/>
557
+ <xref target='AN'/>
558
+ <xref target='Anote1'/>
559
+ <xref target='Anote2'/>
560
+ </p>
561
+ </foreword>
562
+ </preface>
563
+ <sections>
564
+ <clause id='scope' type="scope">
565
+ <title>Scope</title>
566
+ </clause>
567
+ <terms id='terms'/>
568
+ <clause id='widgets'>
569
+ <title>Widgets</title>
570
+ <clause id='widgets1'>
571
+ <figure id='N'>
572
+ <name>Figure 1</name>
573
+ <figure id='note1'>
574
+ <name>a)&#xA0;&#x2014; Split-it-right sample divider</name>
575
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
576
+ </figure>
577
+ <figure id='note2'>
578
+ <name>b)&#xA0;&#x2014; Split-it-right sample divider</name>
579
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
580
+ </figure>
581
+ </figure>
582
+ <p>
583
+ <xref target='note1'/>
584
+ <xref target='note2'/>
585
+ </p>
586
+ </clause>
587
+ </clause>
588
+ </sections>
589
+ <annex id='annex1'>
590
+ <clause id='annex1a'> </clause>
591
+ <clause id='annex1b'>
592
+ <figure id='AN'>
593
+ <name>Figure A.1</name>
594
+ <figure id='Anote1'>
223
595
  <name>a)&#xA0;&#x2014; Split-it-right sample divider</name>
224
596
  <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
225
597
  </figure>
226
- <figure id='note2'>
598
+ <figure id='Anote2'>
227
599
  <name>b)&#xA0;&#x2014; Split-it-right sample divider</name>
228
600
  <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
229
601
  </figure>
230
602
  </figure>
231
- <p>
232
- <xref target='note1'/>
233
- <xref target='note2'/>
234
- </p>
235
603
  </clause>
236
- </clause>
237
- </sections>
238
- <annex id='annex1'>
239
- <clause id='annex1a'> </clause>
240
- <clause id='annex1b'>
241
- <figure id='AN'>
242
- <name>Figure A.1</name>
243
- <figure id='Anote1'>
244
- <name>a)&#xA0;&#x2014; Split-it-right sample divider</name>
245
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
246
- </figure>
247
- <figure id='Anote2'>
248
- <name>b)&#xA0;&#x2014; Split-it-right sample divider</name>
249
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
250
- </figure>
251
- </figure>
252
- </clause>
253
- </annex>
254
- </iso-standard>
255
- INPUT
604
+ </annex>
605
+ </iso-standard>
606
+ INPUT
256
607
  expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
257
608
  <html lang='en'>
258
609
  <head/>
@@ -450,58 +801,59 @@ RSpec.describe IsoDoc do
450
801
  OUTPUT
451
802
 
452
803
  word = <<~OUTPUT
453
- <div>
454
- <h1 class='ForewordTitle'>Foreword</h1>
455
- <div id='_be9158af-7e93-4ee2-90c5-26d31c181934'><div class='formula'>
456
- <p>
457
- <span class='stem'>(#(r = 1 %)#)</span>
458
- <span style='mso-tab-count:1'>&#160; </span>
459
- </p>
460
- </div>
461
- <p>where</p>
462
- <table class="formula_dl">
463
- <tr>
464
- <td align="left" valign="top">
465
- <p align="left" style="margin-left:0pt;text-align:left;">
466
- <span class="stem">(#(r)#)</span>
467
- </p>
468
- </td>
469
- <td valign="top">
470
- <p class="ForewordText" id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
471
- </td>
472
- </tr>
473
- <tr>
474
- <td align="left" valign="top">
475
- <p align="left" style="margin-left:0pt;text-align:left;">
476
- <span class="stem">(#(s_1)#)</span>
477
- </p>
478
- </td>
479
- <td valign="top">
480
- <p class="ForewordText" id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the other repeatability limit.</p>
481
- </td>
482
- </tr>
483
- </table>
484
- <div id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0' class='Note'>
485
- <p class='Note'>
486
- <span class='note_label'>NOTE</span>
487
- <span style='mso-tab-count:1'>&#160; </span>
488
- [durationUnits] is essentially a duration statement without the "P"
489
- prefix. "P" is unnecessary because between "G" and "U" duration is
490
- always expressed.
491
- </p>
492
- </div>
493
- </div>
494
- <div id='_be9158af-7e93-4ee2-90c5-26d31c181935'><div class='formula'>
804
+ <div>
805
+ <h1 class='ForewordTitle'>Foreword</h1>
806
+ <div id='_be9158af-7e93-4ee2-90c5-26d31c181934'><div class='formula'>
495
807
  <p>
496
808
  <span class='stem'>(#(r = 1 %)#)</span>
497
809
  <span style='mso-tab-count:1'>&#160; </span>
498
- (1)
499
810
  </p>
500
811
  </div>
812
+ <p>where</p>
813
+ <table class="formula_dl">
814
+ <tr>
815
+ <td align="left" valign="top">
816
+ <p align="left" style="margin-left:0pt;text-align:left;">
817
+ <span class="stem">(#(r)#)</span>
818
+ </p>
819
+ </td>
820
+ <td valign="top">
821
+ <p class="ForewordText" id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
822
+ </td>
823
+ </tr>
824
+ <tr>
825
+ <td align="left" valign="top">
826
+ <p align="left" style="margin-left:0pt;text-align:left;">
827
+ <span class="stem">(#(s_1)#)</span>
828
+ </p>
829
+ </td>
830
+ <td valign="top">
831
+ <p class="ForewordText" id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the other repeatability limit.</p>
832
+ </td>
833
+ </tr>
834
+ </table>
835
+ <div id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0' class='Note'>
836
+ <p class='Note'>
837
+ <span class='note_label'>NOTE</span>
838
+ <span style='mso-tab-count:1'>&#160; </span>
839
+ [durationUnits] is essentially a duration statement without the "P"
840
+ prefix. "P" is unnecessary because between "G" and "U" duration is
841
+ always expressed.
842
+ </p>
843
+ </div>
844
+ </div>
845
+ <div id='_be9158af-7e93-4ee2-90c5-26d31c181935'><div class='formula'>
846
+ <p>
847
+ <span class='stem'>(#(r = 1 %)#)</span>
848
+ <span style='mso-tab-count:1'>&#160; </span>
849
+ (1)
850
+ </p>
501
851
  </div>
502
852
  </div>
503
- OUTPUT
504
- output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)
853
+ </div>
854
+ OUTPUT
855
+ output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input,
856
+ true)
505
857
  expect(xmlpp(output)).to be_equivalent_to xmlpp(presxml)
506
858
  output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true)
507
859
  expect(xmlpp(output)).to be_equivalent_to xmlpp(html)
@@ -512,32 +864,33 @@ RSpec.describe IsoDoc do
512
864
  end
513
865
 
514
866
  it "processes formulae with single definition list entry" do
515
- output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
516
- <iso-standard xmlns="http://riboseinc.com/isoxml">
517
- <preface>
518
- <foreword>
519
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true">
520
- <stem type="AsciiMath">r = 1 %</stem>
521
- <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
522
- <dt>
523
- <stem type="AsciiMath">r</stem>
524
- </dt>
525
- <dd>
526
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
527
- </dd>
528
- </dl>
529
- <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
530
- <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the &quot;P&quot; prefix. &quot;P&quot; is unnecessary because between &quot;G&quot; and &quot;U&quot; duration is always expressed.</p>
531
- </note>
532
- </formula>
533
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
534
- <name>1</name>
535
- <stem type="AsciiMath">r = 1 %</stem>
536
- </formula>
537
- </foreword>
538
- </preface>
539
- </iso-standard>
540
- INPUT
867
+ output = IsoDoc::Iso::HtmlConvert.new({})
868
+ .convert("test", <<~"INPUT", true)
869
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
870
+ <preface>
871
+ <foreword>
872
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true">
873
+ <stem type="AsciiMath">r = 1 %</stem>
874
+ <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
875
+ <dt>
876
+ <stem type="AsciiMath">r</stem>
877
+ </dt>
878
+ <dd>
879
+ <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
880
+ </dd>
881
+ </dl>
882
+ <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
883
+ <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the &quot;P&quot; prefix. &quot;P&quot; is unnecessary because between &quot;G&quot; and &quot;U&quot; duration is always expressed.</p>
884
+ </note>
885
+ </formula>
886
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
887
+ <name>1</name>
888
+ <stem type="AsciiMath">r = 1 %</stem>
889
+ </formula>
890
+ </foreword>
891
+ </preface>
892
+ </iso-standard>
893
+ INPUT
541
894
  expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
542
895
  #{HTML_HDR}
543
896
  <br/>
@@ -567,4 +920,255 @@ RSpec.describe IsoDoc do
567
920
  </html>
568
921
  OUTPUT
569
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
570
1174
  end