isodoc 2.1.0.2 → 2.1.2.1

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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +6 -3
  3. data/lib/isodoc/base_style/all.css +227 -0
  4. data/lib/isodoc/base_style/blocks.css +0 -0
  5. data/lib/isodoc/base_style/blocks.scss +7 -0
  6. data/lib/isodoc/base_style/coverpage.css +0 -0
  7. data/lib/isodoc/base_style/defaults.css +0 -0
  8. data/lib/isodoc/base_style/metanorma_word.css +47 -0
  9. data/lib/isodoc/base_style/nav.css +0 -0
  10. data/lib/isodoc/base_style/reset.css +125 -0
  11. data/lib/isodoc/base_style/typography.css +0 -0
  12. data/lib/isodoc/class_utils.rb +1 -1
  13. data/lib/isodoc/function/blocks.rb +1 -1
  14. data/lib/isodoc/function/cleanup.rb +1 -1
  15. data/lib/isodoc/function/inline.rb +4 -2
  16. data/lib/isodoc/function/lists.rb +24 -9
  17. data/lib/isodoc/function/table.rb +1 -1
  18. data/lib/isodoc/function/to_word_html.rb +3 -2
  19. data/lib/isodoc/function/utils.rb +18 -8
  20. data/lib/isodoc/gem_tasks.rb +19 -10
  21. data/lib/isodoc/html_function/html.rb +2 -2
  22. data/lib/isodoc/i18n.rb +19 -0
  23. data/lib/isodoc/metadata.rb +2 -2
  24. data/lib/isodoc/presentation_function/block.rb +3 -3
  25. data/lib/isodoc/presentation_function/image.rb +1 -1
  26. data/lib/isodoc/presentation_function/inline.rb +13 -6
  27. data/lib/isodoc/presentation_function/section.rb +3 -1
  28. data/lib/isodoc/presentation_function/xrefs.rb +22 -6
  29. data/lib/isodoc/presentation_xml_convert.rb +1 -0
  30. data/lib/isodoc/version.rb +1 -1
  31. data/lib/isodoc/word_function/body.rb +9 -6
  32. data/lib/isodoc/word_function/postprocess.rb +1 -1
  33. data/lib/isodoc/word_function/postprocess_cover.rb +5 -5
  34. data/lib/isodoc/xref/xref_gen.rb +6 -6
  35. metadata +16 -69
  36. data/.github/workflows/rake.yml +0 -15
  37. data/.github/workflows/release.yml +0 -24
  38. data/.hound.yml +0 -5
  39. data/.oss-guides.rubocop.yml +0 -1077
  40. data/.rubocop.yml +0 -10
  41. data/Rakefile +0 -8
  42. data/bin/rspec +0 -17
  43. data/spec/assets/header.html +0 -7
  44. data/spec/assets/html.scss +0 -20
  45. data/spec/assets/html_override.css +0 -1
  46. data/spec/assets/htmlcover.html +0 -4
  47. data/spec/assets/htmlintro.html +0 -5
  48. data/spec/assets/i18n.yaml +0 -41
  49. data/spec/assets/iso.xml +0 -8
  50. data/spec/assets/odf.emf +0 -0
  51. data/spec/assets/odf.svg +0 -1
  52. data/spec/assets/odf1.svg +0 -4
  53. data/spec/assets/outputtest/a.xml +0 -66
  54. data/spec/assets/outputtest/iso.international-standard.xsl +0 -3011
  55. data/spec/assets/rice_image1 +0 -0
  56. data/spec/assets/rice_image1.png +0 -0
  57. data/spec/assets/scripts.html +0 -3
  58. data/spec/assets/scripts_override.html +0 -3
  59. data/spec/assets/std.css +0 -2
  60. data/spec/assets/word.css +0 -2
  61. data/spec/assets/word_override.css +0 -1
  62. data/spec/assets/wordcover.html +0 -3
  63. data/spec/assets/wordintro.html +0 -4
  64. data/spec/isodoc/blocks_spec.rb +0 -2934
  65. data/spec/isodoc/cleanup_spec.rb +0 -1056
  66. data/spec/isodoc/footnotes_spec.rb +0 -264
  67. data/spec/isodoc/form_spec.rb +0 -160
  68. data/spec/isodoc/i18n_spec.rb +0 -1201
  69. data/spec/isodoc/inline_spec.rb +0 -2301
  70. data/spec/isodoc/lists_spec.rb +0 -469
  71. data/spec/isodoc/metadata_spec.rb +0 -401
  72. data/spec/isodoc/postproc_spec.rb +0 -2941
  73. data/spec/isodoc/presentation_xml_spec.rb +0 -1476
  74. data/spec/isodoc/ref_spec.rb +0 -955
  75. data/spec/isodoc/section_spec.rb +0 -2123
  76. data/spec/isodoc/table_spec.rb +0 -588
  77. data/spec/isodoc/terms_spec.rb +0 -712
  78. data/spec/isodoc/utils_spec.rb +0 -57
  79. data/spec/isodoc/xref_numbering_spec.rb +0 -378
  80. data/spec/isodoc/xref_spec.rb +0 -1837
  81. data/spec/isodoc/xslfo_convert_spec.rb +0 -103
  82. data/spec/spec_helper.rb +0 -81
@@ -1,2934 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe IsoDoc do
4
- it "processes amend blocks" do
5
- input = <<~INPUT
6
- <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
7
- <bibdata type='standard'>
8
- <title language='en' format='text/plain'>Document title</title>
9
- <language>en</language>
10
- <script>Latn</script>
11
- <status>
12
- <stage>published</stage>
13
- </status>
14
- <copyright>
15
- <from>2020</from>
16
- </copyright>
17
- <ext>
18
- <doctype>article</doctype>
19
- </ext>
20
- </bibdata>
21
- <sections>
22
- <clause id='A' inline-header='false' obligation='normative'>
23
- <title>Change Clause</title>
24
- <amend id='B' change='modify' path='//table[2]' path_end='//table[2]/following-sibling:example[1]' title='Change'>
25
- <autonumber type='table'>2</autonumber>
26
- <autonumber type='example'>A.7</autonumber>
27
- <description>
28
- <p id='C'>
29
- <em>
30
- This table contains information on polygon cells which are not
31
- included in ISO 10303-52. Remove table 2 completely and replace
32
- with:
33
- </em>
34
- </p>
35
- </description>
36
- <newcontent id='D'>
37
- <table id='E'>
38
- <name>Edges of triangle and quadrilateral cells</name>
39
- <tbody>
40
- <tr>
41
- <th colspan='2' valign='middle' align='center'>triangle</th>
42
- <th colspan='2' valign='middle' align='center'>quadrilateral</th>
43
- </tr>
44
- <tr>
45
- <td valign='middle' align='center'>edge</td>
46
- <td valign='middle' align='center'>vertices</td>
47
- <td valign='middle' align='center'>edge</td>
48
- <td valign='middle' align='center'>vertices</td>
49
- </tr>
50
- <tr>
51
- <td valign='middle' align='center'>1</td>
52
- <td valign='middle' align='center'>1, 2</td>
53
- <td valign='middle' align='center'>1</td>
54
- <td valign='middle' align='center'>1, 2</td>
55
- </tr>
56
- <tr>
57
- <td valign='middle' align='center'>2</td>
58
- <td valign='middle' align='center'>2, 3</td>
59
- <td valign='middle' align='center'>2</td>
60
- <td valign='middle' align='center'>2, 3</td>
61
- </tr>
62
- <tr>
63
- <td valign='middle' align='center'>3</td>
64
- <td valign='middle' align='center'>3, 1</td>
65
- <td valign='middle' align='center'>3</td>
66
- <td valign='middle' align='center'>3, 4</td>
67
- </tr>
68
- <tr>
69
- <td valign='top' align='left'/>
70
- <td valign='top' align='left'/>
71
- <td valign='middle' align='center'>4</td>
72
- <td valign='middle' align='center'>4, 1</td>
73
- </tr>
74
- </tbody>
75
- </table>
76
- <figure id="H"><name>Figure</name></figure>
77
- <example id='F'>
78
- <p id='G'>This is not generalised further.</p>
79
- </example>
80
- </newcontent>
81
- </amend>
82
- </clause>
83
- </sections>
84
- </standard-document>
85
- INPUT
86
- presxml = <<~OUTPUT
87
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="presentation">
88
- <bibdata type="standard">
89
- <title language="en" format="text/plain">Document title</title>
90
- <language current="true">en</language>
91
- <script current="true">Latn</script>
92
- <status>
93
- <stage>published</stage>
94
- </status>
95
- <copyright>
96
- <from>2020</from>
97
- </copyright>
98
- <ext>
99
- <doctype>article</doctype>
100
- </ext>
101
- </bibdata>
102
- <sections>
103
- <clause id="A" inline-header="false" obligation="normative" displayorder="1">
104
- <title depth="1">1.<tab/>Change Clause</title>
105
- <p id="C">
106
- <em>
107
- This table contains information on polygon cells which are not
108
- included in ISO 10303-52. Remove table 2 completely and replace
109
- with:
110
- </em>
111
- </p>
112
- <quote id="D">
113
- <table id="E" number="2">
114
- <name>Table 2&#xA0;&#x2014; Edges of triangle and quadrilateral cells</name>
115
- <tbody>
116
- <tr>
117
- <th colspan="2" valign="middle" align="center">triangle</th>
118
- <th colspan="2" valign="middle" align="center">quadrilateral</th>
119
- </tr>
120
- <tr>
121
- <td valign="middle" align="center">edge</td>
122
- <td valign="middle" align="center">vertices</td>
123
- <td valign="middle" align="center">edge</td>
124
- <td valign="middle" align="center">vertices</td>
125
- </tr>
126
- <tr>
127
- <td valign="middle" align="center">1</td>
128
- <td valign="middle" align="center">1, 2</td>
129
- <td valign="middle" align="center">1</td>
130
- <td valign="middle" align="center">1, 2</td>
131
- </tr>
132
- <tr>
133
- <td valign="middle" align="center">2</td>
134
- <td valign="middle" align="center">2, 3</td>
135
- <td valign="middle" align="center">2</td>
136
- <td valign="middle" align="center">2, 3</td>
137
- </tr>
138
- <tr>
139
- <td valign="middle" align="center">3</td>
140
- <td valign="middle" align="center">3, 1</td>
141
- <td valign="middle" align="center">3</td>
142
- <td valign="middle" align="center">3, 4</td>
143
- </tr>
144
- <tr>
145
- <td valign="top" align="left"/>
146
- <td valign="top" align="left"/>
147
- <td valign="middle" align="center">4</td>
148
- <td valign="middle" align="center">4, 1</td>
149
- </tr>
150
- </tbody>
151
- </table>
152
- <figure id="H" unnumbered="true"><name>Figure</name></figure>
153
- <example id="F" number="A.7"><name>EXAMPLE A.7</name>
154
- <p id="G">This is not generalised further.</p>
155
- </example>
156
- </quote>
157
- </clause>
158
- </sections>
159
- </standard-document>
160
- OUTPUT
161
- html = <<~OUTPUT
162
- <html lang='en'>
163
- <head/>
164
- <body lang='en'>
165
- <div class='title-section'>
166
- <p>&#160;</p>
167
- </div>
168
- <br/>
169
- <div class='prefatory-section'>
170
- <p>&#160;</p>
171
- </div>
172
- <br/>
173
- <div class='main-section'>
174
- <p class='zzSTDTitle1'>Document title</p>
175
- <div id='A'>
176
- <h1>1.&#160; Change Clause</h1>
177
- <p id='C'>
178
- <i>
179
- This table contains information on polygon cells which are not
180
- included in ISO 10303-52. Remove table 2 completely and replace
181
- with:
182
- </i>
183
- </p>
184
- <div class='Quote' id="D">
185
- <p class='TableTitle' style='text-align:center;'>Table 2&#160;&#8212; Edges of triangle and quadrilateral cells</p>
186
- <table id='E' class='MsoISOTable' style='border-width:1px;border-spacing:0;'>
187
- <tbody>
188
- <tr>
189
- <th colspan='2' style='font-weight:bold;text-align:center;vertical-align:middle;border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;' scope='row'>triangle</th>
190
- <th colspan='2' style='font-weight:bold;text-align:center;vertical-align:middle;border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;' scope='row'>quadrilateral</th>
191
- </tr>
192
- <tr>
193
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>edge</td>
194
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>vertices</td>
195
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>edge</td>
196
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>vertices</td>
197
- </tr>
198
- <tr>
199
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>1</td>
200
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>1, 2</td>
201
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>1</td>
202
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>1, 2</td>
203
- </tr>
204
- <tr>
205
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>2</td>
206
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>2, 3</td>
207
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>2</td>
208
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>2, 3</td>
209
- </tr>
210
- <tr>
211
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>3</td>
212
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>3, 1</td>
213
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>3</td>
214
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.0pt;'>3, 4</td>
215
- </tr>
216
- <tr>
217
- <td style='text-align:left;vertical-align:top;border-top:none;border-bottom:solid windowtext 1.5pt;'/>
218
- <td style='text-align:left;vertical-align:top;border-top:none;border-bottom:solid windowtext 1.5pt;'/>
219
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.5pt;'>4</td>
220
- <td style='text-align:center;vertical-align:middle;border-top:none;border-bottom:solid windowtext 1.5pt;'>4, 1</td>
221
- </tr>
222
- </tbody>
223
- </table>
224
- <div id='H' class='figure'>
225
- <p class='FigureTitle' style='text-align:center;'>Figure</p>
226
- </div>
227
- <div id='F' class='example'>
228
- <p class='example-title'>EXAMPLE A.7</p>
229
- <p id='G'>This is not generalised further.</p>
230
- </div>
231
- </div>
232
- </div>
233
- </div>
234
- </body>
235
- </html>
236
- OUTPUT
237
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
238
- .convert("test", input, true))
239
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
240
- .to be_equivalent_to xmlpp(presxml)
241
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
242
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
243
- end
244
-
245
- it "processes unlabelled notes" do
246
- input = <<~INPUT
247
- <iso-standard xmlns="http://riboseinc.com/isoxml">
248
- <preface><foreword>
249
- <note id="A" keep-with-next="true" keep-lines-together="true">
250
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83e">These results are based on a study carried out on three different types of kernel.</p>
251
- </note>
252
- <note id="B" keep-with-next="true" keep-lines-together="true" notag="true" unnumbered="true">
253
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
254
- </note>
255
- </foreword></preface>
256
- </iso-standard>
257
- INPUT
258
- presxml = <<~OUTPUT
259
- <?xml version='1.0'?>
260
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
261
- <preface>
262
- <foreword displayorder="1">
263
- <note id='A' keep-with-next='true' keep-lines-together='true'>
264
- <name>NOTE 1</name>
265
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83e'>
266
- These results are based on a study carried out on three different
267
- types of kernel.
268
- </p>
269
- </note>
270
- <note id='B' keep-with-next='true' keep-lines-together='true' notag='true' unnumbered='true'>
271
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
272
- These results are based on a study carried out on three different
273
- types of kernel.
274
- </p>
275
- </note>
276
- </foreword>
277
- </preface>
278
- </iso-standard>
279
- OUTPUT
280
- html = <<~OUTPUT
281
- #{HTML_HDR}
282
- <br/>
283
- <div>
284
- <h1 class="ForewordTitle">Foreword</h1>
285
- <div id='A' class='Note' style='page-break-after: avoid;page-break-inside: avoid;'>
286
- <p>
287
- <span class='note_label'>NOTE 1</span>
288
- &#160; These results are based on a study carried out on three
289
- different types of kernel.#{' '}
290
- </p>
291
- </div>
292
- <div id='B' class='Note' style='page-break-after: avoid;page-break-inside: avoid;'>
293
- <p>
294
- &#160; These results are based on a study carried out on three
295
- different types of kernel.#{' '}
296
- </p>
297
- </div>
298
- </div>
299
- <p class="zzSTDTitle1"/>
300
- </div>
301
- </body>
302
- </html>
303
- OUTPUT
304
- doc = <<~OUTPUT
305
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
306
- <head><style/></head>
307
- <body lang="EN-US" link="blue" vlink="#954F72">
308
- <div class="WordSection1">
309
- <p>&#160;</p>
310
- </div>
311
- <p><br clear="all" class="section"/></p>
312
- <div class="WordSection2">
313
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
314
- <div>
315
- <h1 class="ForewordTitle">Foreword</h1>
316
- <div id='A' class='Note' style='page-break-after: avoid;page-break-inside: avoid;'>
317
- <p class='Note'>
318
- <span class='note_label'>NOTE 1</span>
319
- <span style='mso-tab-count:1'>&#160; </span>
320
- These results are based on a study carried out on three different
321
- types of kernel.#{' '}
322
- </p>
323
- </div>
324
- <div id='B' class='Note' style='page-break-after: avoid;page-break-inside: avoid;'>
325
- <p class='Note'>
326
- <span class='note_label'/>
327
- <span style='mso-tab-count:1'>&#160; </span>
328
- These results are based on a study carried out on three different
329
- types of kernel.#{' '}
330
- </p>
331
- </div>
332
- </div>
333
- <p>&#160;</p>
334
- </div>
335
- <p><br clear="all" class="section"/></p>
336
- <div class="WordSection3">
337
- <p class="zzSTDTitle1"/>
338
- </div>
339
- </body>
340
- </html>
341
- OUTPUT
342
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
343
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
344
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
345
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
346
- expect(xmlpp(IsoDoc::WordConvert.new({})
347
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(doc)
348
- end
349
-
350
- it "processes sequences of notes" do
351
- input = <<~INPUT
352
- <iso-standard xmlns="http://riboseinc.com/isoxml">
353
- <preface><foreword>
354
- <note id="note1">
355
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
356
- </note>
357
- <note id="note2">
358
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
359
- </note>
360
- </foreword></preface>
361
- </iso-standard>
362
- INPUT
363
- presxml = <<~OUTPUT
364
- <?xml version='1.0'?>
365
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
366
- <preface>
367
- <foreword displayorder="1">
368
- <note id='note1'>
369
- <name>NOTE 1</name>
370
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
371
- These results are based on a study carried out on three different
372
- types of kernel.
373
- </p>
374
- </note>
375
- <note id='note2'>
376
- <name>NOTE 2</name>
377
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'>
378
- These results are based on a study carried out on three different
379
- types of kernel.
380
- </p>
381
- </note>
382
- </foreword>
383
- </preface>
384
- </iso-standard>
385
- OUTPUT
386
-
387
- output = <<~OUTPUT
388
- #{HTML_HDR}
389
- <br/>
390
- <div>
391
- <h1 class="ForewordTitle">Foreword</h1>
392
- <div id="note1" class="Note">
393
- <p><span class="note_label">NOTE 1</span>&#160; These results are based on a study carried out on three different types of kernel.</p>
394
- </div>
395
- <div id="note2" class="Note">
396
- <p><span class="note_label">NOTE 2</span>&#160; These results are based on a study carried out on three different types of kernel.</p>
397
- </div>
398
- </div>
399
- <p class="zzSTDTitle1"/>
400
- </div>
401
- </body>
402
- </html>
403
- OUTPUT
404
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
405
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
406
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
407
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
408
- end
409
-
410
- it "processes multi-para notes" do
411
- input = <<~INPUT
412
- <iso-standard xmlns="http://riboseinc.com/isoxml">
413
- <preface><foreword>
414
- <note>
415
- <name>NOTE</name>
416
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
417
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
418
- </note>
419
- </foreword></preface>
420
- </iso-standard>
421
- INPUT
422
- output = <<~OUTPUT
423
- #{HTML_HDR}
424
- <br/>
425
- <div>
426
- <h1 class="ForewordTitle">Foreword</h1>
427
- <div class="Note">
428
- <p><span class="note_label">NOTE</span>&#160; These results are based on a study carried out on three different types of kernel.</p>
429
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
430
- </div>
431
- </div>
432
- <p class="zzSTDTitle1"/>
433
- </div>
434
- </body>
435
- </html>
436
- OUTPUT
437
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
438
- .convert("test", input, true))).to be_equivalent_to xmlpp(output)
439
- end
440
-
441
- it "processes non-para notes" do
442
- input = <<~INPUT
443
- <iso-standard xmlns="http://riboseinc.com/isoxml">
444
- <preface><foreword>
445
- <note id="A"><name>NOTE</name>
446
- <dl>
447
- <dt>A</dt>
448
- <dd><p>B</p></dd>
449
- </dl>
450
- <ul>
451
- <li>C</li></ul>
452
- </note>
453
- </foreword></preface>
454
- </iso-standard>
455
- INPUT
456
- html = <<~OUTPUT
457
- #{HTML_HDR}
458
- <br/>
459
- <div>
460
- <h1 class="ForewordTitle">Foreword</h1>
461
- <div id="A" class="Note"><p><span class="note_label">NOTE</span>&#160; </p>
462
- <dl><dt><p>A</p></dt><dd><p>B</p></dd></dl>
463
- <ul>
464
- <li>C</li></ul>
465
- </div>
466
- </div>
467
- <p class="zzSTDTitle1"/>
468
- </div>
469
- </body>
470
- </html>
471
-
472
- OUTPUT
473
- doc = <<~OUTPUT
474
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
475
- <head><style/></head>
476
- <body lang="EN-US" link="blue" vlink="#954F72">
477
- <div class="WordSection1">
478
- <p>&#160;</p>
479
- </div>
480
- <p><br clear="all" class="section"/></p>
481
- <div class="WordSection2">
482
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
483
- <div>
484
- <h1 class="ForewordTitle">Foreword</h1>
485
- <div id="A" class="Note"><p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">&#160; </span></p>
486
- <table class="dl"><tr><td valign="top" align="left"><p align="left" style="margin-left:0pt;text-align:left;">A</p></td><td valign="top"><p class="Note">B</p></td></tr></table>
487
- <ul>
488
- <li>C</li></ul>
489
- </div>
490
- </div>
491
- <p>&#160;</p>
492
- </div>
493
- <p><br clear="all" class="section"/></p>
494
- <div class="WordSection3">
495
- <p class="zzSTDTitle1"/>
496
- </div>
497
- </body>
498
- </html>
499
- OUTPUT
500
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
501
- .convert("test", input, true))).to be_equivalent_to xmlpp(html)
502
- expect(xmlpp(IsoDoc::WordConvert.new({})
503
- .convert("test", input, true))).to be_equivalent_to xmlpp(doc)
504
- end
505
-
506
- it "processes paragraphs containing notes" do
507
- input = <<~INPUT
508
- <iso-standard xmlns="http://riboseinc.com/isoxml">
509
- <preface><foreword>
510
- <p id="A">ABC <note id="B"><name>NOTE 1</name><p id="C">XYZ</p></note>
511
- <note id="B1"><name>NOTE 2</name><p id="C1">XYZ1</p></note></p>
512
- </foreword></preface>
513
- </iso-standard>
514
- INPUT
515
- html = <<~OUTPUT
516
- #{HTML_HDR}
517
- <br/>
518
- <div>
519
- <h1 class='ForewordTitle'>Foreword</h1>
520
- <p id='A'>
521
- ABC
522
- <div id='B' class='Note'>
523
- <p>
524
- <span class='note_label'>NOTE 1</span>
525
- &#160; XYZ
526
- </p>
527
- </div>
528
- <div id='B1' class='Note'>
529
- <p>
530
- <span class='note_label'>NOTE 2</span>
531
- &#160; XYZ1
532
- </p>
533
- </div>
534
- </p>
535
- </div>
536
- <p class='zzSTDTitle1'/>
537
- </div>
538
- </body>
539
- </html>
540
- OUTPUT
541
-
542
- doc = <<~OUTPUT
543
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
544
- <head>
545
- <style/>
546
- </head>
547
- <body lang='EN-US' link='blue' vlink='#954F72'>
548
- <div class='WordSection1'>
549
- <p>&#160;</p>
550
- </div>
551
- <p>
552
- <br clear='all' class='section'/>
553
- </p>
554
- <div class='WordSection2'>
555
- <p>
556
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
557
- </p>
558
- <div>
559
- <h1 class='ForewordTitle'>Foreword</h1>
560
- <p id='A'>ABC </p>
561
- <div id='B' class='Note'>
562
- <p class='Note'>
563
- <span class='note_label'>NOTE 1</span>
564
- <span style='mso-tab-count:1'>&#160; </span>
565
- XYZ
566
- </p>
567
- </div>
568
- <div id='B1' class='Note'>
569
- <p class='Note'>
570
- <span class='note_label'>NOTE 2</span>
571
- <span style='mso-tab-count:1'>&#160; </span>
572
- XYZ1
573
- </p>
574
- </div>
575
- </div>
576
- <p>&#160;</p>
577
- </div>
578
- <p>
579
- <br clear='all' class='section'/>
580
- </p>
581
- <div class='WordSection3'>
582
- <p class='zzSTDTitle1'/>
583
- </div>
584
- </body>
585
- </html>
586
- OUTPUT
587
- expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({})
588
- .convert("test", input, true)))).to be_equivalent_to xmlpp(html)
589
- expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
590
- .convert("test", input, true)))).to be_equivalent_to xmlpp(doc)
591
- end
592
-
593
- it "converts notes and admonitions intended for coverpage" do
594
- input = <<~INPUT
595
- <iso-standard xmlns="http://riboseinc.com/isoxml">
596
- <preface><foreword>
597
- <note id="FB" coverpage="true" unnumbered="true"><p>XYZ</p></note>
598
- <admonition id="FC" coverpage="true" unnumbered="true" type="warning"><p>XYZ</p></admonition>
599
- </foreword></preface>
600
- </iso-standard>
601
- INPUT
602
- presxml = <<~OUTPUT
603
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
604
- <preface>
605
- <foreword displayorder='1'>
606
- <note id='FB' coverpage='true' unnumbered='true'>
607
- <name>NOTE</name>
608
- <p>XYZ</p>
609
- </note>
610
- <admonition id='FC' coverpage='true' unnumbered='true' type='warning'>
611
- <name>WARNING</name>
612
- <p>XYZ</p>
613
- </admonition>
614
- </foreword>
615
- </preface>
616
- </iso-standard>
617
- OUTPUT
618
- html = <<~OUTPUT
619
- #{HTML_HDR}
620
- <br/>
621
- <div>
622
- <h1 class='ForewordTitle'>Foreword</h1>
623
- <div id='FB' class='Note' coverpage='true'>
624
- <p>
625
- <span class='note_label'>NOTE</span>
626
- &#160; XYZ
627
- </p>
628
- </div>
629
- <div id='FC' class='Admonition' coverpage='true'>
630
- <p class='AdmonitionTitle' style='text-align:center;'>WARNING</p>
631
- <p>XYZ</p>
632
- </div>
633
- </div>
634
- <p class='zzSTDTitle1'/>
635
- </div>
636
- </body>
637
- </html>
638
- OUTPUT
639
- doc = <<~OUTPUT
640
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
641
- <head>
642
- <style/>
643
- </head>
644
- <body lang='EN-US' link='blue' vlink='#954F72'>
645
- <div class='WordSection1'>
646
- <p>&#160;</p>
647
- </div>
648
- <p>
649
- <br clear='all' class='section'/>
650
- </p>
651
- <div class='WordSection2'>
652
- <p>
653
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
654
- </p>
655
- <div>
656
- <h1 class='ForewordTitle'>Foreword</h1>
657
- <div id='FB' class='Note' coverpage='true'>
658
- <p class='Note'>
659
- <span class='note_label'>NOTE</span>
660
- <span style='mso-tab-count:1'>&#160; </span>
661
- XYZ
662
- </p>
663
- </div>
664
- <div id='FC' class='Admonition' coverpage='true'>
665
- <p class='AdmonitionTitle' style='text-align:center;'>WARNING</p>
666
- <p>XYZ</p>
667
- </div>
668
- </div>
669
- <p>&#160;</p>
670
- </div>
671
- <p>
672
- <br clear='all' class='section'/>
673
- </p>
674
- <div class='WordSection3'>
675
- <p class='zzSTDTitle1'/>
676
- </div>
677
- </body>
678
- </html>
679
- OUTPUT
680
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
681
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
682
- expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({})
683
- .convert("test", presxml, true)))).to be_equivalent_to xmlpp(html)
684
- expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
685
- .convert("test", presxml, true)))).to be_equivalent_to xmlpp(doc)
686
- end
687
-
688
- it "numbers notes in tables and figures separately from notes outside them" do
689
- input = <<~INPUT
690
- <iso-standard xmlns="http://riboseinc.com/isoxml">
691
- <preface><foreword>
692
- <figure id="F"><note id="FB"><p>XYZ</p></note></figure>
693
- <table id="T"><note id="TB"><p>XYZ</p></note></table>
694
- <p id="A">ABC <note id="B"><p id="C">XYZ</p></note>
695
- </foreword></preface>
696
- </iso-standard>
697
- INPUT
698
- output = <<~OUTPUT
699
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
700
- <preface>
701
- <foreword displayorder='1'>
702
- <figure id='F'>
703
- <name>Figure 1</name>
704
- <note id='FB'>
705
- <name>NOTE</name>
706
- <p>XYZ</p>
707
- </note>
708
- </figure>
709
- <table id='T'>
710
- <name>Table 1</name>
711
- <note id='TB'>
712
- <name>NOTE</name>
713
- <p>XYZ</p>
714
- </note>
715
- </table>
716
- <p id='A'>
717
- ABC
718
- <note id='B'>
719
- <name>NOTE</name>
720
- <p id='C'>XYZ</p>
721
- </note>
722
- </p>
723
- </foreword>
724
- </preface>
725
- </iso-standard>
726
- OUTPUT
727
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
728
- .convert("test", input, true))).to be_equivalent_to xmlpp(output)
729
- end
730
-
731
- it "processes figures" do
732
- input = <<~INPUT
733
- <iso-standard xmlns="http://riboseinc.com/isoxml">
734
- <preface><foreword>
735
- <figure id="figureA-1" keep-with-next="true" keep-lines-together="true">
736
- <name>Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name>
737
- <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
738
- <image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/>
739
- <image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/>
740
- <image src="data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9Ii4uLy4uLy4uL3hzbC9yZXNfZG9jL2ltZ2ZpbGUueHNsIj8+CjwhRE9DVFlQRSBpbWdmaWxlLmNvbnRlbnQgU1lTVEVNICIuLi8uLi8uLi9kdGQvdGV4dC5lbnQiPgo8aW1nZmlsZS5jb250ZW50IG1vZHVsZT0iZnVuZGFtZW50YWxzX29mX3Byb2R1Y3RfZGVzY3JpcHRpb25fYW5kX3N1cHBvcnQiIGZpbGU9ImFjdGlvbl9zY2hlbWFleHBnMS54bWwiPgo8aW1nIHNyYz0iYWN0aW9uX3NjaGVtYWV4cGcxLmdpZiI+CjxpbWcuYXJlYSBzaGFwZT0icmVjdCIgY29vcmRzPSIyMTAsMTg2LDM0MywyMjciIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9iYXNpY19hdHRyaWJ1dGVfc2NoZW1hL2Jhc2ljX2F0dHJpYnV0ZV9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMTAsMTAsOTYsNTEiIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9hY3Rpb25fc2NoZW1hL2FjdGlvbl9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMjEwLDI2NCwzNTgsMzA1IiBocmVmPSIuLi8uLi9yZXNvdXJjZXMvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEueG1sIiAvPgo8L2ltZz4KPC9pbWdmaWxlLmNvbnRlbnQ+Cg==" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="application/xml"/>
741
- <fn reference="a">
742
- <p id="_ef2c85b8-5a5a-4ecd-a1e6-92acefaaa852">The time <stem type="AsciiMath">t_90</stem> was estimated to be 18,2 min for this example.</p>
743
- </fn>
744
- <dl>
745
- <dt>A</dt>
746
- <dd><p>B</p></dd>
747
- </dl>
748
- </figure>
749
- <figure id="figure-B">
750
- <pre alt="A B">A &#x3c;
751
- B</pre>
752
- </figure>
753
- <figure id="figure-C" unnumbered="true">
754
- <pre>A &#x3c;
755
- B</pre>
756
- </figure>
757
- </foreword></preface>
758
- </iso-standard>
759
- INPUT
760
-
761
- presxml = <<~OUTPUT
762
- <?xml version='1.0'?>
763
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
764
- <preface><foreword displayorder="1">
765
- <figure id="figureA-1" keep-with-next="true" keep-lines-together="true">
766
- <name>Figure 1&#xA0;&#x2014; Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name>
767
- <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
768
- <image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/>
769
- <image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/>
770
- <image src='data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9Ii4uLy4uLy4uL3hzbC9yZXNfZG9jL2ltZ2ZpbGUueHNsIj8+CjwhRE9DVFlQRSBpbWdmaWxlLmNvbnRlbnQgU1lTVEVNICIuLi8uLi8uLi9kdGQvdGV4dC5lbnQiPgo8aW1nZmlsZS5jb250ZW50IG1vZHVsZT0iZnVuZGFtZW50YWxzX29mX3Byb2R1Y3RfZGVzY3JpcHRpb25fYW5kX3N1cHBvcnQiIGZpbGU9ImFjdGlvbl9zY2hlbWFleHBnMS54bWwiPgo8aW1nIHNyYz0iYWN0aW9uX3NjaGVtYWV4cGcxLmdpZiI+CjxpbWcuYXJlYSBzaGFwZT0icmVjdCIgY29vcmRzPSIyMTAsMTg2LDM0MywyMjciIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9iYXNpY19hdHRyaWJ1dGVfc2NoZW1hL2Jhc2ljX2F0dHJpYnV0ZV9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMTAsMTAsOTYsNTEiIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9hY3Rpb25fc2NoZW1hL2FjdGlvbl9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMjEwLDI2NCwzNTgsMzA1IiBocmVmPSIuLi8uLi9yZXNvdXJjZXMvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEueG1sIiAvPgo8L2ltZz4KPC9pbWdmaWxlLmNvbnRlbnQ+Cg==' height='20' width='auto' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f2' mimetype='application/xml'/>
771
- <fn reference="a">
772
- <p id="_ef2c85b8-5a5a-4ecd-a1e6-92acefaaa852">The time <stem type="AsciiMath">t_90</stem> was estimated to be 18,2 min for this example.</p>
773
- </fn>
774
- <dl>
775
- <dt>A</dt>
776
- <dd><p>B</p></dd>
777
- </dl>
778
- </figure>
779
- <figure id="figure-B">
780
- <name>Figure 2</name>
781
- <pre alt="A B">A &#x3c;
782
- B</pre>
783
- </figure>
784
- <figure id="figure-C" unnumbered="true">
785
- <pre>A &#x3c;
786
- B</pre>
787
- </figure>
788
- </foreword></preface>
789
- </iso-standard>
790
- OUTPUT
791
-
792
- html = <<~OUTPUT
793
- #{HTML_HDR}
794
- <br/>
795
- <div>
796
- <h1 class="ForewordTitle">Foreword</h1>
797
- <div id="figureA-1" class="figure" style='page-break-after: avoid;page-break-inside: avoid;'>
798
- <img src="rice_images/rice_image1.png" height="20" width="30" alt="alttext" title="titletxt"/>
799
- <img src="rice_images/rice_image1.png" height="20" width="auto"/>
800
- <img src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto"/>
801
- <img src='data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9Ii4uLy4uLy4uL3hzbC9yZXNfZG9jL2ltZ2ZpbGUueHNsIj8+CjwhRE9DVFlQRSBpbWdmaWxlLmNvbnRlbnQgU1lTVEVNICIuLi8uLi8uLi9kdGQvdGV4dC5lbnQiPgo8aW1nZmlsZS5jb250ZW50IG1vZHVsZT0iZnVuZGFtZW50YWxzX29mX3Byb2R1Y3RfZGVzY3JpcHRpb25fYW5kX3N1cHBvcnQiIGZpbGU9ImFjdGlvbl9zY2hlbWFleHBnMS54bWwiPgo8aW1nIHNyYz0iYWN0aW9uX3NjaGVtYWV4cGcxLmdpZiI+CjxpbWcuYXJlYSBzaGFwZT0icmVjdCIgY29vcmRzPSIyMTAsMTg2LDM0MywyMjciIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9iYXNpY19hdHRyaWJ1dGVfc2NoZW1hL2Jhc2ljX2F0dHJpYnV0ZV9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMTAsMTAsOTYsNTEiIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9hY3Rpb25fc2NoZW1hL2FjdGlvbl9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMjEwLDI2NCwzNTgsMzA1IiBocmVmPSIuLi8uLi9yZXNvdXJjZXMvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEueG1sIiAvPgo8L2ltZz4KPC9pbWdmaWxlLmNvbnRlbnQ+Cg==' height='20' width='auto'/>
802
- <a href="#_" class="TableFootnoteRef">a</a><aside class="footnote"><div id="fn:_"><span><span id="_" class="TableFootnoteRef">a</span>&#160; </span>
803
- <p id="_">The time <span class="stem">(#(t_90)#)</span> was estimated to be 18,2 min for this example.</p>
804
- </div></aside>
805
- <p style='page-break-after:avoid;'><b>Key</b></p><dl><dt><p>A</p></dt><dd><p>B</p></dd></dl>
806
- <p class="FigureTitle" style="text-align:center;">Figure 1&#160;&#8212; Split-it-right <i>sample</i> divider
807
- <a class='FootnoteRef' href='#fn:1'>
808
- <sup>1</sup>
809
- </a>
810
- </p></div>
811
- <div class="figure" id="figure-B">
812
- <pre>A &#x3c;
813
- B</pre>
814
- <p class="FigureTitle" style="text-align:center;">Figure 2</p>
815
- </div>
816
- <div class="figure" id="figure-C">
817
- <pre>A &#x3c;
818
- B</pre>
819
- </div>
820
- </div>
821
- <p class="zzSTDTitle1"/>
822
- <aside id='fn:1' class='footnote'>
823
- <p>X</p>
824
- </aside>
825
- </div>
826
- </body>
827
- </html>
828
- OUTPUT
829
-
830
- word = <<~OUTPUT
831
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
832
- <head><style/></head>
833
- <body lang="EN-US" link="blue" vlink="#954F72">
834
- <div class="WordSection1">
835
- <p>&#160;</p>
836
- </div>
837
- <p><br clear="all" class="section"/></p>
838
- <div class="WordSection2">
839
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
840
- <div>
841
- <h1 class="ForewordTitle">Foreword</h1>
842
- <div id="figureA-1" class="figure" style='page-break-after: avoid;page-break-inside: avoid;'>
843
- <img src="rice_images/rice_image1.png" height="20" width="30" alt="alttext" title="titletxt"/>
844
- <img src="rice_images/rice_image1.png" height='20' width='auto'/>
845
- <img src='_.gif' height='20' width='auto'/>
846
- <img src='_.xml' height='20' width='auto'/>
847
- <a href="#_" class="TableFootnoteRef">a</a><aside><div id="ftn_"><span><span id="_" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">&#160; </span></span>
848
- <p id="_">The time <span class="stem">(#(t_90)#)</span> was estimated to be 18,2 min for this example.</p>
849
- </div></aside>
850
- <p style='page-break-after:avoid;'><b>Key</b></p><table class="dl"><tr><td valign="top" align="left"><p align="left" style="margin-left:0pt;text-align:left;">A</p></td><td valign="top"><p>B</p></td></tr></table>
851
- <p class='FigureTitle' style='text-align:center;'>
852
- Figure 1&#160;&#8212; Split-it-right <i>sample</i> divider
853
- <span style='mso-bookmark:_Ref'>
854
- <a href='#ftn1' epub:type='footnote' class='FootnoteRef'>
855
- <sup>1</sup>
856
- </a>
857
- </span>
858
- </p>
859
- </div>
860
- <div class="figure" id="figure-B">
861
- <pre>A &#x3c;
862
- B</pre>
863
- <p class="FigureTitle" style="text-align:center;">Figure 2</p>
864
- </div>
865
- <div id='figure-C' class='figure'>
866
- <pre>A &#x3c; B</pre>
867
- </div>
868
- </div>
869
- <p>&#160;</p>
870
- </div>
871
- <p><br clear="all" class="section"/></p>
872
- <div class="WordSection3">
873
- <p class="zzSTDTitle1"/>
874
- <aside id='ftn1'>
875
- <p>X</p>
876
- </aside>
877
- </div>
878
- </body>
879
- </html>
880
- OUTPUT
881
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
882
- .convert("test", input, true).gsub(/&lt;/, "&#x3c;")))
883
- .to be_equivalent_to xmlpp(presxml)
884
- expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({})
885
- .convert("test", presxml, true)))).to be_equivalent_to xmlpp(html)
886
- FileUtils.rm_rf "spec/assets/odf1.emf"
887
- expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
888
- .convert("test", presxml, true)
889
- .gsub(/['"][^'".]+\.(gif|xml)['"]/, "'_.\\1'")
890
- .gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref"))))
891
- .to be_equivalent_to xmlpp(word)
892
- end
893
-
894
- it "processes SVG" do
895
- input = <<~INPUT
896
- <iso-standard xmlns="http://riboseinc.com/isoxml">
897
- <preface><foreword>
898
- <figure id="figureA-1">
899
- <image src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICA8Y2lyY2xlIGZpbGw9IiMwMDkiIHI9IjQ1IiBjeD0iNTAiIGN5PSI1MCIvPgogIDxwYXRoIGQ9Ik0zMywyNkg3OEEzNywzNywwLDAsMSwzMyw4M1Y1N0g1OVY0M0gzM1oiIGZpbGw9IiNGRkYiLz4KPC9zdmc+Cg==" id="_d3731866-1a07-435a-a6c2-1acd41023a4e" mimetype="image/svg+xml" height="auto" width="auto"/>
900
- </figure>
901
- </foreword></preface>
902
- </iso-standard>
903
- INPUT
904
-
905
- presxml = <<~OUTPUT
906
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
907
- <preface>
908
- <foreword displayorder="1">
909
- <figure id='figureA-1'>
910
- <name>Figure 1</name>
911
- <image id='_d3731866-1a07-435a-a6c2-1acd41023a4e' src='' mimetype='image/svg+xml' height='auto' width='auto'>
912
- <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
913
- <circle fill='#009' r='45' cx='50' cy='50'/>
914
- <path d='M33,26H78A37,37,0,0,1,33,83V57H59V43H33Z' fill='#FFF'/>
915
- </svg>
916
- <emf src='data:application/x-msmetafile;base64,AQAAAPgAAAAAAAAAAAAAAPsEAAD7BAAAAAAAAAAAAACLCgAAiwoAACBFTUYAAAEAVAQAACgAAAACAAAARgAAAGwAAAAAAAAA3ScAAH0zAADYAAAAFwEAAAAAAAAAAAAAAAAAAMBLAwDYQQQASQBuAGsAcwBjAGEAcABlACAAMQAuADEAIAAoAGMANABlADgAZgA5AGUALAAgADIAMAAyADEALQAwADUALQAyADQAKQAgAAAAaQBtAGEAZwBlADIAMAAyADEAMAA5ADIANQAtADMANQAzADAAOAAtADEAaAA2AG8AeABmAGYALgBlAG0AZgAAAAAAAAARAAAADAAAAAEAAAAkAAAAJAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAIAAABGAAAALAAAACAAAABTY3JlZW49MTAyMDV4MTMxODFweCwgMjE2eDI3OW1tAEYAAAAwAAAAIwAAAERyYXdpbmc9MTAwLjB4MTAwLjBweCwgMjYuNXgyNi41bW0AABIAAAAMAAAAAQAAABMAAAAMAAAAAgAAABYAAAAMAAAAGAAAABgAAAAMAAAAAAAAABQAAAAMAAAADQAAACcAAAAYAAAAAQAAAAAAAAAAAJkABgAAACUAAAAMAAAAAQAAADsAAAAIAAAAGwAAABAAAACkBAAAcQIAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACkBAAAqAMAAKgDAACkBAAAcQIAAKQEAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAOgEAAKQEAAA/AAAAqAMAAD8AAABxAgAABQAAADQAAAAAAAAAAAAAAP//////////AwAAAD8AAAA6AQAAOgEAAD8AAABxAgAAPwAAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACoAwAAPwAAAKQEAAA6AQAApAQAAHECAAA9AAAACAAAADwAAAAIAAAAPgAAABgAAAAAAAAAAAAAAP//////////JQAAAAwAAAAFAACAKAAAAAwAAAABAAAAJwAAABgAAAABAAAAAAAAAP///wAGAAAAJQAAAAwAAAABAAAAOwAAAAgAAAAbAAAAEAAAAJ0BAABFAQAANgAAABAAAADPAwAARQEAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAABfBAAA7QEAAGQEAADjAgAA2wMAAJEDAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAUgMAAD4EAABhAgAAcwQAAJ0BAAAOBAAANgAAABAAAACdAQAAyQIAADYAAAAQAAAA4gIAAMkCAAA2AAAAEAAAAOICAAAaAgAANgAAABAAAACdAQAAGgIAAD0AAAAIAAAAPAAAAAgAAAA+AAAAGAAAAAAAAAAAAAAA//////////8lAAAADAAAAAUAAIAoAAAADAAAAAEAAAAOAAAAFAAAAAAAAAAAAAAAVAQAAA=='/>
917
- </image>
918
- </figure>
919
- </foreword>
920
- </preface>
921
- </iso-standard>
922
- OUTPUT
923
-
924
- html = <<~HTML
925
- #{HTML_HDR}
926
- <br/>
927
- <div>
928
- <h1 class='ForewordTitle'>Foreword</h1>
929
- <div id='figureA-1' class='figure'>
930
- <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
931
- <circle fill='#009' r='45' cx='50' cy='50'/>
932
- <path d='M33,26H78A37,37,0,0,1,33,83V57H59V43H33Z' fill='#FFF'/>
933
- </svg>
934
- <p class='FigureTitle' style='text-align:center;'>Figure 1</p>
935
- </div>
936
- </div>
937
- <p class='zzSTDTitle1'/>
938
- </div>
939
- </body>
940
- </html>
941
- HTML
942
-
943
- doc = <<~DOC
944
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
945
- <head>
946
- <style>
947
- </style>
948
- </head>
949
- <body lang='EN-US' link='blue' vlink='#954F72'>
950
- <div class='WordSection1'>
951
- <p>&#160;</p>
952
- </div>
953
- <p>
954
- <br clear='all' class='section'/>
955
- </p>
956
- <div class='WordSection2'>
957
- <p>
958
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
959
- </p>
960
- <div>
961
- <h1 class='ForewordTitle'>Foreword</h1>
962
- <div id='figureA-1' class='figure'>
963
- <img src='_.emf' height='auto' width='auto'/>
964
- <p class='FigureTitle' style='text-align:center;'>Figure 1</p>
965
- </div>
966
- </div>
967
- <p>&#160;</p>
968
- </div>
969
- <p>
970
- <br clear='all' class='section'/>
971
- </p>
972
- <div class='WordSection3'>
973
- <p class='zzSTDTitle1'/>
974
- </div>
975
- </body>
976
- </html>
977
- DOC
978
-
979
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
980
- .convert("test", input, true)
981
- .gsub(/&lt;/, "&#x3c;")
982
- .gsub(%r{data:application/x-msmetafile[^"']+},
983
- "data:application/x-msmetafile")))
984
- .to be_equivalent_to xmlpp(presxml
985
- .gsub(%r{data:application/x-msmetafile[^"']+},
986
- "data:application/x-msmetafile"))
987
- expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({})
988
- .convert("test", presxml, true)))).to be_equivalent_to xmlpp(html)
989
- expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
990
- .convert("test", presxml, true)
991
- .gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.emf['"]/, "'_.emf'")
992
- .gsub(/['"][^'".]+\.(gif|xml)['"]/, "'_.\\1'"))))
993
- .to be_equivalent_to xmlpp(doc)
994
- end
995
-
996
- it "converts SVG (Word)" do
997
- FileUtils.rm_rf "spec/assets/odf1.emf"
998
- input = <<~INPUT
999
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1000
- <preface><foreword>
1001
- <figure id="figureA-1">
1002
- <image src="spec/assets/odf.svg" mimetype="image/svg+xml"/>
1003
- <image src="spec/assets/odf1.svg" mimetype="image/svg+xml"/>
1004
- <image src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICA8Y2lyY2xlIGZpbGw9IiMwMDkiIHI9IjQ1IiBjeD0iNTAiIGN5PSI1MCIvPgogIDxwYXRoIGQ9Ik0zMywyNkg3OEEzNywzNywwLDAsMSwzMyw4M1Y1N0g1OVY0M0gzM1oiIGZpbGw9IiNGRkYiLz4KPC9zdmc+Cg==" id="_d3731866-1a07-435a-a6c2-1acd41023a4e" mimetype="image/svg+xml" height="auto" width="auto"/>
1005
- <image src="data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9Ii4uLy4uLy4uL3hzbC9yZXNfZG9jL2ltZ2ZpbGUueHNsIj8+CjwhRE9DVFlQRSBpbWdmaWxlLmNvbnRlbnQgU1lTVEVNICIuLi8uLi8uLi9kdGQvdGV4dC5lbnQiPgo8aW1nZmlsZS5jb250ZW50IG1vZHVsZT0iZnVuZGFtZW50YWxzX29mX3Byb2R1Y3RfZGVzY3JpcHRpb25fYW5kX3N1cHBvcnQiIGZpbGU9ImFjdGlvbl9zY2hlbWFleHBnMS54bWwiPgo8aW1nIHNyYz0iYWN0aW9uX3NjaGVtYWV4cGcxLmdpZiI+CjxpbWcuYXJlYSBzaGFwZT0icmVjdCIgY29vcmRzPSIyMTAsMTg2LDM0MywyMjciIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9iYXNpY19hdHRyaWJ1dGVfc2NoZW1hL2Jhc2ljX2F0dHJpYnV0ZV9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMTAsMTAsOTYsNTEiIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9hY3Rpb25fc2NoZW1hL2FjdGlvbl9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMjEwLDI2NCwzNTgsMzA1IiBocmVmPSIuLi8uLi9yZXNvdXJjZXMvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEueG1sIiAvPgo8L2ltZz4KPC9pbWdmaWxlLmNvbnRlbnQ+Cg==" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="application/xml"/>
1006
- </figure>
1007
- </foreword></preface>
1008
- </iso-standard>
1009
- INPUT
1010
- presxml = <<~OUTPUT
1011
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1012
- <preface>
1013
- <foreword displayorder='1'>
1014
- <figure id='figureA-1'>
1015
- <name>Figure 1</name>
1016
- <image src='spec/assets/odf.svg' mimetype='image/svg+xml'>
1017
- <emf src='spec/assets/odf.emf'/>
1018
- </image>
1019
- <image src='spec/assets/odf1.svg' mimetype='image/svg+xml'>
1020
- <emf src='data:application/x-msmetafile;base64,AQAAAMwAAAAAAAAAAAAAAPsEAAD7BAAAAAAAAAAAAACLCgAAiwoAACBFTUYAAAEAKAQAACgAAAACAAAALwAAAGwAAAAAAAAA3ScAAH0zAADYAAAAFwEAAAAAAAAAAAAAAAAAAMBLAwDYQQQASQBuAGsAcwBjAGEAcABlACAAMQAuADEAIAAoAGMANABlADgAZgA5AGUALAAgADIAMAAyADEALQAwADUALQAyADQAKQAgAAAAbwBkAGYAMQAuAGUAbQBmAAAAAAAAAAAAEQAAAAwAAAABAAAAJAAAACQAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAACAAAARgAAACwAAAAgAAAAU2NyZWVuPTEwMjA1eDEzMTgxcHgsIDIxNngyNzltbQBGAAAAMAAAACMAAABEcmF3aW5nPTEwMC4weDEwMC4wcHgsIDI2LjV4MjYuNW1tAAASAAAADAAAAAEAAAATAAAADAAAAAIAAAAWAAAADAAAABgAAAAYAAAADAAAAAAAAAAUAAAADAAAAA0AAAAnAAAAGAAAAAEAAAAAAAAAAACZAAYAAAAlAAAADAAAAAEAAAA7AAAACAAAABsAAAAQAAAApAQAAHECAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAApAQAAKgDAACoAwAApAQAAHECAACkBAAABQAAADQAAAAAAAAAAAAAAP//////////AwAAADoBAACkBAAAPwAAAKgDAAA/AAAAcQIAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAAA/AAAAOgEAADoBAAA/AAAAcQIAAD8AAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAqAMAAD8AAACkBAAAOgEAAKQEAABxAgAAPQAAAAgAAAA8AAAACAAAAD4AAAAYAAAAAAAAAAAAAAD//////////yUAAAAMAAAABQAAgCgAAAAMAAAAAQAAACcAAAAYAAAAAQAAAAAAAAD///8ABgAAACUAAAAMAAAAAQAAADsAAAAIAAAAGwAAABAAAACdAQAARQEAADYAAAAQAAAAzwMAAEUBAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAXwQAAO0BAABkBAAA4wIAANsDAACRAwAABQAAADQAAAAAAAAAAAAAAP//////////AwAAAFIDAAA+BAAAYQIAAHMEAACdAQAADgQAADYAAAAQAAAAnQEAAMkCAAA2AAAAEAAAAOICAADJAgAANgAAABAAAADiAgAAGgIAADYAAAAQAAAAnQEAABoCAAA9AAAACAAAADwAAAAIAAAAPgAAABgAAAAAAAAAAAAAAP//////////JQAAAAwAAAAFAACAKAAAAAwAAAABAAAADgAAABQAAAAAAAAAAAAAACgEAAA='/>
1021
- </image>
1022
- <image src='' id='_d3731866-1a07-435a-a6c2-1acd41023a4e' mimetype='image/svg+xml' height='auto' width='auto'>
1023
- <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
1024
- <circle fill='#009' r='45' cx='50' cy='50'/>
1025
- <path d='M33,26H78A37,37,0,0,1,33,83V57H59V43H33Z' fill='#FFF'/>
1026
- </svg>
1027
- <emf src='data:application/x-msmetafile;base64,AQAAAPgAAAAAAAAAAAAAAPsEAAD7BAAAAAAAAAAAAACLCgAAiwoAACBFTUYAAAEAVAQAACgAAAACAAAARQAAAGwAAAAAAAAA3ScAAH0zAADYAAAAFwEAAAAAAAAAAAAAAAAAAMBLAwDYQQQASQBuAGsAcwBjAGEAcABlACAAMQAuADEAIAAoAGMANABlADgAZgA5AGUALAAgADIAMAAyADEALQAwADUALQAyADQAKQAgAAAAaQBtAGEAZwBlADIAMAAyADEAMAA5ADIANQAtADMANAA4ADgANQAtAHkAeQA0ADkANQA2AC4AZQBtAGYAAAAAAAAAAAARAAAADAAAAAEAAAAkAAAAJAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAIAAABGAAAALAAAACAAAABTY3JlZW49MTAyMDV4MTMxODFweCwgMjE2eDI3OW1tAEYAAAAwAAAAIwAAAERyYXdpbmc9MTAwLjB4MTAwLjBweCwgMjYuNXgyNi41bW0AABIAAAAMAAAAAQAAABMAAAAMAAAAAgAAABYAAAAMAAAAGAAAABgAAAAMAAAAAAAAABQAAAAMAAAADQAAACcAAAAYAAAAAQAAAAAAAAAAAJkABgAAACUAAAAMAAAAAQAAADsAAAAIAAAAGwAAABAAAACkBAAAcQIAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACkBAAAqAMAAKgDAACkBAAAcQIAAKQEAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAOgEAAKQEAAA/AAAAqAMAAD8AAABxAgAABQAAADQAAAAAAAAAAAAAAP//////////AwAAAD8AAAA6AQAAOgEAAD8AAABxAgAAPwAAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACoAwAAPwAAAKQEAAA6AQAApAQAAHECAAA9AAAACAAAADwAAAAIAAAAPgAAABgAAAAAAAAAAAAAAP//////////JQAAAAwAAAAFAACAKAAAAAwAAAABAAAAJwAAABgAAAABAAAAAAAAAP///wAGAAAAJQAAAAwAAAABAAAAOwAAAAgAAAAbAAAAEAAAAJ0BAABFAQAANgAAABAAAADPAwAARQEAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAABfBAAA7QEAAGQEAADjAgAA2wMAAJEDAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAUgMAAD4EAABhAgAAcwQAAJ0BAAAOBAAANgAAABAAAACdAQAAyQIAADYAAAAQAAAA4gIAAMkCAAA2AAAAEAAAAOICAAAaAgAANgAAABAAAACdAQAAGgIAAD0AAAAIAAAAPAAAAAgAAAA+AAAAGAAAAAAAAAAAAAAA//////////8lAAAADAAAAAUAAIAoAAAADAAAAAEAAAAOAAAAFAAAAAAAAAAAAAAAVAQAAA=='/>
1028
- </image>
1029
- <image src='data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9Ii4uLy4uLy4uL3hzbC9yZXNfZG9jL2ltZ2ZpbGUueHNsIj8+CjwhRE9DVFlQRSBpbWdmaWxlLmNvbnRlbnQgU1lTVEVNICIuLi8uLi8uLi9kdGQvdGV4dC5lbnQiPgo8aW1nZmlsZS5jb250ZW50IG1vZHVsZT0iZnVuZGFtZW50YWxzX29mX3Byb2R1Y3RfZGVzY3JpcHRpb25fYW5kX3N1cHBvcnQiIGZpbGU9ImFjdGlvbl9zY2hlbWFleHBnMS54bWwiPgo8aW1nIHNyYz0iYWN0aW9uX3NjaGVtYWV4cGcxLmdpZiI+CjxpbWcuYXJlYSBzaGFwZT0icmVjdCIgY29vcmRzPSIyMTAsMTg2LDM0MywyMjciIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9iYXNpY19hdHRyaWJ1dGVfc2NoZW1hL2Jhc2ljX2F0dHJpYnV0ZV9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMTAsMTAsOTYsNTEiIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9hY3Rpb25fc2NoZW1hL2FjdGlvbl9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMjEwLDI2NCwzNTgsMzA1IiBocmVmPSIuLi8uLi9yZXNvdXJjZXMvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEueG1sIiAvPgo8L2ltZz4KPC9pbWdmaWxlLmNvbnRlbnQ+Cg==' height='20' width='auto' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f2' mimetype='application/xml'/>
1030
- </figure>
1031
- </foreword>
1032
- </preface>
1033
- </iso-standard>
1034
- OUTPUT
1035
- output = <<~OUTPUT
1036
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
1037
- <head>
1038
- <style>
1039
- </style>
1040
- </head>
1041
- <body lang='EN-US' link='blue' vlink='#954F72'>
1042
- <div class='WordSection1'>
1043
- <p>&#160;</p>
1044
- </div>
1045
- <p>
1046
- <br clear='all' class='section'/>
1047
- </p>
1048
- <div class='WordSection2'>
1049
- <p>
1050
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1051
- </p>
1052
- <div>
1053
- <h1 class='ForewordTitle'>Foreword</h1>
1054
- <div id='figureA-1' class='figure'>
1055
- <img src='spec/assets/odf.emf'/>
1056
- <img src='_.emf'/>
1057
- <img src='_.emf' height='auto' width='auto'/>
1058
- <img src='_.xml' height='20' width='auto'/>
1059
- <p class='FigureTitle' style='text-align:center;'>Figure 1</p>
1060
- </div>
1061
- </div>
1062
- <p>&#160;</p>
1063
- </div>
1064
- <p>
1065
- <br clear='all' class='section'/>
1066
- </p>
1067
- <div class='WordSection3'>
1068
- <p class='zzSTDTitle1'/>
1069
- </div>
1070
- </body>
1071
- </html>
1072
- OUTPUT
1073
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1074
- .convert("test", input, true)
1075
- .gsub(/&lt;/, "&#x3c;")
1076
- .gsub(%r{data:application/x-msmetafile[^"']+},
1077
- "data:application/x-msmetafile")))
1078
- .to be_equivalent_to xmlpp(presxml
1079
- .gsub(%r{data:application/x-msmetafile[^"']+},
1080
- "data:application/x-msmetafile"))
1081
- expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
1082
- .convert("test", presxml, true)
1083
- .gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.emf['"]/, "'_.emf'")
1084
- .gsub(/['"][^'".]+\.(gif|xml)['"]/, "'_.\\1'")
1085
- .gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref"))))
1086
- .to be_equivalent_to xmlpp(output)
1087
- end
1088
-
1089
- context "disable inkscape" do
1090
- it "converts SVG (Word) with inkscape disabled" do
1091
- FileUtils.rm_rf "spec/assets/odf1.emf"
1092
- allow(IsoDoc::PresentationXMLConvert)
1093
- .to receive(:inkscape_installed?).and_return(nil)
1094
- allow_any_instance_of(IsoDoc::PresentationXMLConvert)
1095
- .to receive(:inkscape_installed?)
1096
-
1097
- input = <<~INPUT
1098
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1099
- <preface>
1100
- <foreword>
1101
- <figure id="figureA-1">
1102
- <image src="spec/assets/odf.svg" mimetype="image/svg+xml"/>
1103
- <image src="spec/assets/odf1.svg" mimetype="image/svg+xml"/>
1104
- <image src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICA8Y2lyY2xlIGZpbGw9IiMwMDkiIHI9IjQ1IiBjeD0iNTAiIGN5PSI1MCIvPgogIDxwYXRoIGQ9Ik0zMywyNkg3OEEzNywzNywwLDAsMSwzMyw4M1Y1N0g1OVY0M0gzM1oiIGZpbGw9IiNGRkYiLz4KPC9zdmc+Cg==" id="_d3731866-1a07-435a-a6c2-1acd41023a4e" mimetype="image/svg+xml" height="auto" width="auto"/>
1105
- </figure>
1106
- </foreword>
1107
- </preface>
1108
- </iso-standard>
1109
- INPUT
1110
- expect do
1111
- IsoDoc::PresentationXMLConvert.new({})
1112
- .convert("test", input, true)
1113
- end.to raise_error("Inkscape missing in PATH, unable" \
1114
- "to convert EMF to SVG. Aborting.")
1115
- end
1116
- end
1117
-
1118
- it "processes examples" do
1119
- input = <<~INPUT
1120
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1121
- <preface><foreword>
1122
- <example id="samplecode" keep-with-next="true" keep-lines-together="true">
1123
- <name>Title</name>
1124
- <p>Hello</p>
1125
- <sourcecode id="X">
1126
- <name>Sample</name>
1127
- </sourcecode>
1128
- </example>
1129
- </foreword></preface>
1130
- </iso-standard>
1131
- INPUT
1132
- presxml = <<~OUTPUT
1133
- <?xml version='1.0'?>
1134
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1135
- <preface>
1136
- <foreword displayorder="1">
1137
- <example id='samplecode' keep-with-next='true' keep-lines-together='true'>
1138
- <name>EXAMPLE&#xA0;&#x2014; Title</name>
1139
- <p>Hello</p>
1140
- <sourcecode id='X'>
1141
- <name>Sample</name>
1142
- </sourcecode>
1143
- </example>
1144
- </foreword>
1145
- </preface>
1146
- </iso-standard>
1147
- OUTPUT
1148
-
1149
- html = <<~OUTPUT
1150
- #{HTML_HDR}
1151
- <br/>
1152
- <div>
1153
- <h1 class="ForewordTitle">Foreword</h1>
1154
- <div id="samplecode" class="example" style="page-break-after: avoid;page-break-inside: avoid;">
1155
- <p class="example-title">EXAMPLE&#160;&#8212; Title</p>
1156
- <p>Hello</p>
1157
- <pre id='X' class='prettyprint '>
1158
- <br/>
1159
- &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
1160
- <br/>
1161
- &#160;&#160;&#160;&#160;&#160;&#160;&#160;
1162
- </pre>
1163
- <p class='SourceTitle' style='text-align:center;'>Sample</p>
1164
- </div>
1165
- </div>
1166
- <p class="zzSTDTitle1"/>
1167
- </div>
1168
- </body>
1169
- </html>
1170
- OUTPUT
1171
- doc = <<~OUTPUT
1172
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'><head><style>
1173
- </style>
1174
- </head>
1175
- <body lang='EN-US' link='blue' vlink='#954F72'>
1176
- <div class='WordSection1'>
1177
- <p>&#160;</p>
1178
- </div>
1179
- <p>
1180
- <br clear='all' class='section'/>
1181
- </p>
1182
- <div class='WordSection2'>
1183
- <p>
1184
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1185
- </p>
1186
- <div>
1187
- <h1 class='ForewordTitle'>Foreword</h1>
1188
- <div id='samplecode' class='example' style='page-break-after: avoid;page-break-inside: avoid;'>
1189
- <p class='example-title'>EXAMPLE&#160;&#8212; Title</p>
1190
- <p>Hello</p>
1191
- <p id='X' class='Sourcecode'>
1192
- <br/>
1193
- &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
1194
- <br/>
1195
- &#160;&#160;&#160;&#160;&#160;&#160;&#160;
1196
- </p>
1197
- <p class='SourceTitle' style='text-align:center;'>Sample</p>
1198
- </div>
1199
- </div>
1200
- <p>&#160;</p>
1201
- </div>
1202
- <p>
1203
- <br clear='all' class='section'/>
1204
- </p>
1205
- <div class='WordSection3'>
1206
- <p class='zzSTDTitle1'/>
1207
- </div>
1208
- </body>
1209
- </html>
1210
- OUTPUT
1211
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1212
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1213
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
1214
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1215
- expect(xmlpp(IsoDoc::WordConvert.new({})
1216
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(doc)
1217
- end
1218
-
1219
- it "processes sequences of examples" do
1220
- input = <<~INPUT
1221
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1222
- <preface><foreword>
1223
- <example id="samplecode">
1224
- <p>Hello</p>
1225
- </example>
1226
- <example id="samplecode2">
1227
- <name>Title</name>
1228
- <p>Hello</p>
1229
- </example>
1230
- <example id="samplecode3" unnumbered="true">
1231
- <p>Hello</p>
1232
- </example>
1233
- </foreword></preface>
1234
- </iso-standard>
1235
- INPUT
1236
- output = <<~OUTPUT
1237
- <?xml version='1.0'?>
1238
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1239
- <preface>
1240
- <foreword displayorder="1">
1241
- <example id='samplecode'>
1242
- <name>EXAMPLE 1</name>
1243
- <p>Hello</p>
1244
- </example>
1245
- <example id='samplecode2'>
1246
- <name>EXAMPLE 2&#xA0;&#x2014; Title</name>
1247
- <p>Hello</p>
1248
- </example>
1249
- <example id='samplecode3' unnumbered='true'>
1250
- <name>EXAMPLE</name>
1251
- <p>Hello</p>
1252
- </example>
1253
- </foreword>
1254
- </preface>
1255
- </iso-standard>
1256
- OUTPUT
1257
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1258
- .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1259
- end
1260
-
1261
- it "processes sourcecode" do
1262
- input = <<~INPUT
1263
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1264
- <preface><foreword>
1265
- <sourcecode lang="ruby" id="samplecode">
1266
- <name>Ruby <em>code</em></name>
1267
- puts x
1268
- </sourcecode>
1269
- <sourcecode unnumbered="true">
1270
- Que?
1271
- </sourcecode>
1272
- </foreword></preface>
1273
- </iso-standard>
1274
- INPUT
1275
- presxml = <<~OUTPUT
1276
- <?xml version='1.0'?>
1277
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1278
- <preface>
1279
- <foreword displayorder="1">
1280
- <sourcecode lang='ruby' id='samplecode'>
1281
- <name>
1282
- Figure 1&#xA0;&#x2014; Ruby
1283
- <em>code</em>
1284
- </name>
1285
- puts x
1286
- </sourcecode>
1287
- <sourcecode unnumbered='true'> Que? </sourcecode>
1288
- </foreword>
1289
- </preface>
1290
- </iso-standard>
1291
- OUTPUT
1292
-
1293
- html = <<~OUTPUT
1294
- #{HTML_HDR}
1295
- <br/>
1296
- <div>
1297
- <h1 class="ForewordTitle">Foreword</h1>
1298
- <pre id="samplecode" class="prettyprint lang-rb"><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; puts x<br/>&#160;&#160;&#160;&#160;&#160;</pre>
1299
- <p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p>
1300
- <pre class='prettyprint '> Que? </pre>
1301
- </div>
1302
- <p class="zzSTDTitle1"/>
1303
- </div>
1304
- </body>
1305
- </html>
1306
- OUTPUT
1307
-
1308
- doc = <<~OUTPUT
1309
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
1310
- <head><style/></head>
1311
- <body lang="EN-US" link="blue" vlink="#954F72">
1312
- <div class="WordSection1">
1313
- <p>&#160;</p>
1314
- </div>
1315
- <p>
1316
- <br clear="all" class="section"/>
1317
- </p>
1318
- <div class="WordSection2">
1319
- <p>
1320
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
1321
- </p>
1322
- <div>
1323
- <h1 class="ForewordTitle">Foreword</h1>
1324
- <p id="samplecode" class="Sourcecode"><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; puts x<br/>&#160;&#160;&#160;&#160;&#160; </p><p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p>
1325
- <p class='Sourcecode'> Que? </p>
1326
- </div>
1327
- <p>&#160;</p>
1328
- </div>
1329
- <p>
1330
- <br clear="all" class="section"/>
1331
- </p>
1332
- <div class="WordSection3">
1333
- <p class="zzSTDTitle1"/>
1334
- </div>
1335
- </body>
1336
- </html>
1337
- OUTPUT
1338
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1339
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1340
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
1341
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1342
- expect(xmlpp(IsoDoc::WordConvert.new({})
1343
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(doc)
1344
- end
1345
-
1346
- it "processes sourcecode with escapes preserved" do
1347
- input = <<~INPUT
1348
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1349
- <preface><foreword>
1350
- <sourcecode id="samplecode">
1351
- <name>XML code</name>
1352
- &lt;xml&gt;
1353
- </sourcecode>
1354
- </foreword></preface>
1355
- </iso-standard>
1356
- INPUT
1357
- output = <<~OUTPUT
1358
- #{HTML_HDR}
1359
- <br/>
1360
- <div>
1361
- <h1 class="ForewordTitle">Foreword</h1>
1362
- <pre id="samplecode" class="prettyprint "><br/>&#160;&#160;&#160; <br/>&#160; &lt;xml&gt;<br/></pre>
1363
- <p class="SourceTitle" style="text-align:center;">XML code</p>
1364
- </div>
1365
- <p class="zzSTDTitle1"/>
1366
- </div>
1367
- </body>
1368
- </html>
1369
- OUTPUT
1370
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
1371
- .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1372
- end
1373
-
1374
- it "processes sourcecode with annotations" do
1375
- input = <<~INPUT
1376
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1377
- <preface><foreword>
1378
- <sourcecode id="_">puts "Hello, world." <callout target="A">1</callout>
1379
- %w{a b c}.each do |x|
1380
- puts x <callout target="B">2</callout>
1381
- end<annotation id="A">
1382
- <p id="_">This is <em>one</em> callout</p>
1383
- </annotation><annotation id="B">
1384
- <p id="_">This is another callout</p>
1385
- </annotation></sourcecode>
1386
- </foreword></preface>
1387
- </iso-standard>
1388
- INPUT
1389
- output = <<~OUTPUT
1390
- #{HTML_HDR}
1391
- <br/>
1392
- <div>
1393
- <h1 class="ForewordTitle">Foreword</h1>
1394
- <pre id="_" class="prettyprint ">puts "Hello, world." &lt;1&gt;<br/>&#160;&#160; %w{a b c}.each do |x|<br/>&#160;&#160;&#160;&#160; puts x &lt;2&gt;<br/>&#160;&#160; end<br/><br/>&lt;1&gt; This is one callout<br/>&lt;2&gt; This is another callout</pre>
1395
- </div>
1396
- <p class="zzSTDTitle1"/>
1397
- </div>
1398
- </body>
1399
- </html>
1400
- OUTPUT
1401
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
1402
- .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1403
- end
1404
-
1405
- it "processes admonitions" do
1406
- input = <<~INPUT
1407
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1408
- <preface><foreword>
1409
- <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution" keep-with-next="true" keep-lines-together="true">
1410
- <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
1411
- </admonition>
1412
- <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6b" type="caution" keep-with-next="true" keep-lines-together="true" notag="true">
1413
- <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
1414
- </admonition>
1415
- </foreword></preface>
1416
- </iso-standard>
1417
- INPUT
1418
- presxml = <<~INPUT
1419
- <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
1420
- <preface><foreword displayorder="1">
1421
- <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution" keep-with-next="true" keep-lines-together="true">
1422
- <name>CAUTION</name>
1423
- <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
1424
- </admonition>
1425
- <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6b" type="caution" keep-with-next="true" keep-lines-together="true" notag="true">
1426
- <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
1427
- </admonition>
1428
- </foreword></preface>
1429
- </iso-standard>
1430
- INPUT
1431
- output = <<~OUTPUT
1432
- #{HTML_HDR}
1433
- <br/>
1434
- <div>
1435
- <h1 class="ForewordTitle">Foreword</h1>
1436
- <div class="Admonition" id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' style='page-break-after: avoid;page-break-inside: avoid;'><p class="AdmonitionTitle" style="text-align:center;">CAUTION</p>
1437
- <p id='_e94663cc-2473-4ccc-9a72-983a74d989f2'>Only use paddy or parboiled rice for the determination of husked rice yield.</p>
1438
- </div>
1439
- <div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6b' class='Admonition' style='page-break-after: avoid;page-break-inside: avoid;'>
1440
- <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
1441
- </div>
1442
- </div>
1443
- <p class="zzSTDTitle1"/>
1444
- </div>
1445
- </body>
1446
- </html>
1447
- OUTPUT
1448
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1449
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1450
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
1451
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
1452
- end
1453
-
1454
- it "processes admonitions with titles" do
1455
- input = <<~INPUT
1456
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1457
- <preface><foreword>
1458
- <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution">
1459
- <name>Title</name>
1460
- <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
1461
- </admonition>
1462
- <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6b" type="caution" notag="true">
1463
- <name>Title</name>
1464
- <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
1465
- </admonition>
1466
- </foreword></preface>
1467
- </iso-standard>
1468
- INPUT
1469
- presxml = <<~INPUT
1470
- <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
1471
- <preface><foreword displayorder="1">
1472
- <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution">
1473
- <name>Title</name>
1474
- <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
1475
- </admonition>
1476
- <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6b" type="caution" notag="true">
1477
- <name>Title</name>
1478
- <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
1479
- </admonition>
1480
- </foreword></preface>
1481
- </iso-standard>
1482
- INPUT
1483
- output = <<~OUTPUT
1484
- #{HTML_HDR}
1485
- <br/>
1486
- <div>
1487
- <h1 class="ForewordTitle">Foreword</h1>
1488
- <div class="Admonition" id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a">
1489
- <p class='AdmonitionTitle' style='text-align:center;'>Title</p>
1490
- <p id='_e94663cc-2473-4ccc-9a72-983a74d989f2'>Only use paddy or parboiled rice for the determination of husked rice yield.</p>
1491
- </div>
1492
- <div id='_70234f78-64e5-4dfc-8b6f-f3f037348b6b' class='Admonition'>
1493
- <p class='AdmonitionTitle' style='text-align:center;'>Title</p>
1494
- <p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
1495
- </div>
1496
- </div>
1497
- <p class="zzSTDTitle1"/>
1498
- </div>
1499
- </body>
1500
- </html>
1501
- OUTPUT
1502
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1503
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1504
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
1505
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
1506
- end
1507
-
1508
- it "processes formulae" do
1509
- input = <<~INPUT
1510
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1511
- <preface><foreword>
1512
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true" keep-with-next="true" keep-lines-together="true">
1513
- <stem type="AsciiMath">r = 1 %</stem>
1514
- <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
1515
- <dt>
1516
- <stem type="AsciiMath">r</stem>
1517
- </dt>
1518
- <dd>
1519
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
1520
- </dd>
1521
- </dl>
1522
- <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
1523
- <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p>
1524
- </note>
1525
- </formula>
1526
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
1527
- <stem type="AsciiMath">r = 1 %</stem>
1528
- </formula>
1529
- </foreword></preface>
1530
- </iso-standard>
1531
- INPUT
1532
- presxml = <<~INPUT
1533
- <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
1534
- <preface><foreword displayorder="1">
1535
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true" keep-with-next="true" keep-lines-together="true">
1536
- <stem type="AsciiMath">r = 1 %</stem>
1537
- <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
1538
- <dt>
1539
- <stem type="AsciiMath">r</stem>
1540
- </dt>
1541
- <dd>
1542
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
1543
- </dd>
1544
- </dl>
1545
- <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
1546
- <name>NOTE</name>
1547
- <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p>
1548
- </note>
1549
- </formula>
1550
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935"><name>1</name>
1551
- <stem type="AsciiMath">r = 1 %</stem>
1552
- </formula>
1553
- </foreword></preface>
1554
- </iso-standard>
1555
- INPUT
1556
- html = <<~OUTPUT
1557
- #{HTML_HDR}
1558
- <br/>
1559
- <div>
1560
- <h1 class="ForewordTitle">Foreword</h1>
1561
- <div id="_be9158af-7e93-4ee2-90c5-26d31c181934" style='page-break-after: avoid;page-break-inside: avoid;'><div class="formula"><p><span class="stem">(#(r = 1 %)#)</span></p></div><p style='page-break-after:avoid;'>where</p><dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d" class="formula_dl"><dt>
1562
- <span class="stem">(#(r)#)</span>
1563
- </dt><dd>
1564
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
1565
- </dd></dl>
1566
-
1567
-
1568
- <div id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0" class="Note"><p><span class="note_label">NOTE</span>&#160; [durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p></div></div>
1569
-
1570
- <div id="_be9158af-7e93-4ee2-90c5-26d31c181935"><div class="formula"><p><span class="stem">(#(r = 1 %)#)</span>&#160; (1)</p></div></div>
1571
- </div>
1572
- <p class="zzSTDTitle1"/>
1573
- </div>
1574
- </body>
1575
- </html>
1576
- OUTPUT
1577
-
1578
- word = <<~OUTPUT
1579
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
1580
- <head>
1581
- <style>
1582
- </style>
1583
- </head>
1584
- <body lang='EN-US' link='blue' vlink='#954F72'>
1585
- <div class='WordSection1'>
1586
- <p>&#160;</p>
1587
- </div>
1588
- <p>
1589
- <br clear='all' class='section'/>
1590
- </p>
1591
- <div class='WordSection2'>
1592
- <p>
1593
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1594
- </p>
1595
- <div>
1596
- <h1 class='ForewordTitle'>Foreword</h1>
1597
- <div id='_be9158af-7e93-4ee2-90c5-26d31c181934' style='page-break-after: avoid;page-break-inside: avoid;'><div class='formula'>
1598
- <p>
1599
- <span class='stem'>(#(r = 1 %)#)</span>
1600
- <span style='mso-tab-count:1'>&#160; </span>
1601
- </p>
1602
- </div>
1603
- <p>where</p>
1604
- <table class='formula_dl'>
1605
- <tr>
1606
- <td valign='top' align='left'>
1607
- <p align='left' style='margin-left:0pt;text-align:left;'>
1608
- <span class='stem'>(#(r)#)</span>
1609
- </p>
1610
- </td>
1611
- <td valign='top'>
1612
- <p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p>
1613
- </td>
1614
- </tr>
1615
- </table>
1616
- <div id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0' class='Note'>
1617
- <p class='Note'>
1618
- <span class='note_label'>NOTE</span>
1619
- <span style='mso-tab-count:1'>&#160; </span>
1620
- [durationUnits] is essentially a duration statement without the "P"
1621
- prefix. "P" is unnecessary because between "G" and "U" duration is
1622
- always expressed.
1623
- </p>
1624
- </div>
1625
- </div>
1626
- <div id='_be9158af-7e93-4ee2-90c5-26d31c181935'><div class='formula'>
1627
- <p>
1628
- <span class='stem'>(#(r = 1 %)#)</span>
1629
- <span style='mso-tab-count:1'>&#160; </span>
1630
- (1)
1631
- </p>
1632
- </div>
1633
- </div>
1634
- </div>
1635
- <p>&#160;</p>
1636
- </div>
1637
- <p>
1638
- <br clear='all' class='section'/>
1639
- </p>
1640
- <div class='WordSection3'>
1641
- <p class='zzSTDTitle1'/>
1642
- </div>
1643
- </body>
1644
- </html>
1645
- OUTPUT
1646
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1647
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1648
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
1649
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1650
- expect(xmlpp(IsoDoc::WordConvert.new({})
1651
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
1652
- end
1653
-
1654
- it "processes paragraph attributes" do
1655
- input = <<~INPUT
1656
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1657
- <preface><foreword>
1658
- <p align="left" id="_08bfe952-d57f-4150-9c95-5d52098cc2a8">Vache Equipment<br/>
1659
- Fictitious<br/>
1660
- World</p>
1661
- <p align="justify" keep-with-next="true" keep-lines-together="true">Justify</p>
1662
- </foreword></preface>
1663
- </iso-standard>
1664
- INPUT
1665
- html = <<~OUTPUT
1666
- #{HTML_HDR}
1667
- <br/>
1668
- <div>
1669
- <h1 class="ForewordTitle">Foreword</h1>
1670
- <p id="_08bfe952-d57f-4150-9c95-5d52098cc2a8" style="text-align:left;">Vache Equipment<br/>
1671
- Fictitious<br/>
1672
- World
1673
- </p>
1674
- <p style="text-align:justify;page-break-after: avoid;page-break-inside: avoid;">Justify</p>
1675
- </div>
1676
- <p class="zzSTDTitle1"/>
1677
- </div>
1678
- </body>
1679
- </html>
1680
- OUTPUT
1681
-
1682
- word = <<~OUTPUT
1683
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
1684
- <head><style/></head>
1685
- <body lang="EN-US" link="blue" vlink="#954F72">
1686
- <div class="WordSection1">
1687
- <p>&#160;</p>
1688
- </div>
1689
- <p><br clear="all" class="section"/></p>
1690
- <div class="WordSection2">
1691
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
1692
- <div>
1693
- <h1 class="ForewordTitle">Foreword</h1>
1694
- <p id="_08bfe952-d57f-4150-9c95-5d52098cc2a8" align="left" style="text-align:left;">Vache Equipment<br/>
1695
- Fictitious<br/>
1696
- World
1697
- </p>
1698
- <p style="text-align:justify;page-break-after: avoid;page-break-inside: avoid;">Justify</p>
1699
- </div>
1700
- <p>&#160;</p>
1701
- </div>
1702
- <p><br clear="all" class="section"/></p>
1703
- <div class="WordSection3">
1704
- <p class="zzSTDTitle1"/>
1705
- </div>
1706
- </body>
1707
- </html>
1708
- OUTPUT
1709
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
1710
- .convert("test", input, true))).to be_equivalent_to xmlpp(html)
1711
- expect(xmlpp(IsoDoc::WordConvert.new({})
1712
- .convert("test", input, true))).to be_equivalent_to xmlpp(word)
1713
- end
1714
-
1715
- it "processes blockquotes" do
1716
- input = <<~INPUT
1717
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1718
- <preface><foreword>
1719
- <quote id="_044bd364-c832-4b78-8fea-92242402a1d1">
1720
- <source type="inline" bibitemid="ISO7301" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality></source>
1721
- <author>ISO</author>
1722
- <p id="_d4fd0a61-f300-4285-abe6-602707590e53">This International Standard gives the minimum specifications for rice (<em>Oryza sativa</em> L.) which is subject to international trade. It is applicable to the following types: husked rice and milled rice, parboiled or not, intended for direct human consumption. It is neither applicable to other products derived from rice, nor to waxy rice (glutinous rice).</p>
1723
- </quote>
1724
- </foreword></preface>
1725
- </iso-standard>
1726
- INPUT
1727
-
1728
- presxml = <<~INPUT
1729
- <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
1730
- <preface><foreword displayorder="1">
1731
- <quote id="_044bd364-c832-4b78-8fea-92242402a1d1">
1732
- <source type="inline" bibitemid="ISO7301" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 7301:2011, Clause 1</source>
1733
- <author>ISO</author>
1734
- <p id="_d4fd0a61-f300-4285-abe6-602707590e53">This International Standard gives the minimum specifications for rice (<em>Oryza sativa</em> L.) which is subject to international trade. It is applicable to the following types: husked rice and milled rice, parboiled or not, intended for direct human consumption. It is neither applicable to other products derived from rice, nor to waxy rice (glutinous rice).</p>
1735
- </quote>
1736
- </foreword></preface>
1737
- </iso-standard>
1738
- INPUT
1739
- html = <<~OUTPUT
1740
- #{HTML_HDR}
1741
- <br/>
1742
- <div>
1743
- <h1 class="ForewordTitle">Foreword</h1>
1744
- <div class="Quote" id="_044bd364-c832-4b78-8fea-92242402a1d1">
1745
-
1746
-
1747
- <p id="_d4fd0a61-f300-4285-abe6-602707590e53">This International Standard gives the minimum specifications for rice (<i>Oryza sativa</i> L.) which is subject to international trade. It is applicable to the following types: husked rice and milled rice, parboiled or not, intended for direct human consumption. It is neither applicable to other products derived from rice, nor to waxy rice (glutinous rice).</p>
1748
- <p class="QuoteAttribution">&#8212; ISO, ISO 7301:2011, Clause 1</p></div>
1749
- </div>
1750
- <p class="zzSTDTitle1"/>
1751
- </div>
1752
- </body>
1753
- </html>
1754
- OUTPUT
1755
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1756
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1757
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
1758
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1759
- end
1760
-
1761
- it "processes term domains" do
1762
- input = <<~INPUT
1763
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1764
- <sections>
1765
- <terms>
1766
- <term id="_extraneous_matter"><name>1.1.</name><preferred>extraneous matter</preferred><admitted>EM</admitted>
1767
- <domain>rice</domain>
1768
- <definition><p id="_318b3939-be09-46c4-a284-93f9826b981e">organic and inorganic components other than whole or broken kernels</p></definition>
1769
- </term>
1770
- </terms>
1771
- </sections>
1772
- </iso-standard>
1773
- INPUT
1774
- output = <<~OUTPUT
1775
- #{HTML_HDR}
1776
- <p class="zzSTDTitle1"/>
1777
- <div><h1/>
1778
- <p class="TermNum" id="_extraneous_matter">1.1.</p><p class="Terms" style="text-align:left;">extraneous matter</p><p class="AltTerms" style="text-align:left;">EM</p>
1779
-
1780
- <p id="_318b3939-be09-46c4-a284-93f9826b981e">&lt;rice&gt; organic and inorganic components other than whole or broken kernels</p>
1781
- </div>
1782
- </div>
1783
- </body>
1784
- </html>
1785
- OUTPUT
1786
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", input, true)))
1787
- .to be_equivalent_to xmlpp(output)
1788
- end
1789
-
1790
- it "processes permissions" do
1791
- input = <<~INPUT
1792
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1793
- <preface><foreword>
1794
- <permission id="_" keep-with-next="true" keep-lines-together="true">
1795
- <label>/ogc/recommendation/wfs/2</label>
1796
- <inherit>/ss/584/2015/level/1</inherit>
1797
- <inherit><eref type="inline" bibitemid="rfc2616" citeas="RFC 2616">RFC 2616 (HTTP/1.1)</eref></inherit>
1798
- <subject>user</subject>
1799
- <subject>non-user</subject>
1800
- <classification> <tag>control-class</tag> <value>Technical</value> </classification><classification> <tag>priority</tag> <value>P0</value> </classification><classification> <tag>family</tag> <value>System and Communications Protection</value> </classification><classification> <tag>family</tag> <value>System and Communications Protocols</value> </classification>
1801
- <description>
1802
- <p id="_">I recommend <em>this</em>.</p>
1803
- </description>
1804
- <specification exclude="true" type="tabular">
1805
- <p id="_">This is the object of the recommendation:</p>
1806
- <table id="_">
1807
- <tbody>
1808
- <tr>
1809
- <td style="text-align:left;">Object</td>
1810
- <td style="text-align:left;">Value</td>
1811
- </tr>
1812
- <tr>
1813
- <td style="text-align:left;">Mission</td>
1814
- <td style="text-align:left;">Accomplished</td>
1815
- </tr>
1816
- </tbody>
1817
- </table>
1818
- </specification>
1819
- <description>
1820
- <p id="_">As for the measurement targets,</p>
1821
- </description>
1822
- <measurement-target exclude="false">
1823
- <p id="_">The measurement target shall be measured as:</p>
1824
- <formula id="_">
1825
- <stem type="AsciiMath">r/1 = 0</stem>
1826
- </formula>
1827
- </measurement-target>
1828
- <verification exclude="false">
1829
- <p id="_">The following code will be run for verification:</p>
1830
- <sourcecode id="_">CoreRoot(success): HttpResponse
1831
- if (success)
1832
- recommendation(label: success-response)
1833
- end
1834
- </sourcecode>
1835
- </verification>
1836
- <import exclude="true">
1837
- <sourcecode id="_">success-response()</sourcecode>
1838
- </import>
1839
- <component exclude='false' class='component1'>
1840
- <p id='_'>Hello</p>
1841
- </component>
1842
- </permission>
1843
- </foreword></preface>
1844
- <bibliography><references id="_bibliography" obligation="informative" normative="false" displayorder="2">
1845
- <title>Bibliography</title>
1846
- <bibitem id="rfc2616" type="standard"> <fetched>2020-03-27</fetched> <title format="text/plain" language="en" script="Latn">Hypertext Transfer Protocol — HTTP/1.1</title> <uri type="xml">https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri> <uri type="src">https://www.rfc-editor.org/info/rfc2616</uri> <docidentifier type="IETF">RFC 2616</docidentifier> <docidentifier type="IETF" scope="anchor">RFC2616</docidentifier> <docidentifier type="DOI">10.17487/RFC2616</docidentifier> <date type="published"> <on>1999-06</on> </date> <contributor> <role type="author"/> <person> <name> <completename language="en">R. Fielding</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Gettys</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Mogul</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">H. Frystyk</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">L. Masinter</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">P. Leach</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">T. Berners-Lee</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <language>en</language> <script>Latn</script> <abstract format="text/plain" language="en" script="Latn">HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as “HTTP/1.1”, and is an update to RFC 2068. [STANDARDS-TRACK]</abstract> <series type="main"> <title format="text/plain" language="en" script="Latn">RFC</title> <number>2616</number> </series> <place>Fremont, CA</place></bibitem>
1847
- </references></bibliography>
1848
- </iso-standard>
1849
- INPUT
1850
- presxml = <<~OUTPUT
1851
- <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
1852
- <preface><foreword displayorder='1'>
1853
- <permission id="_" keep-with-next="true" keep-lines-together="true">
1854
- <name>Permission 1</name>
1855
- <label>/ogc/recommendation/wfs/2</label>
1856
- <inherit>/ss/584/2015/level/1</inherit>
1857
- <inherit><eref type="inline" bibitemid="rfc2616" citeas="RFC 2616">RFC 2616 (HTTP/1.1)</eref></inherit>
1858
- <subject>user</subject>
1859
- <subject>non-user</subject>
1860
- <classification> <tag>control-class</tag> <value>Technical</value> </classification><classification> <tag>priority</tag> <value>P0</value> </classification><classification> <tag>family</tag> <value>System and Communications Protection</value> </classification><classification> <tag>family</tag> <value>System and Communications Protocols</value> </classification>
1861
- <description>
1862
- <p id="_">I recommend <em>this</em>.</p>
1863
- </description>
1864
- <specification exclude="true" type="tabular">
1865
- <p id="_">This is the object of the recommendation:</p>
1866
- <table id="_">
1867
- <tbody>
1868
- <tr>
1869
- <td style="text-align:left;">Object</td>
1870
- <td style="text-align:left;">Value</td>
1871
- </tr>
1872
- <tr>
1873
- <td style="text-align:left;">Mission</td>
1874
- <td style="text-align:left;">Accomplished</td>
1875
- </tr>
1876
- </tbody>
1877
- </table>
1878
- </specification>
1879
- <description>
1880
- <p id="_">As for the measurement targets,</p>
1881
- </description>
1882
- <measurement-target exclude="false">
1883
- <p id="_">The measurement target shall be measured as:</p>
1884
- <formula id="_">
1885
- <name>1</name>
1886
- <stem type="AsciiMath">r/1 = 0</stem>
1887
- </formula>
1888
- </measurement-target>
1889
- <verification exclude="false">
1890
- <p id="_">The following code will be run for verification:</p>
1891
- <sourcecode id="_">CoreRoot(success): HttpResponse
1892
- if (success)
1893
- recommendation(label: success-response)
1894
- end
1895
- </sourcecode>
1896
- </verification>
1897
- <import exclude="true">
1898
- <sourcecode id="_">success-response()</sourcecode>
1899
- </import>
1900
- <component exclude='false' class='component1'>
1901
- <p id='_'>Hello</p>
1902
- </component>
1903
- </permission>
1904
- </foreword></preface>
1905
- <bibliography><references id="_bibliography" obligation="informative" normative="false" displayorder='2'>
1906
- <title depth='1'>Bibliography</title>
1907
- <bibitem id="rfc2616" type="standard">
1908
- <formattedref>
1909
- R. FIELDING, J. GETTYS, J. MOGUL, H. FRYSTYK, L. MASINTER, P. LEACH and T. BERNERS-LEE.
1910
- <em>Hypertext Transfer Protocol&#x2009;&#x2014;&#x2009;HTTP/1.1</em>
1911
- . In: RFC. June 1999. Fremont, CA.
1912
- <link target='https://www.rfc-editor.org/info/rfc2616'>https://www.rfc-editor.org/info/rfc2616</link>.
1913
- </formattedref>
1914
- <uri type='xml'>https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri>
1915
- <uri type='src'>https://www.rfc-editor.org/info/rfc2616</uri>
1916
- <docidentifier type='metanorma-ordinal'>[1]</docidentifier>
1917
- <docidentifier type='IETF'>IETF RFC 2616</docidentifier>
1918
- <docidentifier type='IETF' scope='anchor'>IETF RFC2616</docidentifier>
1919
- <docidentifier type='DOI'>DOI 10.17487/RFC2616</docidentifier>
1920
- </bibitem>
1921
- </references></bibliography>
1922
- </iso-standard>
1923
- OUTPUT
1924
- html = <<~OUTPUT
1925
- #{HTML_HDR}
1926
- <br/>
1927
- <div>
1928
- <h1 class="ForewordTitle">Foreword</h1>
1929
- <div class="permission" id='_' style='page-break-after: avoid;page-break-inside: avoid;'>
1930
- <p class="RecommendationTitle">Permission 1:<br/>/ogc/recommendation/wfs/2</p>
1931
- <p><i>Subject: user<br/>
1932
- Subject: non-user<br/>
1933
- Inherits: /ss/584/2015/level/1
1934
- <br/>
1935
- Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
1936
- <br/>Control-class: Technical<br/>Priority: P0<br/>Family: System and Communications Protection<br/>Family: System and Communications Protocols</i></p>
1937
- <div class="requirement-description">
1938
- <p id="_">I recommend <i>this</i>.</p>
1939
- </div>
1940
- <div class="requirement-description">
1941
- <p id="_">As for the measurement targets,</p>
1942
- </div>
1943
- <div class="requirement-measurement-target">
1944
- <p id="_">The measurement target shall be measured as:</p>
1945
- <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>&#160; (1)</p></div></div>
1946
- </div>
1947
- <div class="requirement-verification">
1948
- <p id="_">The following code will be run for verification:</p>
1949
- <pre id="_" class="prettyprint ">CoreRoot(success): HttpResponse<br/>&#160;&#160;&#160;&#160;&#160; if (success)<br/>&#160;&#160;&#160;&#160;&#160; recommendation(label: success-response)<br/>&#160;&#160;&#160;&#160;&#160; end<br/>&#160;&#160;&#160; </pre>
1950
- </div>
1951
- <div class='requirement-component1'> <p id='_'>Hello</p> </div>
1952
- </div>
1953
- </div>
1954
- <p class="zzSTDTitle1"/>
1955
- <br/>
1956
- <div>
1957
- <h1 class='Section3'>Bibliography</h1>
1958
- <p id='rfc2616' class='Biblio'>
1959
- [1]&#160; IETF RFC 2616, R. FIELDING, J. GETTYS, J. MOGUL, H. FRYSTYK, L. MASINTER, P. LEACH and T. BERNERS-LEE.
1960
- <i>Hypertext Transfer Protocol&#8201;&#8212;&#8201;HTTP/1.1</i>
1961
- . In: RFC. June 1999. Fremont, CA.
1962
- <a href='https://www.rfc-editor.org/info/rfc2616'>https://www.rfc-editor.org/info/rfc2616</a>.
1963
- </p>
1964
- </div>
1965
- </div>
1966
- </body>
1967
- </html>
1968
- OUTPUT
1969
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1970
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1971
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
1972
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1973
- end
1974
-
1975
- it "processes requirements" do
1976
- input = <<~INPUT
1977
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1978
- <preface><foreword>
1979
- <requirement id="A" unnumbered="true" keep-with-next="true" keep-lines-together="true">
1980
- <title>A New Requirement</title>
1981
- <label>/ogc/recommendation/wfs/2</label>
1982
- <inherit>/ss/584/2015/level/1</inherit>
1983
- <subject>user</subject>
1984
- <description>
1985
- <p id="_">I recommend <em>this</em>.</p>
1986
- </description>
1987
- <specification exclude="true" type="tabular">
1988
- <p id="_">This is the object of the recommendation:</p>
1989
- <table id="_">
1990
- <tbody>
1991
- <tr>
1992
- <td style="text-align:left;">Object</td>
1993
- <td style="text-align:left;">Value</td>
1994
- </tr>
1995
- <tr>
1996
- <td style="text-align:left;">Mission</td>
1997
- <td style="text-align:left;">Accomplished</td>
1998
- </tr>
1999
- </tbody>
2000
- </table>
2001
- </specification>
2002
- <description>
2003
- <p id="_">As for the measurement targets,</p>
2004
- </description>
2005
- <measurement-target exclude="false" keep-with-next="true" keep-lines-together="true">
2006
- <p id="_">The measurement target shall be measured as:</p>
2007
- <formula id="B">
2008
- <stem type="AsciiMath">r/1 = 0</stem>
2009
- </formula>
2010
- </measurement-target>
2011
- <verification exclude="false">
2012
- <p id="_">The following code will be run for verification:</p>
2013
- <sourcecode id="_">CoreRoot(success): HttpResponse
2014
- if (success)
2015
- recommendation(label: success-response)
2016
- end
2017
- </sourcecode>
2018
- </verification>
2019
- <import exclude="true">
2020
- <sourcecode id="_">success-response()</sourcecode>
2021
- </import>
2022
- <component exclude='false' class='component1'>
2023
- <p id='_'>Hello</p>
2024
- </component>
2025
- </requirement>
2026
- </foreword></preface>
2027
- </iso-standard>
2028
- INPUT
2029
- presxml = <<~OUTPUT
2030
- <?xml version='1.0'?>
2031
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2032
- <preface>
2033
- <foreword displayorder="1">
2034
- <requirement id='A' unnumbered='true' keep-with-next='true' keep-lines-together='true'>
2035
- <name>Requirement</name>
2036
- <title>A New Requirement</title>
2037
- <label>/ogc/recommendation/wfs/2</label>
2038
- <inherit>/ss/584/2015/level/1</inherit>
2039
- <subject>user</subject>
2040
- <description>
2041
- <p id='_'>
2042
- I recommend
2043
- <em>this</em>
2044
- .
2045
- </p>
2046
- </description>
2047
- <specification exclude='true' type='tabular'>
2048
- <p id='_'>This is the object of the recommendation:</p>
2049
- <table id='_'>
2050
- <tbody>
2051
- <tr>
2052
- <td style='text-align:left;'>Object</td>
2053
- <td style='text-align:left;'>Value</td>
2054
- </tr>
2055
- <tr>
2056
- <td style='text-align:left;'>Mission</td>
2057
- <td style='text-align:left;'>Accomplished</td>
2058
- </tr>
2059
- </tbody>
2060
- </table>
2061
- </specification>
2062
- <description>
2063
- <p id='_'>As for the measurement targets,</p>
2064
- </description>
2065
- <measurement-target exclude='false' keep-with-next='true' keep-lines-together='true'>
2066
- <p id='_'>The measurement target shall be measured as:</p>
2067
- <formula id='B'><name>1</name><stem type='AsciiMath'>r/1 = 0</stem></formula></measurement-target>
2068
- <verification exclude='false'>
2069
- <p id='_'>The following code will be run for verification:</p>
2070
- <sourcecode id='_'>CoreRoot(success): HttpResponse
2071
- if (success)
2072
- recommendation(label: success-response)
2073
- end
2074
- </sourcecode>
2075
- </verification>
2076
- <import exclude='true'>
2077
- <sourcecode id='_'>success-response()</sourcecode>
2078
- </import>
2079
- <component exclude='false' class='component1'>
2080
- <p id='_'>Hello</p>
2081
- </component>
2082
- </requirement>
2083
- </foreword>
2084
- </preface>
2085
- </iso-standard>
2086
- OUTPUT
2087
-
2088
- output = <<~OUTPUT
2089
- #{HTML_HDR}
2090
- <br/>
2091
- <div>
2092
- <h1 class="ForewordTitle">Foreword</h1>
2093
- <div class="require" id='A' style='page-break-after: avoid;page-break-inside: avoid;'>
2094
- <p class="RecommendationTitle">Requirement:<br/>/ogc/recommendation/wfs/2. A New Requirement</p><p><i>Subject: user<br/>Inherits: /ss/584/2015/level/1</i></p>
2095
- <div class="requirement-description">
2096
- <p id="_">I recommend <i>this</i>.</p>
2097
- </div>
2098
- <div class="requirement-description">
2099
- <p id="_">As for the measurement targets,</p>
2100
- </div>
2101
- <div class="requirement-measurement-target" style='page-break-after: avoid;page-break-inside: avoid;'>
2102
- <p id="_">The measurement target shall be measured as:</p>
2103
- <div id="B"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span> &#160; (1)</p></div></div>
2104
- </div>
2105
- <div class="requirement-verification">
2106
- <p id="_">The following code will be run for verification:</p>
2107
- <pre id="_" class="prettyprint ">CoreRoot(success): HttpResponse<br/>&#160;&#160;&#160;&#160;&#160; if (success)<br/>&#160;&#160;&#160;&#160;&#160; recommendation(label: success-response)<br/>&#160;&#160;&#160;&#160;&#160; end<br/>&#160;&#160;&#160; </pre>
2108
- </div>
2109
- <div class='requirement-component1'> <p id='_'>Hello</p> </div>
2110
- </div>
2111
- </div>
2112
- <p class="zzSTDTitle1"/>
2113
- </div>
2114
- </body>
2115
- </html>
2116
- OUTPUT
2117
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2118
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
2119
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
2120
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
2121
- end
2122
-
2123
- it "processes requirements in French" do
2124
- input = <<~INPUT
2125
- <iso-standard xmlns="http://riboseinc.com/isoxml">
2126
- <bibdata>
2127
- <language>fr</language>
2128
- <script>Latn</script>
2129
- </bibdata>
2130
- <preface><foreword>
2131
- <requirement id="A" unnumbered="true">
2132
- <title>A New Requirement</title>
2133
- <label>/ogc/recommendation/wfs/2</label>
2134
- <inherit>/ss/584/2015/level/1</inherit>
2135
- <subject>user</subject>
2136
- <description>
2137
- <p id="_">I recommend <em>this</em>.</p>
2138
- </description>
2139
- <specification exclude="true" type="tabular">
2140
- <p id="_">This is the object of the recommendation:</p>
2141
- <table id="_">
2142
- <tbody>
2143
- <tr>
2144
- <td style="text-align:left;">Object</td>
2145
- <td style="text-align:left;">Value</td>
2146
- </tr>
2147
- <tr>
2148
- <td style="text-align:left;">Mission</td>
2149
- <td style="text-align:left;">Accomplished</td>
2150
- </tr>
2151
- </tbody>
2152
- </table>
2153
- </specification>
2154
- <description>
2155
- <p id="_">As for the measurement targets,</p>
2156
- </description>
2157
- <measurement-target exclude="false">
2158
- <p id="_">The measurement target shall be measured as:</p>
2159
- <formula id="B">
2160
- <stem type="AsciiMath">r/1 = 0</stem>
2161
- </formula>
2162
- </measurement-target>
2163
- <verification exclude="false">
2164
- <p id="_">The following code will be run for verification:</p>
2165
- <sourcecode id="_">CoreRoot(success): HttpResponse
2166
- if (success)
2167
- recommendation(label: success-response)
2168
- end
2169
- </sourcecode>
2170
- </verification>
2171
- <import exclude="true">
2172
- <sourcecode id="_">success-response()</sourcecode>
2173
- </import>
2174
- <component exclude='false' class='component1'>
2175
- <p id='_'>Hello</p>
2176
- </component>
2177
- </requirement>
2178
- </foreword></preface>
2179
- </iso-standard>
2180
- INPUT
2181
-
2182
- presxml = <<~OUTPUT
2183
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
2184
- <bibdata>
2185
- <language current="true">fr</language>
2186
- <script current="true">Latn</script>
2187
- </bibdata>
2188
- <preface><foreword displayorder="1">
2189
- <requirement id="A" unnumbered="true"><name>Exigence</name>
2190
- <title>A New Requirement</title>
2191
- <label>/ogc/recommendation/wfs/2</label>
2192
- <inherit>/ss/584/2015/level/1</inherit>
2193
- <subject>user</subject>
2194
- <description>
2195
- <p id="_">I recommend <em>this</em>.</p>
2196
- </description>
2197
- <specification exclude="true" type="tabular">
2198
- <p id="_">This is the object of the recommendation:</p>
2199
- <table id="_">
2200
- <tbody>
2201
- <tr>
2202
- <td style="text-align:left;">Object</td>
2203
- <td style="text-align:left;">Value</td>
2204
- </tr>
2205
- <tr>
2206
- <td style="text-align:left;">Mission</td>
2207
- <td style="text-align:left;">Accomplished</td>
2208
- </tr>
2209
- </tbody>
2210
- </table>
2211
- </specification>
2212
- <description>
2213
- <p id="_">As for the measurement targets,</p>
2214
- </description>
2215
- <measurement-target exclude="false">
2216
- <p id="_">The measurement target shall be measured as:</p>
2217
- <formula id="B"><name>1</name>
2218
- <stem type="AsciiMath">r/1 = 0</stem>
2219
- </formula>
2220
- </measurement-target>
2221
- <verification exclude="false">
2222
- <p id="_">The following code will be run for verification:</p>
2223
- <sourcecode id="_">CoreRoot(success): HttpResponse
2224
- if (success)
2225
- recommendation(label: success-response)
2226
- end
2227
- </sourcecode>
2228
- </verification>
2229
- <import exclude="true">
2230
- <sourcecode id="_">success-response()</sourcecode>
2231
- </import>
2232
- <component exclude='false' class='component1'>
2233
- <p id='_'>Hello</p>
2234
- </component>
2235
- </requirement>
2236
- </foreword></preface>
2237
- </iso-standard>
2238
- OUTPUT
2239
-
2240
- html = <<~OUTPUT
2241
- #{HTML_HDR.gsub(/"en"/, '"fr"')}
2242
- <br/>
2243
- <div>
2244
- <h1 class='ForewordTitle'>Avant-propos</h1>
2245
- <div class='require' id="A">
2246
- <p class='RecommendationTitle'>
2247
- Exigence:
2248
- <br/>
2249
- /ogc/recommendation/wfs/2. A New Requirement
2250
- </p>
2251
- <p>
2252
- <i>
2253
- Sujet: user
2254
- <br/>
2255
- H&#233;rite: /ss/584/2015/level/1
2256
- </i>
2257
- </p>
2258
- <div class='requirement-description'>
2259
- <p id='_'>
2260
- I recommend
2261
- <i>this</i>
2262
- .
2263
- </p>
2264
- </div>
2265
- <div class='requirement-description'>
2266
- <p id='_'>As for the measurement targets,</p>
2267
- </div>
2268
- <div class='requirement-measurement-target'>
2269
- <p id='_'>The measurement target shall be measured as:</p>
2270
- <div id='B'><div class='formula'>
2271
- <p>
2272
- <span class='stem'>(#(r/1 = 0)#)</span>
2273
- &#160; (1)
2274
- </p>
2275
- </div>
2276
- </div>
2277
- </div>
2278
- <div class='requirement-verification'>
2279
- <p id='_'>The following code will be run for verification:</p>
2280
- <pre id='_' class='prettyprint '>
2281
- CoreRoot(success): HttpResponse
2282
- <br/>
2283
- &#160; if (success)
2284
- <br/>
2285
- &#160; recommendation(label: success-response)
2286
- <br/>
2287
- &#160; end
2288
- <br/>
2289
- </pre>
2290
- </div>
2291
- <div class='requirement-component1'> <p id='_'>Hello</p> </div>
2292
- </div>
2293
- </div>
2294
- <p class='zzSTDTitle1'/>
2295
- </div>
2296
- </body>
2297
- </html>
2298
- OUTPUT
2299
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2300
- .convert("test", input, true))
2301
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
2302
- .to be_equivalent_to xmlpp(presxml)
2303
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
2304
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
2305
- end
2306
-
2307
- it "processes recommendation" do
2308
- input = <<~INPUT
2309
- <iso-standard xmlns="http://riboseinc.com/isoxml">
2310
- <preface><foreword>
2311
- <recommendation id="_" obligation="shall,could" keep-with-next="true" keep-lines-together="true">
2312
- <label>/ogc/recommendation/wfs/2</label>
2313
- <inherit>/ss/584/2015/level/1</inherit>
2314
- <classification><tag>type</tag><value>text</value></classification>
2315
- <classification><tag>language</tag><value>BASIC</value></classification>
2316
- <subject>user</subject>
2317
- <description>
2318
- <p id="_">I recommend <em>this</em>.</p>
2319
- </description>
2320
- <specification exclude="true" type="tabular">
2321
- <p id="_">This is the object of the recommendation:</p>
2322
- <table id="_">
2323
- <tbody>
2324
- <tr>
2325
- <td style="text-align:left;">Object</td>
2326
- <td style="text-align:left;">Value</td>
2327
- </tr>
2328
- <tr>
2329
- <td style="text-align:left;">Mission</td>
2330
- <td style="text-align:left;">Accomplished</td>
2331
- </tr>
2332
- </tbody>
2333
- </table>
2334
- </specification>
2335
- <description>
2336
- <p id="_">As for the measurement targets,</p>
2337
- </description>
2338
- <measurement-target exclude="false">
2339
- <p id="_">The measurement target shall be measured as:</p>
2340
- <formula id="_">
2341
- <stem type="AsciiMath">r/1 = 0</stem>
2342
- </formula>
2343
- </measurement-target>
2344
- <verification exclude="false">
2345
- <p id="_">The following code will be run for verification:</p>
2346
- <sourcecode id="_">CoreRoot(success): HttpResponse
2347
- if (success)
2348
- recommendation(label: success-response)
2349
- end
2350
- </sourcecode>
2351
- </verification>
2352
- <import exclude="true">
2353
- <sourcecode id="_">success-response()</sourcecode>
2354
- </import>
2355
- <component exclude='false' class='component1'>
2356
- <p id='_'>Hello</p>
2357
- </component>
2358
- </recommendation>
2359
- </foreword></preface>
2360
- </iso-standard>
2361
- INPUT
2362
- presxml = <<~OUTPUT
2363
- <?xml version='1.0'?>
2364
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2365
- <preface>
2366
- <foreword displayorder="1">
2367
- <recommendation id='_' obligation='shall,could' keep-with-next='true' keep-lines-together='true'>
2368
- <name>Recommendation 1</name>
2369
- <label>/ogc/recommendation/wfs/2</label>
2370
- <inherit>/ss/584/2015/level/1</inherit>
2371
- <classification>
2372
- <tag>type</tag>
2373
- <value>text</value>
2374
- </classification>
2375
- <classification>
2376
- <tag>language</tag>
2377
- <value>BASIC</value>
2378
- </classification>
2379
- <subject>user</subject>
2380
- <description>
2381
- <p id='_'>
2382
- I recommend
2383
- <em>this</em>
2384
- .
2385
- </p>
2386
- </description>
2387
- <specification exclude='true' type='tabular'>
2388
- <p id='_'>This is the object of the recommendation:</p>
2389
- <table id='_'>
2390
- <tbody>
2391
- <tr>
2392
- <td style='text-align:left;'>Object</td>
2393
- <td style='text-align:left;'>Value</td>
2394
- </tr>
2395
- <tr>
2396
- <td style='text-align:left;'>Mission</td>
2397
- <td style='text-align:left;'>Accomplished</td>
2398
- </tr>
2399
- </tbody>
2400
- </table>
2401
- </specification>
2402
- <description>
2403
- <p id='_'>As for the measurement targets,</p>
2404
- </description>
2405
- <measurement-target exclude='false'>
2406
- <p id='_'>The measurement target shall be measured as:</p>
2407
- <formula id='_'><name>1</name><stem type='AsciiMath'>r/1 = 0</stem></formula>
2408
- </measurement-target>
2409
- <verification exclude='false'>
2410
- <p id='_'>The following code will be run for verification:</p>
2411
- <sourcecode id='_'>CoreRoot(success): HttpResponse
2412
- if (success)
2413
- recommendation(label: success-response)
2414
- end
2415
- </sourcecode>
2416
- </verification>
2417
- <import exclude='true'>
2418
- <sourcecode id='_'>success-response()</sourcecode>
2419
- </import>
2420
- <component exclude='false' class='component1'>
2421
- <p id='_'>Hello</p>
2422
- </component>
2423
- </recommendation>
2424
- </foreword>
2425
- </preface>
2426
- </iso-standard>
2427
- OUTPUT
2428
-
2429
- output = <<~OUTPUT
2430
- #{HTML_HDR}
2431
- <br/>
2432
- <div>
2433
- <h1 class="ForewordTitle">Foreword</h1>
2434
- <div class="recommend" id='_' style='page-break-after: avoid;page-break-inside: avoid;'>
2435
- <p class="RecommendationTitle">Recommendation 1:<br/>/ogc/recommendation/wfs/2</p><p><i>Obligation: shall,could<br/>Subject: user<br/>Inherits: /ss/584/2015/level/1<br/>Type: text<br/>Language: BASIC</i></p>
2436
- <div class="requirement-description">
2437
- <p id="_">I recommend <i>this</i>.</p>
2438
- </div>
2439
- <div class="requirement-description">
2440
- <p id="_">As for the measurement targets,</p>
2441
- </div>
2442
- <div class="requirement-measurement-target">
2443
- <p id="_">The measurement target shall be measured as:</p>
2444
- <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>&#160; (1)</p></div></div>
2445
- </div>
2446
- <div class="requirement-verification">
2447
- <p id="_">The following code will be run for verification:</p>
2448
- <pre id="_" class="prettyprint ">CoreRoot(success): HttpResponse<br/>&#160;&#160;&#160;&#160;&#160; if (success)<br/>&#160;&#160;&#160;&#160;&#160; recommendation(label: success-response)<br/>&#160;&#160;&#160;&#160;&#160; end<br/>&#160;&#160;&#160; </pre>
2449
- </div>
2450
- <div class='requirement-component1'> <p id='_'>Hello</p> </div>
2451
- </div>
2452
- </div>
2453
- <p class="zzSTDTitle1"/>
2454
- </div>
2455
- </body>
2456
- </html>
2457
- OUTPUT
2458
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2459
- .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
2460
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
2461
- .convert("test", presxml, true)))
2462
- .to be_equivalent_to xmlpp(output)
2463
- end
2464
-
2465
- it "processes pseudocode" do
2466
- input = <<~INPUT
2467
- <itu-standard xmlns="http://riboseinc.com/isoxml">
2468
- <bibdata>
2469
- <language>en</language>
2470
- </bibdata>
2471
- <preface><foreword>
2472
- <figure id="_" class="pseudocode" keep-with-next="true" keep-lines-together="true"><name>Label</name><p id="_">  <strong>A</strong><br/>
2473
-         <smallcap>B</smallcap></p>
2474
- <p id="_">  <em>C</em></p></figure>
2475
- </preface></itu-standard>
2476
- INPUT
2477
-
2478
- presxml = <<~OUTPUT
2479
- <itu-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
2480
- <bibdata>
2481
- <language current="true">en</language>
2482
- </bibdata>
2483
- <preface><foreword displayorder="1">
2484
- <figure id="_" class="pseudocode" keep-with-next="true" keep-lines-together="true"><name>Figure 1&#xA0;&#x2014; Label</name><p id="_">&#xA0;&#xA0;<strong>A</strong><br/>
2485
- &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<smallcap>B</smallcap></p>
2486
- <p id="_">&#xA0;&#xA0;<em>C</em></p></figure>
2487
- </foreword></preface>
2488
- </itu-standard>
2489
-
2490
- OUTPUT
2491
-
2492
- html = <<~OUTPUT
2493
- #{HTML_HDR}
2494
- <br/>
2495
- <div>
2496
- <h1 class="ForewordTitle">Foreword</h1>
2497
- <div id="_" class="pseudocode" style='page-break-after: avoid;page-break-inside: avoid;'><p id="_">&#160;&#160;<b>A</b><br/>
2498
- &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="font-variant:small-caps;">B</span></p>
2499
- <p id="_">&#160;&#160;<i>C</i></p><p class="SourceTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; Label</p></div>
2500
- </div>
2501
- <p class="zzSTDTitle1"/>
2502
- </div>
2503
- </body>
2504
- </html>
2505
- OUTPUT
2506
-
2507
- FileUtils.rm_f "test.doc"
2508
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2509
- .convert("test", input, true))
2510
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
2511
- .to be_equivalent_to xmlpp(presxml)
2512
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
2513
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
2514
- IsoDoc::WordConvert.new({}).convert("test", presxml, false)
2515
- expect(xmlpp(File.read("test.doc")
2516
- .gsub(%r{^.*<h1 class="ForewordTitle">Foreword</h1>}m, "")
2517
- .gsub(%r{</div>.*}m, "</div>")))
2518
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
2519
- <div class="pseudocode" style='page-break-after: avoid;page-break-inside: avoid;'><a name="_" id="_"></a><p class="pseudocode"><a name="_" id="_"></a>&#xA0;&#xA0;<b>A</b><br/>
2520
- &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span style="font-variant:small-caps;">B</span></p>
2521
- <p class="pseudocode" style="page-break-after:avoid;"><a name="_" id="_"></a>&#xA0;&#xA0;<i>C</i></p><p class="SourceTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; Label</p></div>
2522
- OUTPUT
2523
- end
2524
-
2525
- it "does not label embedded figures, sourcecode" do
2526
- input = <<~INPUT
2527
- <itu-standard xmlns="http://riboseinc.com/isoxml">
2528
- <bibdata>
2529
- <language>en</language>
2530
- </bibdata>
2531
- <preface><foreword>
2532
- <example>
2533
- <sourcecode id="B"><name>Label</name>A B C</sourcecode>
2534
- <figure id="A" class="pseudocode"><name>Label</name><p id="_">  <strong>A</strong></p></figure>
2535
- <sourcecode id="B1">A B C</sourcecode>
2536
- <figure id="A1" class="pseudocode"><p id="_">  <strong>A</strong></p></figure>
2537
- </example>
2538
- </preface></itu-standard>
2539
- INPUT
2540
- output = <<~OUTPUT
2541
- #{HTML_HDR}
2542
- <br/>
2543
- <div>
2544
- <h1 class='ForewordTitle'>Foreword</h1>
2545
- <div class='example'>
2546
- <pre id='B' class='prettyprint '>
2547
- A B C
2548
- </pre>
2549
- <p class='SourceTitle' style='text-align:center;'>Label</p>
2550
- <div id='A' class='pseudocode'>
2551
- <p id='_'>
2552
- &#160;&#160;
2553
- <b>A</b>
2554
- </p>
2555
- <p class='SourceTitle' style='text-align:center;'>Label</p>
2556
- </div>
2557
- <pre id='B1' class='prettyprint '>A B C</pre>
2558
- <div id='A1' class='pseudocode'>
2559
- <p id='_'>
2560
- &#160;&#160;
2561
- <b>A</b>
2562
- </p>
2563
- </div>
2564
- </div>
2565
- </div>
2566
- <p class='zzSTDTitle1'/>
2567
- </div>
2568
- </body>
2569
- </html>
2570
- OUTPUT
2571
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
2572
- .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2573
- end
2574
-
2575
- it "processes passthrough with compatible format" do
2576
- FileUtils.rm_f "test.html"
2577
- IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", false)
2578
- <iso-standard xmlns="http://riboseinc.com/isoxml">
2579
- <preface><foreword>
2580
- <passthrough format="html,rfc">&lt;A&gt;</passthrough><em>Hello</em><passthrough format="html,rfc">&lt;/A&gt;</passthrough>
2581
- </foreword></preface>
2582
- </iso-standard>
2583
- INPUT
2584
- expect((File.read("test.html")
2585
- .gsub(%r{^.*<h1 class="ForewordTitle">Foreword</h1>}m, "")
2586
- .gsub(%r{</div>.*}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2587
- <A><i>Hello</i></A>
2588
- OUTPUT
2589
- end
2590
-
2591
- it "aborts if passthrough results in malformed XML" do
2592
- FileUtils.rm_f "test.html"
2593
- FileUtils.rm_f "test.html.err"
2594
- begin
2595
- input = <<~INPUT
2596
- <iso-standard xmlns="http://riboseinc.com/isoxml">
2597
- <preface><foreword>
2598
- <passthrough format="html,rfc">&lt;A&gt;</passthrough><em>Hello</em>
2599
- </foreword></preface>
2600
- </iso-standard>
2601
- INPUT
2602
- expect do
2603
- IsoDoc::HtmlConvert.new({})
2604
- .convert("test", input, false)
2605
- end.to raise_error(SystemExit)
2606
- rescue SystemExit
2607
- end
2608
- expect(File.exist?("test.html.err")).to be true
2609
- end
2610
-
2611
- it "ignores passthrough with incompatible format" do
2612
- input = <<~INPUT
2613
- <iso-standard xmlns="http://riboseinc.com/isoxml">
2614
- <preface><foreword>
2615
- <passthrough format="doc,rfc">&lt;A&gt;</passthrough>
2616
- </foreword></preface>
2617
- </iso-standard>
2618
- INPUT
2619
- output = <<~OUTPUT
2620
- #{HTML_HDR}
2621
- <br/>
2622
- <div>
2623
- <h1 class='ForewordTitle'>Foreword</h1>
2624
- </div>
2625
- <p class='zzSTDTitle1'/>
2626
- </div>
2627
- </body>
2628
- </html>
2629
- OUTPUT
2630
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
2631
- .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2632
- end
2633
-
2634
- it "processes svgmap" do
2635
- input = <<~INPUT
2636
- <iso-standard xmlns="http://riboseinc.com/isoxml">
2637
- <sections>
2638
- <svgmap id='_'>
2639
- <target href='http://www.example.com'>
2640
- <xref target='ref1'>Computer</xref>
2641
- </target>
2642
- </svgmap>
2643
- <figure id='_'>
2644
- <image src='action_schemaexpg1.svg' id='_' mimetype='image/svg+xml' height='auto' width='auto'/>
2645
- </figure>
2646
- <svgmap id='_'>
2647
- <figure id='_'>
2648
- <image src='action_schemaexpg2.svg' id='_' mimetype='image/svg+xml' height='auto' width='auto' alt='Workmap'/>
2649
- </figure>
2650
- <target href='mn://support_resource_schema'>
2651
- <eref bibitemid='express_action_schema' citeas=''>
2652
- <localityStack>
2653
- <locality type='anchor'>
2654
- <referenceFrom>action_schema.basic</referenceFrom>
2655
- </locality>
2656
- </localityStack>
2657
- Coffee
2658
- </eref>
2659
- </target>
2660
- </svgmap>
2661
- </sections>
2662
- <bibliography>
2663
- <references hidden='true' normative='false'>
2664
- <bibitem id='express_action_schema' type='internal'>
2665
- <docidentifier type='repository'>express/action_schema</docidentifier>
2666
- </bibitem>
2667
- </references>
2668
- </bibliography>
2669
- </iso-standard>
2670
- INPUT
2671
- output = <<~OUTPUT
2672
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
2673
- <sections>
2674
- <figure id='_'>
2675
- <image src='action_schemaexpg1.svg' id='_' mimetype='image/svg+xml' height='auto' width='auto'>
2676
- <emf src='./action_schemaexpg1.emf'/>
2677
- </image>
2678
- </figure>
2679
- <figure id='_'>
2680
- <image src='action_schemaexpg2.svg' id='_' mimetype='image/svg+xml' height='auto' width='auto' alt='Workmap'>
2681
- <emf src='./action_schemaexpg2.emf'/>
2682
- </image>
2683
- </figure>
2684
- </sections>
2685
- <bibliography>
2686
- <references hidden='true' normative='false' displayorder="1">
2687
- <bibitem id='express_action_schema' type='internal'>
2688
- <docidentifier type='repository'>express/action_schema</docidentifier>
2689
- </bibitem>
2690
- </references>
2691
- </bibliography>
2692
- </iso-standard>
2693
- OUTPUT
2694
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2695
- .convert("test", input, true))
2696
- .sub(%r{<localized-strings>.*</localized-strings>}m, "")
2697
- .gsub(%r{"\.\\}, '"./')
2698
- .gsub(%r{'\.\\}, "'./"))
2699
- .to be_equivalent_to xmlpp(output)
2700
- end
2701
-
2702
- it "processes toc" do
2703
- input = <<~INPUT
2704
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='1.10.2'>
2705
- <bibdata type='standard'>
2706
- <title language='en' format='text/plain'>Document title</title>
2707
- <language>en</language>
2708
- <script>Latn</script>
2709
- <status>
2710
- <stage>published</stage>
2711
- </status>
2712
- <copyright>
2713
- <from>2021</from>
2714
- </copyright>
2715
- <ext>
2716
- <doctype>article</doctype>
2717
- </ext>
2718
- </bibdata>
2719
- <sections>
2720
- <clause id='clause1' inline-header='false' obligation='normative'>
2721
- <title>Clause 1</title>
2722
- <clause id='clause1A' inline-header='false' obligation='normative'>
2723
- <title>Clause 1A</title>
2724
- <clause id='clause1Aa' inline-header='false' obligation='normative'>
2725
- <title>Clause 1Aa</title>
2726
- </clause>
2727
- <clause id='clause1Ab' inline-header='false' obligation='normative'>
2728
- <title>Clause 1Ab</title>
2729
- </clause>
2730
- </clause>
2731
- <clause id='clause1B' inline-header='false' obligation='normative'>
2732
- <title>Clause 1B</title>
2733
- <clause id='clause1Ba' inline-header='false' obligation='normative'>
2734
- <title>Clause 1Ba</title>
2735
- </clause>
2736
- </clause>
2737
- </clause>
2738
- <clause id='clause2' inline-header='false' obligation='normative'>
2739
- <title>Clause 2</title>
2740
- <p id='A'>And introducing: </p>
2741
- <toc>
2742
- <ul id='B'>
2743
- <li>
2744
- <xref target='clause1A'>Clause 1A</xref>
2745
- </li>
2746
- <li>
2747
- <ul id='C'>
2748
- <li>
2749
- <xref target='clause1Aa'>Clause 1Aa</xref>
2750
- </li>
2751
- <li>
2752
- <xref target='clause1Ab'>Clause 1Ab</xref>
2753
- </li>
2754
- </ul>
2755
- </li>
2756
- <li>
2757
- <xref target='clause1B'>Clause 1B</xref>
2758
- </li>
2759
- <li>
2760
- <ul id='D'>
2761
- <li>
2762
- <xref target='clause1Ba'>Clause 1Ba</xref>
2763
- </li>
2764
- </ul>
2765
- </li>
2766
- </ul>
2767
- </toc>
2768
- <toc>
2769
- <ul id='E'>
2770
- <li>
2771
- <xref target='clause1A'>Clause 1A</xref>
2772
- </li>
2773
- <li>
2774
- <xref target='clause1B'>Clause 1B</xref>
2775
- </li>
2776
- </ul>
2777
- </toc>
2778
- </clause>
2779
- </sections>
2780
- </standard-document>
2781
- INPUT
2782
- presxml = <<~INPUT
2783
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="presentation" version="1.10.2">
2784
- <bibdata type="standard">
2785
- <title language="en" format="text/plain">Document title</title>
2786
- <language current="true">en</language>
2787
- <script current="true">Latn</script>
2788
- <status>
2789
- <stage>published</stage>
2790
- </status>
2791
- <copyright>
2792
- <from>2021</from>
2793
- </copyright>
2794
- <ext>
2795
- <doctype>article</doctype>
2796
- </ext>
2797
- </bibdata>
2798
- <sections>
2799
- <clause id="clause1" inline-header="false" obligation="normative" displayorder="1">
2800
- <title depth="1">1.<tab/>Clause 1</title>
2801
- <clause id="clause1A" inline-header="false" obligation="normative">
2802
- <title depth="2">1.1.<tab/>Clause 1A</title>
2803
- <clause id="clause1Aa" inline-header="false" obligation="normative">
2804
- <title depth="3">1.1.1.<tab/>Clause 1Aa</title>
2805
- </clause>
2806
- <clause id="clause1Ab" inline-header="false" obligation="normative">
2807
- <title depth="3">1.1.2.<tab/>Clause 1Ab</title>
2808
- </clause>
2809
- </clause>
2810
- <clause id="clause1B" inline-header="false" obligation="normative">
2811
- <title depth="2">1.2.<tab/>Clause 1B</title>
2812
- <clause id="clause1Ba" inline-header="false" obligation="normative">
2813
- <title depth="3">1.2.1.<tab/>Clause 1Ba</title>
2814
- </clause>
2815
- </clause>
2816
- </clause>
2817
- <clause id="clause2" inline-header="false" obligation="normative" displayorder="2">
2818
- <title depth="1">2.<tab/>Clause 2</title>
2819
- <p id="A">And introducing: </p>
2820
- <toc>
2821
- <ul id="B">
2822
- <li>
2823
- <xref target="clause1A">1.1<tab/>Clause 1A</xref>
2824
- </li>
2825
- <li>
2826
- <ul id="C">
2827
- <li>
2828
- <xref target="clause1Aa">1.1.1<tab/>Clause 1Aa</xref>
2829
- </li>
2830
- <li>
2831
- <xref target="clause1Ab">1.1.2<tab/>Clause 1Ab</xref>
2832
- </li>
2833
- </ul>
2834
- </li>
2835
- <li>
2836
- <xref target="clause1B">1.2<tab/>Clause 1B</xref>
2837
- </li>
2838
- <li>
2839
- <ul id="D">
2840
- <li>
2841
- <xref target="clause1Ba">1.2.1<tab/>Clause 1Ba</xref>
2842
- </li>
2843
- </ul>
2844
- </li>
2845
- </ul>
2846
- </toc>
2847
- <toc>
2848
- <ul id="E">
2849
- <li>
2850
- <xref target="clause1A">1.1<tab/>Clause 1A</xref>
2851
- </li>
2852
- <li>
2853
- <xref target="clause1B">1.2<tab/>Clause 1B</xref>
2854
- </li>
2855
- </ul>
2856
- </toc>
2857
- </clause>
2858
- </sections>
2859
- </standard-document>
2860
- INPUT
2861
- output = <<~OUTPUT
2862
- #{HTML_HDR}
2863
- <p class='zzSTDTitle1'>Document title</p>
2864
- <div id='clause1'>
2865
- <h1>1.&#160; Clause 1</h1>
2866
- <div id='clause1A'>
2867
- <h2>1.1.&#160; Clause 1A</h2>
2868
- <div id='clause1Aa'>
2869
- <h3>1.1.1.&#160; Clause 1Aa</h3>
2870
- </div>
2871
- <div id='clause1Ab'>
2872
- <h3>1.1.2.&#160; Clause 1Ab</h3>
2873
- </div>
2874
- </div>
2875
- <div id='clause1B'>
2876
- <h2>1.2.&#160; Clause 1B</h2>
2877
- <div id='clause1Ba'>
2878
- <h3>1.2.1.&#160; Clause 1Ba</h3>
2879
- </div>
2880
- </div>
2881
- </div>
2882
- <div id='clause2'>
2883
- <h1>2.&#160; Clause 2</h1>
2884
- <p id='A'>And introducing: </p>
2885
- <div class='toc'>
2886
- <ul id='B'>
2887
- <li>
2888
- <a href='#clause1A'>1.1&#160; Clause 1A</a>
2889
- </li>
2890
- <li>
2891
- <ul id='C'>
2892
- <li>
2893
- <a href='#clause1Aa'>1.1.1&#160; Clause 1Aa</a>
2894
- </li>
2895
- <li>
2896
- <a href='#clause1Ab'>1.1.2&#160; Clause 1Ab</a>
2897
- </li>
2898
- </ul>
2899
- </li>
2900
- <li>
2901
- <a href='#clause1B'>1.2&#160; Clause 1B</a>
2902
- </li>
2903
- <li>
2904
- <ul id='D'>
2905
- <li>
2906
- <a href='#clause1Ba'>1.2.1&#160; Clause 1Ba</a>
2907
- </li>
2908
- </ul>
2909
- </li>
2910
- </ul>
2911
- </div>
2912
- <div class='toc'>
2913
- <ul id='E'>
2914
- <li>
2915
- <a href='#clause1A'>1.1&#160; Clause 1A</a>
2916
- </li>
2917
- <li>
2918
- <a href='#clause1B'>1.2&#160; Clause 1B</a>
2919
- </li>
2920
- </ul>
2921
- </div>
2922
- </div>
2923
- </div>
2924
- </body>
2925
- </html>
2926
- OUTPUT
2927
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2928
- .convert("test", input, true)
2929
- .sub(%r{<localized-strings>.*</localized-strings>}m, "")))
2930
- .to be_equivalent_to xmlpp(presxml)
2931
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
2932
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
2933
- end
2934
- end