isodoc 1.1.4 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc-yaml/i18n-en.yaml +4 -1
  3. data/lib/isodoc-yaml/i18n-fr.yaml +4 -1
  4. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +4 -1
  5. data/lib/isodoc.rb +1 -0
  6. data/lib/isodoc/common.rb +0 -2
  7. data/lib/isodoc/convert.rb +33 -27
  8. data/lib/isodoc/function/blocks.rb +10 -22
  9. data/lib/isodoc/function/blocks_example_note.rb +14 -15
  10. data/lib/isodoc/function/cleanup.rb +5 -4
  11. data/lib/isodoc/function/inline.rb +6 -76
  12. data/lib/isodoc/function/references.rb +10 -9
  13. data/lib/isodoc/function/reqt.rb +12 -11
  14. data/lib/isodoc/function/section.rb +39 -54
  15. data/lib/isodoc/function/table.rb +1 -6
  16. data/lib/isodoc/function/terms.rb +13 -6
  17. data/lib/isodoc/function/to_word_html.rb +1 -0
  18. data/lib/isodoc/function/utils.rb +4 -3
  19. data/lib/isodoc/html_function/html.rb +0 -1
  20. data/lib/isodoc/{function/i18n.rb → i18n.rb} +37 -36
  21. data/lib/isodoc/metadata.rb +4 -3
  22. data/lib/isodoc/metadata_date.rb +1 -1
  23. data/lib/isodoc/presentation_function/block.rb +138 -0
  24. data/lib/isodoc/presentation_function/inline.rb +131 -0
  25. data/lib/isodoc/presentation_function/section.rb +46 -0
  26. data/lib/isodoc/presentation_xml_convert.rb +38 -5
  27. data/lib/isodoc/version.rb +1 -1
  28. data/lib/isodoc/word_function/body.rb +12 -8
  29. data/lib/isodoc/word_function/inline.rb +3 -1
  30. data/lib/isodoc/xref.rb +5 -3
  31. data/lib/isodoc/xref/xref_sect_gen.rb +3 -3
  32. data/spec/assets/i18n.yaml +12 -1
  33. data/spec/isodoc/blocks_spec.rb +1101 -147
  34. data/spec/isodoc/cleanup_spec.rb +2 -2
  35. data/spec/isodoc/footnotes_spec.rb +2 -2
  36. data/spec/isodoc/i18n_spec.rb +679 -110
  37. data/spec/isodoc/inline_spec.rb +323 -142
  38. data/spec/isodoc/lists_spec.rb +2 -2
  39. data/spec/isodoc/postproc_spec.rb +1311 -1333
  40. data/spec/isodoc/ref_spec.rb +181 -3
  41. data/spec/isodoc/section_spec.rb +508 -680
  42. data/spec/isodoc/table_spec.rb +155 -4
  43. data/spec/isodoc/terms_spec.rb +111 -79
  44. data/spec/isodoc/xref_spec.rb +1569 -1186
  45. metadata +6 -3
@@ -69,7 +69,9 @@ module IsoDoc::WordFunction
69
69
  def xref_parse(node, out)
70
70
  target = /#/.match(node["target"]) ? node["target"].sub(/#/, ".doc#") :
71
71
  "##{node["target"]}"
72
- out.a(**{ "href": target }) { |l| l << get_linkend(node) }
72
+ out.a(**{ "href": target }) do |l|
73
+ node.children.each { |n| parse(n, l) }
74
+ end
73
75
  end
74
76
  end
75
77
  end
@@ -11,13 +11,15 @@ module IsoDoc
11
11
  include XrefGen::Blocks
12
12
  include XrefGen::Sections
13
13
 
14
- def initialize(lang, script, klass, labels, options = {})
14
+ def initialize(lang, script, klass, i18n, options = {})
15
15
  @anchors = {}
16
16
  @lang = lang
17
17
  @script = script
18
18
  @klass = klass
19
- @labels = labels
20
19
  @options = options
20
+ @i18n = i18n
21
+ @labels = @i18n.get
22
+ @klass.i18n = @i18n
21
23
  end
22
24
 
23
25
  def get
@@ -53,7 +55,7 @@ module IsoDoc
53
55
  end
54
56
 
55
57
  def l10n(a, lang = @lang, script = @script)
56
- IsoDoc::Function::I18n::l10n(a, lang, script)
58
+ @i18n.l10n(a, lang, script)
57
59
  end
58
60
  end
59
61
  end
@@ -17,7 +17,7 @@ module IsoDoc::XrefGen
17
17
  d.xpath(ns("//preface/*")).each { |c| c.element? and preface_names(c) }
18
18
  # potentially overridden in middle_section_asset_names()
19
19
  sequential_asset_names(d.xpath(ns("//preface/*")))
20
- n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
20
+ n = section_names(d.at(ns("//clause[@type = 'scope']")), 0, 1)
21
21
  n = section_names(d.at(ns(@klass.norm_ref_xpath)), n, 1)
22
22
  n = section_names(d.at(ns("//sections/terms | "\
23
23
  "//sections/clause[descendant::terms]")), n, 1)
@@ -60,7 +60,7 @@ module IsoDoc::XrefGen
60
60
  end
61
61
 
62
62
  def middle_section_asset_names(d)
63
- middle_sections = "//clause[title = 'Scope'] | "\
63
+ middle_sections = "//clause[@type = 'scope'] | "\
64
64
  "#{@klass.norm_ref_xpath} | "\
65
65
  "//sections/terms | //preface/* | "\
66
66
  "//sections/definitions | //clause[parent::sections]"
@@ -99,7 +99,7 @@ module IsoDoc::XrefGen
99
99
  def annex_name_lbl(clause, num)
100
100
  obl = l10n("(#{@labels["inform_annex"]})")
101
101
  obl = l10n("(#{@labels["norm_annex"]})") if clause["obligation"] == "normative"
102
- l10n("<b>#{@labels["annex"]} #{num}</b><br/>#{obl}")
102
+ l10n("<strong>#{@labels["annex"]} #{num}</strong><br/>#{obl}")
103
103
  end
104
104
 
105
105
  def single_annex_special_section(clause)
@@ -1,5 +1,16 @@
1
- foreword: Enkonduko
1
+ foreword: Antaŭparolo
2
+ introduction: Enkonduko
2
3
  clause: klaŭzo
3
4
  table: Tabelo
4
5
  source: SOURCE
5
6
  modified: modified
7
+ scope: Amplekso
8
+ symbols: Simboloj kai mallongigitaj terminoj
9
+ annex: Aldono
10
+ normref: Normaj citaĵoj
11
+ bibliography: Bibliografio
12
+ inform_annex: informa
13
+ all_parts: ĉiuj partoj
14
+ locality: {
15
+ table: Tabelo
16
+ }
@@ -1,8 +1,8 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
- it "processes unlabelled notes" do
5
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
4
+ it "processes unlabelled notes (Presentation XML)" do
5
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <preface><foreword>
8
8
  <note id="A" keep-with-next="true" keep-lines-together="true">
@@ -10,6 +10,39 @@ RSpec.describe IsoDoc do
10
10
  </note>
11
11
  </foreword></preface>
12
12
  </iso-standard>
13
+ INPUT
14
+ <?xml version='1.0'?>
15
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
16
+ <preface>
17
+ <foreword>
18
+ <note id='A' keep-with-next='true' keep-lines-together='true'>
19
+ <name>NOTE</name>
20
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
21
+ These results are based on a study carried out on three different
22
+ types of kernel.
23
+ </p>
24
+ </note>
25
+ </foreword>
26
+ </preface>
27
+ </iso-standard>
28
+ OUTPUT
29
+ end
30
+
31
+ it "processes unlabelled notes (HTML)" do
32
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
33
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
34
+ <preface>
35
+ <foreword>
36
+ <note id='A' keep-with-next='true' keep-lines-together='true'>
37
+ <name>NOTE</name>
38
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
39
+ These results are based on a study carried out on three different
40
+ types of kernel.
41
+ </p>
42
+ </note>
43
+ </foreword>
44
+ </preface>
45
+ </iso-standard>
13
46
  INPUT
14
47
  #{HTML_HDR}
15
48
  <br/>
@@ -28,13 +61,19 @@ RSpec.describe IsoDoc do
28
61
 
29
62
  it "processes unlabelled notes (Word)" do
30
63
  expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
31
- <iso-standard xmlns="http://riboseinc.com/isoxml">
32
- <preface><foreword>
33
- <note id="A">
34
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
35
- </note>
36
- </foreword></preface>
37
- </iso-standard>
64
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
65
+ <preface>
66
+ <foreword>
67
+ <note id='A' keep-with-next='true' keep-lines-together='true'>
68
+ <name>NOTE</name>
69
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
70
+ These results are based on a study carried out on three different
71
+ types of kernel.
72
+ </p>
73
+ </note>
74
+ </foreword>
75
+ </preface>
76
+ </iso-standard>
38
77
  INPUT
39
78
  <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
40
79
  <head><style/></head>
@@ -47,7 +86,7 @@ RSpec.describe IsoDoc do
47
86
  <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
48
87
  <div>
49
88
  <h1 class="ForewordTitle">Foreword</h1>
50
- <div id="A" class="Note">
89
+ <div id="A" class="Note" style='page-break-after: avoid;page-break-inside: avoid;'>
51
90
  <p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">&#160; </span>These results are based on a study carried out on three different types of kernel.</p>
52
91
  </div>
53
92
  </div>
@@ -62,44 +101,65 @@ RSpec.describe IsoDoc do
62
101
  OUTPUT
63
102
  end
64
103
 
65
-
66
- it "processes labelled notes" do
67
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
104
+ it "processes sequences of notes (Presentation XML)" do
105
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
68
106
  <iso-standard xmlns="http://riboseinc.com/isoxml">
69
107
  <preface><foreword>
70
108
  <note id="note1">
71
109
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
110
+ </note>
111
+ <note id="note2">
112
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
72
113
  </note>
73
114
  </foreword></preface>
74
115
  </iso-standard>
75
116
  INPUT
76
- #{HTML_HDR}
77
- <br/>
78
- <div>
79
- <h1 class="ForewordTitle">Foreword</h1>
80
- <div id="note1" class="Note">
81
- <p><span class="note_label">NOTE</span>&#160; These results are based on a study carried out on three different types of kernel.</p>
82
- </div>
83
- </div>
84
- <p class="zzSTDTitle1"/>
85
- </div>
86
- </body>
87
- </html>
88
- OUTPUT
117
+ <?xml version='1.0'?>
118
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
119
+ <preface>
120
+ <foreword>
121
+ <note id='note1'>
122
+ <name>NOTE 1</name>
123
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
124
+ These results are based on a study carried out on three different
125
+ types of kernel.
126
+ </p>
127
+ </note>
128
+ <note id='note2'>
129
+ <name>NOTE 2</name>
130
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'>
131
+ These results are based on a study carried out on three different
132
+ types of kernel.
133
+ </p>
134
+ </note>
135
+ </foreword>
136
+ </preface>
137
+ </iso-standard>
138
+ OUTPUT
89
139
  end
90
140
 
91
- it "processes sequences of notes" do
141
+ it "processes sequences of notes (HTML)" do
92
142
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
93
- <iso-standard xmlns="http://riboseinc.com/isoxml">
94
- <preface><foreword>
95
- <note id="note1">
96
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
97
- </note>
98
- <note id="note2">
99
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
100
- </note>
101
- </foreword></preface>
102
- </iso-standard>
143
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
144
+ <preface>
145
+ <foreword>
146
+ <note id='note1'>
147
+ <name>NOTE 1</name>
148
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
149
+ These results are based on a study carried out on three different
150
+ types of kernel.
151
+ </p>
152
+ </note>
153
+ <note id='note2'>
154
+ <name>NOTE 2</name>
155
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'>
156
+ These results are based on a study carried out on three different
157
+ types of kernel.
158
+ </p>
159
+ </note>
160
+ </foreword>
161
+ </preface>
162
+ </iso-standard>
103
163
  INPUT
104
164
  #{HTML_HDR}
105
165
  <br/>
@@ -124,6 +184,7 @@ INPUT
124
184
  <iso-standard xmlns="http://riboseinc.com/isoxml">
125
185
  <preface><foreword>
126
186
  <note>
187
+ <name>NOTE</name>
127
188
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
128
189
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
129
190
  </note>
@@ -150,7 +211,7 @@ INPUT
150
211
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
151
212
  <iso-standard xmlns="http://riboseinc.com/isoxml">
152
213
  <preface><foreword>
153
- <note id="A">
214
+ <note id="A"><name>NOTE</name>
154
215
  <dl>
155
216
  <dt>A</dt>
156
217
  <dd><p>B</p></dd>
@@ -183,7 +244,7 @@ INPUT
183
244
  expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
184
245
  <iso-standard xmlns="http://riboseinc.com/isoxml">
185
246
  <preface><foreword>
186
- <note id="A">
247
+ <note id="A"><name>NOTE</name>
187
248
  <dl>
188
249
  <dt>A</dt>
189
250
  <dd><p>B</p></dd>
@@ -226,8 +287,8 @@ INPUT
226
287
  expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
227
288
  <iso-standard xmlns="http://riboseinc.com/isoxml">
228
289
  <preface><foreword>
229
- <p id="A">ABC <note id="B"><p id="C">XYZ</p></note>
230
- <note id="B1"><p id="C1">XYZ1</p></note></p>
290
+ <p id="A">ABC <note id="B"><name>NOTE 1</name><p id="C">XYZ</p></note>
291
+ <note id="B1"><name>NOTE 2</name><p id="C1">XYZ1</p></note></p>
231
292
  </foreword></preface>
232
293
  </iso-standard>
233
294
  INPUT
@@ -262,8 +323,8 @@ OUTPUT
262
323
  expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
263
324
  <iso-standard xmlns="http://riboseinc.com/isoxml">
264
325
  <preface><foreword>
265
- <p id="A">ABC <note id="B"><p id="C">XYZ</p></note>
266
- <note id="B1"><p id="C1">XYZ1</p></note></p>
326
+ <p id="A">ABC <note id="B"><name>NOTE 1</name><p id="C">XYZ</p></note>
327
+ <note id="B1"><name>NOTE 2</name><p id="C1">XYZ1</p></note></p>
267
328
  </foreword></preface>
268
329
  </iso-standard>
269
330
  INPUT
@@ -313,8 +374,8 @@ INPUT
313
374
  OUTPUT
314
375
  end
315
376
 
316
- it "processes figures" do
317
- expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
377
+ it "processes figures (Presentation XML)" do
378
+ expect(xmlpp((IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
318
379
  <iso-standard xmlns="http://riboseinc.com/isoxml">
319
380
  <preface><foreword>
320
381
  <figure id="figureA-1" keep-with-next="true" keep-lines-together="true">
@@ -337,6 +398,65 @@ B</pre>
337
398
  <figure id="figure-C" unnumbered="true">
338
399
  <pre>A &lt;
339
400
  B</pre>
401
+ </figure>
402
+ </foreword></preface>
403
+ </iso-standard>
404
+ INPUT
405
+ <?xml version='1.0'?>
406
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
407
+ <preface><foreword>
408
+ <figure id="figureA-1" keep-with-next="true" keep-lines-together="true">
409
+ <name>Figure 1&#xA0;&#x2014; Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name>
410
+ <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
411
+ <image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/>
412
+ <image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/>
413
+ <fn reference="a">
414
+ <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>
415
+ </fn>
416
+ <dl>
417
+ <dt>A</dt>
418
+ <dd><p>B</p></dd>
419
+ </dl>
420
+ </figure>
421
+ <figure id="figure-B">
422
+ <name>Figure 2</name>
423
+ <pre alt="A B">A &lt;
424
+ B</pre>
425
+ </figure>
426
+ <figure id="figure-C" unnumbered="true">
427
+ <pre>A &lt;
428
+ B</pre>
429
+ </figure>
430
+ </foreword></preface>
431
+ </iso-standard>
432
+ OUTPUT
433
+ end
434
+
435
+ it "processes figures (HTML)" do
436
+ expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
437
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
438
+ <preface><foreword>
439
+ <figure id="figureA-1" keep-with-next="true" keep-lines-together="true">
440
+ <name>Figure 1&#xA0;&#x2014; Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name>
441
+ <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
442
+ <image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/>
443
+ <image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/>
444
+ <fn reference="a">
445
+ <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>
446
+ </fn>
447
+ <dl>
448
+ <dt>A</dt>
449
+ <dd><p>B</p></dd>
450
+ </dl>
451
+ </figure>
452
+ <figure id="figure-B">
453
+ <name>Figure 2</name>
454
+ <pre alt="A B">A &lt;
455
+ B</pre>
456
+ </figure>
457
+ <figure id="figure-C" unnumbered="true">
458
+ <pre>A &lt;
459
+ B</pre>
340
460
  </figure>
341
461
  </foreword></preface>
342
462
  </iso-standard>
@@ -382,13 +502,13 @@ B</pre>
382
502
  it "processes figures (Word)" do
383
503
  FileUtils.rm_rf "spec/assets/odf1.emf"
384
504
  expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/['"][^'".]+\.gif['"]/, "'_.gif'").gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")))).to be_equivalent_to xmlpp(<<~"OUTPUT")
385
- <iso-standard xmlns="http://riboseinc.com/isoxml">
505
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
386
506
  <preface><foreword>
387
- <figure id="figureA-1">
388
- <name>Split-it-right sample divider<fn reference="1"><p>X</p></fn></name>
389
- <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletext"/>
390
- <image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
391
- <image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
507
+ <figure id="figureA-1" keep-with-next="true" keep-lines-together="true">
508
+ <name>Figure 1&#xA0;&#x2014; Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name>
509
+ <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
510
+ <image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/>
511
+ <image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/>
392
512
  <fn reference="a">
393
513
  <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>
394
514
  </fn>
@@ -398,6 +518,11 @@ B</pre>
398
518
  </dl>
399
519
  </figure>
400
520
  <figure id="figure-B">
521
+ <name>Figure 2</name>
522
+ <pre alt="A B">A &lt;
523
+ B</pre>
524
+ </figure>
525
+ <figure id="figure-C" unnumbered="true">
401
526
  <pre>A &lt;
402
527
  B</pre>
403
528
  </figure>
@@ -415,9 +540,8 @@ B</pre>
415
540
  <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
416
541
  <div>
417
542
  <h1 class="ForewordTitle">Foreword</h1>
418
- <div id="figureA-1" class="figure">
419
-
420
- <img src="rice_images/rice_image1.png" height="20" width="30" alt="alttext" title="titletext"/>
543
+ <div id="figureA-1" class="figure" style='page-break-after: avoid;page-break-inside: avoid;'>
544
+ <img src="rice_images/rice_image1.png" height="20" width="30" alt="alttext" title="titletxt"/>
421
545
  <img src="rice_images/rice_image1.png" height='20' width='auto'/>
422
546
  <img src='_.gif' height='20' width='auto'/>
423
547
  <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>
@@ -425,7 +549,7 @@ B</pre>
425
549
  </div></aside>
426
550
  <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>
427
551
  <p class='FigureTitle' style='text-align:center;'>
428
- Figure 1&#160;&#8212; Split-it-right sample divider
552
+ Figure 1&#160;&#8212; Split-it-right <i>sample</i> divider
429
553
  <span style='mso-bookmark:_Ref'>
430
554
  <a href='#ftn1' epub:type='footnote' class='FootnoteRef'>
431
555
  <sup>1</sup>
@@ -437,6 +561,9 @@ B</pre>
437
561
  <pre>A &lt;
438
562
  B</pre>
439
563
  <p class="FigureTitle" style="text-align:center;">Figure 2</p>
564
+ </div>
565
+ <div id='figure-C' class='figure'>
566
+ <pre>A &lt; B</pre>
440
567
  </div>
441
568
  </div>
442
569
  <p>&#160;</p>
@@ -488,7 +615,6 @@ B</pre>
488
615
  <img src='spec/assets/odf.emf'/>
489
616
  <img src='spec/assets/odf1.emf'/>
490
617
  <img src='_.emf' height='auto' width='auto'/>
491
- <p class='FigureTitle' style='text-align:center;'>Figure 1</p>
492
618
  </div>
493
619
  </div>
494
620
  <p>&#160;</p>
@@ -545,7 +671,6 @@ context "disable inkscape" do
545
671
  <img src='spec/assets/odf.emf'/>
546
672
  <img src='spec/assets/odf1.svg'/>
547
673
  <img src='_.svg' height='auto' width='auto'/>
548
- <p class='FigureTitle' style='text-align:center;'>Figure 1</p>
549
674
  </div>
550
675
  </div>
551
676
  <p>&#160;</p>
@@ -563,9 +688,8 @@ OUTPUT
563
688
  end
564
689
  end
565
690
 
566
-
567
- it "processes examples" do
568
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
691
+ it "processes examples (Presentation XML)" do
692
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
569
693
  <iso-standard xmlns="http://riboseinc.com/isoxml">
570
694
  <preface><foreword>
571
695
  <example id="samplecode" keep-with-next="true" keep-lines-together="true">
@@ -577,6 +701,37 @@ OUTPUT
577
701
  </example>
578
702
  </foreword></preface>
579
703
  </iso-standard>
704
+ INPUT
705
+ <?xml version='1.0'?>
706
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
707
+ <preface>
708
+ <foreword>
709
+ <example id='samplecode' keep-with-next='true' keep-lines-together='true'>
710
+ <name>EXAMPLE&#xA0;&#x2014; Title</name>
711
+ <p>Hello</p>
712
+ <sourcecode id='X'>
713
+ <name>Sample</name>
714
+ </sourcecode>
715
+ </example>
716
+ </foreword>
717
+ </preface>
718
+ </iso-standard>
719
+ OUTPUT
720
+ end
721
+
722
+ it "processes examples (HTML)" do
723
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
724
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
725
+ <preface>
726
+ <foreword>
727
+ <example id='samplecode' keep-with-next='true' keep-lines-together='true'>
728
+ <name>EXAMPLE&#xA0;&#x2014; Title</name>
729
+ <p>Hello</p>
730
+ <sourcecode id='X'><name>Sample</name></sourcecode>
731
+ </example>
732
+ </foreword>
733
+ </preface>
734
+ </iso-standard>
580
735
  INPUT
581
736
  #{HTML_HDR}
582
737
  <br/>
@@ -585,12 +740,7 @@ OUTPUT
585
740
  <div id="samplecode" class="example" style="page-break-after: avoid;page-break-inside: avoid;">
586
741
  <p class="example-title">EXAMPLE&#160;&#8212; Title</p>
587
742
  <p>Hello</p>
588
- <pre id='X' class='prettyprint '>
589
- <br/>
590
- &#160;
591
- <br/>
592
- &#160;
593
- </pre>
743
+ <pre id='X' class='prettyprint '/>
594
744
  <p class='SourceTitle' style='text-align:center;'>Sample</p>
595
745
  </div>
596
746
  </div>
@@ -603,17 +753,17 @@ OUTPUT
603
753
 
604
754
  it "processes examples (Word)" do
605
755
  expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
606
- <iso-standard xmlns="http://riboseinc.com/isoxml">
607
- <preface><foreword>
608
- <example id="samplecode" keep-with-next="true" keep-lines-together="true">
609
- <name>Title</name>
610
- <p>Hello</p>
611
- <sourcecode id="X">
612
- <name>Sample</name>
613
- </sourcecode>
614
- </example>
615
- </foreword></preface>
616
- </iso-standard>
756
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
757
+ <preface>
758
+ <foreword>
759
+ <example id='samplecode' keep-with-next='true' keep-lines-together='true'>
760
+ <name>EXAMPLE&#xA0;&#x2014; Title</name>
761
+ <p>Hello</p>
762
+ <sourcecode id='X'><name>Sample</name></sourcecode>
763
+ </example>
764
+ </foreword>
765
+ </preface>
766
+ </iso-standard>
617
767
  INPUT
618
768
  <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'><head><style>
619
769
  </style>
@@ -634,12 +784,7 @@ OUTPUT
634
784
  <div id='samplecode' class='example' style='page-break-after: avoid;page-break-inside: avoid;'>
635
785
  <p class='example-title'>EXAMPLE&#160;&#8212; Title</p>
636
786
  <p>Hello</p>
637
- <p id='X' class='Sourcecode'>
638
- <br/>
639
- &#160;
640
- <br/>
641
- &#160;
642
- </p>
787
+ <p id='X' class='Sourcecode'/>
643
788
  <p class='SourceTitle' style='text-align:center;'>Sample</p>
644
789
  </div>
645
790
  </div>
@@ -657,7 +802,7 @@ OUTPUT
657
802
  end
658
803
 
659
804
  it "processes sequences of examples" do
660
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
805
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
661
806
  <iso-standard xmlns="http://riboseinc.com/isoxml">
662
807
  <preface><foreword>
663
808
  <example id="samplecode">
@@ -673,32 +818,30 @@ OUTPUT
673
818
  </foreword></preface>
674
819
  </iso-standard>
675
820
  INPUT
676
- #{HTML_HDR}
677
- <br/>
678
- <div>
679
- <h1 class="ForewordTitle">Foreword</h1>
680
- <div id="samplecode" class="example">
681
- <p class="example-title">EXAMPLE 1</p>
682
- <p>Hello</p>
683
- </div>
684
- <div id="samplecode2" class="example">
685
- <p class="example-title">EXAMPLE 2&#160;&#8212; Title</p>
686
- <p>Hello</p>
687
- </div>
688
- <div id="samplecode3" class="example">
689
- <p class="example-title">EXAMPLE</p>
690
- <p>Hello</p>
691
- </div>
692
- </div>
693
- <p class="zzSTDTitle1"/>
694
- </div>
695
- </body>
696
- </html>
821
+ <?xml version='1.0'?>
822
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
823
+ <preface>
824
+ <foreword>
825
+ <example id='samplecode'>
826
+ <name>EXAMPLE 1</name>
827
+ <p>Hello</p>
828
+ </example>
829
+ <example id='samplecode2'>
830
+ <name>EXAMPLE 2&#xA0;&#x2014; Title</name>
831
+ <p>Hello</p>
832
+ </example>
833
+ <example id='samplecode3' unnumbered='true'>
834
+ <name>EXAMPLE</name>
835
+ <p>Hello</p>
836
+ </example>
837
+ </foreword>
838
+ </preface>
839
+ </iso-standard>
697
840
  OUTPUT
698
841
  end
699
842
 
700
- it "processes sourcecode" do
701
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
843
+ it "processes sourcecode (Presentation XML)" do
844
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
702
845
  <iso-standard xmlns="http://riboseinc.com/isoxml">
703
846
  <preface><foreword>
704
847
  <sourcecode lang="ruby" id="samplecode">
@@ -710,12 +853,49 @@ Que?
710
853
  </sourcecode>
711
854
  </foreword></preface>
712
855
  </iso-standard>
856
+ INPUT
857
+ <?xml version='1.0'?>
858
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
859
+ <preface>
860
+ <foreword>
861
+ <sourcecode lang='ruby' id='samplecode'>
862
+ <name>
863
+ Figure 1&#xA0;&#x2014; Ruby
864
+ <em>code</em>
865
+ </name>
866
+ puts x
867
+ </sourcecode>
868
+ <sourcecode unnumbered='true'> Que? </sourcecode>
869
+ </foreword>
870
+ </preface>
871
+ </iso-standard>
872
+ OUTPUT
873
+ end
874
+
875
+ it "processes sourcecode (HTML)" do
876
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
877
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
878
+ <preface>
879
+ <foreword>
880
+ <sourcecode lang='ruby' id='samplecode'>
881
+ <name>
882
+ Figure 1&#xA0;&#x2014; Ruby
883
+ <em>code</em>
884
+ </name>
885
+ puts x
886
+ </sourcecode>
887
+ <sourcecode unnumbered='true'>
888
+ Que?
889
+ </sourcecode>
890
+ </foreword>
891
+ </preface>
892
+ </iso-standard>
713
893
  INPUT
714
894
  #{HTML_HDR}
715
895
  <br/>
716
896
  <div>
717
897
  <h1 class="ForewordTitle">Foreword</h1>
718
- <pre id="samplecode" class="prettyprint lang-rb"><br/>&#160;&#160;&#160; <br/>&#160; puts x<br/></pre>
898
+ <pre id="samplecode" class="prettyprint lang-rb"><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160; puts x<br/></pre>
719
899
  <p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p>
720
900
  <pre class='prettyprint '>
721
901
  <br/>
@@ -732,17 +912,22 @@ Que?
732
912
 
733
913
  it "processes sourcecode (Word)" do
734
914
  expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
735
- <iso-standard xmlns="http://riboseinc.com/isoxml">
736
- <preface><foreword>
737
- <sourcecode lang="ruby" id="samplecode">
738
- <name>Ruby <em>code</em></name>
915
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
916
+ <preface>
917
+ <foreword>
918
+ <sourcecode lang='ruby' id='samplecode'>
919
+ <name>
920
+ Figure 1&#xA0;&#x2014; Ruby
921
+ <em>code</em>
922
+ </name>
739
923
  puts x
740
924
  </sourcecode>
741
- <sourcecode unnumbered="true">
925
+ <sourcecode unnumbered='true'>
742
926
  Que?
743
927
  </sourcecode>
744
- </foreword></preface>
745
- </iso-standard>
928
+ </foreword>
929
+ </preface>
930
+ </iso-standard>
746
931
  INPUT
747
932
  <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
748
933
  <head><style/></head>
@@ -759,7 +944,7 @@ Que?
759
944
  </p>
760
945
  <div>
761
946
  <h1 class="ForewordTitle">Foreword</h1>
762
- <p id="samplecode" class="Sourcecode"><br/>&#160;&#160;&#160; <br/>&#160; puts x<br/></p><p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p>
947
+ <p id="samplecode" class="Sourcecode"><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160; puts x<br/></p><p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p>
763
948
  <p class='Sourcecode'>
764
949
  <br/>
765
950
  Que?
@@ -795,7 +980,7 @@ Que?
795
980
  <div>
796
981
  <h1 class="ForewordTitle">Foreword</h1>
797
982
  <pre id="samplecode" class="prettyprint "><br/>&#160;&#160;&#160; <br/>&#160; &lt;xml&gt;<br/></pre>
798
- <p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; XML code</p>
983
+ <p class="SourceTitle" style="text-align:center;">XML code</p>
799
984
  </div>
800
985
  <p class="zzSTDTitle1"/>
801
986
  </div>
@@ -824,7 +1009,6 @@ Que?
824
1009
  <div>
825
1010
  <h1 class="ForewordTitle">Foreword</h1>
826
1011
  <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>
827
- <p class='SourceTitle' style='text-align:center;'>Figure 1</p>
828
1012
  </div>
829
1013
  <p class="zzSTDTitle1"/>
830
1014
  </div>
@@ -884,8 +1068,64 @@ Que?
884
1068
  OUTPUT
885
1069
  end
886
1070
 
1071
+ it "processes formulae (PresentationXML)" do
1072
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1073
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1074
+ <preface><foreword>
1075
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true" keep-with-next="true" keep-lines-together="true">
1076
+ <stem type="AsciiMath">r = 1 %</stem>
1077
+ <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
1078
+ <dt>
1079
+ <stem type="AsciiMath">r</stem>
1080
+ </dt>
1081
+ <dd>
1082
+ <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
1083
+ </dd>
1084
+ </dl>
1085
+ <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
1086
+ <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>
1087
+ </note>
1088
+ </formula>
1089
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
1090
+ <stem type="AsciiMath">r = 1 %</stem>
1091
+ </formula>
1092
+ </foreword></preface>
1093
+ </iso-standard>
1094
+ INPUT
1095
+ <?xml version='1.0'?>
1096
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
1097
+ <preface>
1098
+ <foreword>
1099
+ <formula id='_be9158af-7e93-4ee2-90c5-26d31c181934' unnumbered='true' keep-with-next='true' keep-lines-together='true'>
1100
+ <stem type='AsciiMath'>r = 1 %</stem>
1101
+ <dl id='_e4fe94fe-1cde-49d9-b1ad-743293b7e21d'>
1102
+ <dt>
1103
+ <stem type='AsciiMath'>r</stem>
1104
+ </dt>
1105
+ <dd>
1106
+ <p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p>
1107
+ </dd>
1108
+ </dl>
1109
+ <note id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0'>
1110
+ <name>NOTE</name>
1111
+ <p id='_511aaa98-4116-42af-8e5b-c87cdf5bfdc8'>
1112
+ [durationUnits] is essentially a duration statement without the "P"
1113
+ prefix. "P" is unnecessary because between "G" and "U" duration is
1114
+ always expressed.
1115
+ </p>
1116
+ </note>
1117
+ </formula>
1118
+ <formula id='_be9158af-7e93-4ee2-90c5-26d31c181935'>
1119
+ <name>1</name>
1120
+ <stem type='AsciiMath'>r = 1 %</stem>
1121
+ </formula>
1122
+ </foreword>
1123
+ </preface>
1124
+ </iso-standard>
1125
+ OUTPUT
1126
+ end
887
1127
 
888
- it "processes formulae" do
1128
+ it "processes formulae (HTML)" do
889
1129
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
890
1130
  <iso-standard xmlns="http://riboseinc.com/isoxml">
891
1131
  <preface><foreword>
@@ -900,10 +1140,11 @@ Que?
900
1140
  </dd>
901
1141
  </dl>
902
1142
  <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
1143
+ <name>NOTE</name>
903
1144
  <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>
904
1145
  </note>
905
1146
  </formula>
906
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
1147
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935"><name>1</name>
907
1148
  <stem type="AsciiMath">r = 1 %</stem>
908
1149
  </formula>
909
1150
  </foreword></preface>
@@ -946,10 +1187,11 @@ Que?
946
1187
  </dd>
947
1188
  </dl>
948
1189
  <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
1190
+ <name>NOTE</name>
949
1191
  <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>
950
1192
  </note>
951
1193
  </formula>
952
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
1194
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935"><name>1</name>
953
1195
  <stem type="AsciiMath">r = 1 %</stem>
954
1196
  </formula>
955
1197
  </foreword></preface>
@@ -1090,14 +1332,52 @@ World</p>
1090
1332
  OUTPUT
1091
1333
  end
1092
1334
 
1335
+ it "processes blockquotes (Presentation XML)" do
1336
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1337
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1338
+ <preface><foreword>
1339
+ <quote id="_044bd364-c832-4b78-8fea-92242402a1d1">
1340
+ <source type="inline" bibitemid="ISO7301" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality></source>
1341
+ <author>ISO</author>
1342
+ <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>
1343
+ </quote>
1093
1344
 
1345
+ </foreword></preface>
1346
+ </iso-standard>
1347
+ INPUT
1348
+ <?xml version='1.0'?>
1349
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
1350
+ <preface>
1351
+ <foreword>
1352
+ <quote id='_044bd364-c832-4b78-8fea-92242402a1d1'>
1353
+ <source type='inline' bibitemid='ISO7301' citeas='ISO 7301:2011'>
1354
+ <locality type='clause'>
1355
+ <referenceFrom>1</referenceFrom>
1356
+ </locality>ISO 7301:2011, Clause 1
1357
+ </source>
1358
+ <author>ISO</author>
1359
+ <p id='_d4fd0a61-f300-4285-abe6-602707590e53'>
1360
+ This International Standard gives the minimum specifications for rice
1361
+ (
1362
+ <em>Oryza sativa</em>
1363
+ L.) which is subject to international trade. It is applicable to the
1364
+ following types: husked rice and milled rice, parboiled or not,
1365
+ intended for direct human consumption. It is neither applicable to
1366
+ other products derived from rice, nor to waxy rice (glutinous rice).
1367
+ </p>
1368
+ </quote>
1369
+ </foreword>
1370
+ </preface>
1371
+ </iso-standard>
1372
+ OUTPUT
1373
+ end
1094
1374
 
1095
- it "processes blockquotes" do
1375
+ it "processes blockquotes (HTML)" do
1096
1376
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1097
1377
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1098
1378
  <preface><foreword>
1099
1379
  <quote id="_044bd364-c832-4b78-8fea-92242402a1d1">
1100
- <source type="inline" bibitemid="ISO7301" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality></source>
1380
+ <source type="inline" bibitemid="ISO7301" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 7301:2011, Clause 1</source>
1101
1381
  <author>ISO</author>
1102
1382
  <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>
1103
1383
  </quote>
@@ -1127,7 +1407,7 @@ World</p>
1127
1407
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1128
1408
  <sections>
1129
1409
  <terms>
1130
- <term id="_extraneous_matter"><preferred>extraneous matter</preferred><admitted>EM</admitted>
1410
+ <term id="_extraneous_matter"><name>1.1.</name><preferred>extraneous matter</preferred><admitted>EM</admitted>
1131
1411
  <domain>rice</domain>
1132
1412
  <definition><p id="_318b3939-be09-46c4-a284-93f9826b981e">organic and inorganic components other than whole or broken kernels</p></definition>
1133
1413
  </term>
@@ -1137,7 +1417,7 @@ World</p>
1137
1417
  INPUT
1138
1418
  #{HTML_HDR}
1139
1419
  <p class="zzSTDTitle1"/>
1140
- <div><h1>1.&#160; </h1>
1420
+ <div><h1/>
1141
1421
  <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>
1142
1422
 
1143
1423
  <p id="_318b3939-be09-46c4-a284-93f9826b981e">&lt;rice&gt; organic and inorganic components other than whole or broken kernels</p>
@@ -1148,8 +1428,8 @@ World</p>
1148
1428
  OUTPUT
1149
1429
  end
1150
1430
 
1151
- it "processes permissions" do
1152
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1431
+ it "processes permissions (Presentation XML)" do
1432
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1153
1433
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1154
1434
  <preface><foreword>
1155
1435
  <permission id="_" keep-with-next="true" keep-lines-together="true">
@@ -1201,8 +1481,268 @@ World</p>
1201
1481
  <bibliography><references id="_bibliography" obligation="informative" normative="false">
1202
1482
  <title>Bibliography</title>
1203
1483
  <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="rfc-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>
1484
+ </references></bibliography>
1485
+ </iso-standard>
1486
+ INPUT
1487
+ <?xml version='1.0'?>
1488
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
1489
+ <preface>
1490
+ <foreword>
1491
+ <permission id='_' keep-with-next='true' keep-lines-together='true'>
1492
+ <name>Permission 1</name>
1493
+ <label>/ogc/recommendation/wfs/2</label>
1494
+ <inherit>/ss/584/2015/level/1</inherit>
1495
+ <inherit>
1496
+ <eref type='inline' bibitemid='rfc2616' citeas='RFC 2616'>RFC 2616 (HTTP/1.1)</eref>
1497
+ </inherit>
1498
+ <subject>user</subject>
1499
+ <classification>
1500
+ <tag>control-class</tag>
1501
+ <value>Technical</value>
1502
+ </classification>
1503
+ <classification>
1504
+ <tag>priority</tag>
1505
+ <value>P0</value>
1506
+ </classification>
1507
+ <classification>
1508
+ <tag>family</tag>
1509
+ <value>System and Communications Protection</value>
1510
+ </classification>
1511
+ <classification>
1512
+ <tag>family</tag>
1513
+ <value>System and Communications Protocols</value>
1514
+ </classification>
1515
+ <description>
1516
+ <p id='_'>
1517
+ I recommend
1518
+ <em>this</em>
1519
+ .
1520
+ </p>
1521
+ </description>
1522
+ <specification exclude='true' type='tabular'>
1523
+ <p id='_'>This is the object of the recommendation:</p>
1524
+ <table id='_'>
1525
+ <tbody>
1526
+ <tr>
1527
+ <td style='text-align:left;'>Object</td>
1528
+ <td style='text-align:left;'>Value</td>
1529
+ </tr>
1530
+ <tr>
1531
+ <td style='text-align:left;'>Mission</td>
1532
+ <td style='text-align:left;'>Accomplished</td>
1533
+ </tr>
1534
+ </tbody>
1535
+ </table>
1536
+ </specification>
1537
+ <description>
1538
+ <p id='_'>As for the measurement targets,</p>
1539
+ </description>
1540
+ <measurement-target exclude='false'>
1541
+ <p id='_'>The measurement target shall be measured as:</p>
1542
+ <formula id='_'>
1543
+ <name>1</name>
1544
+ <stem type='AsciiMath'>r/1 = 0</stem>
1545
+ </formula>
1546
+ </measurement-target>
1547
+ <verification exclude='false'>
1548
+ <p id='_'>The following code will be run for verification:</p>
1549
+ <sourcecode id='_'>
1550
+ CoreRoot(success): HttpResponse if (success) recommendation(label:
1551
+ success-response) end
1552
+ </sourcecode>
1553
+ </verification>
1554
+ <import exclude='true'>
1555
+ <sourcecode id='_'>success-response()</sourcecode>
1556
+ </import>
1557
+ </permission>
1558
+ </foreword>
1559
+ </preface>
1560
+ <bibliography>
1561
+ <references id='_bibliography' obligation='informative' normative='false'>
1562
+ <title depth="1">Bibliography</title>
1563
+ <bibitem id='rfc2616' type='standard'>
1564
+ <fetched>2020-03-27</fetched>
1565
+ <title format='text/plain' language='en' script='Latn'>Hypertext Transfer Protocol&#x2009;&#x2014;&#x2009;HTTP/1.1</title>
1566
+ <uri type='xml'>https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri>
1567
+ <uri type='src'>https://www.rfc-editor.org/info/rfc2616</uri>
1568
+ <docidentifier type='IETF'>RFC 2616</docidentifier>
1569
+ <docidentifier type='rfc-anchor'>RFC2616</docidentifier>
1570
+ <docidentifier type='DOI'>10.17487/RFC2616</docidentifier>
1571
+ <date type='published'>
1572
+ <on>1999-06</on>
1573
+ </date>
1574
+ <contributor>
1575
+ <role type='author'/>
1576
+ <person>
1577
+ <name>
1578
+ <completename language='en'>R. Fielding</completename>
1579
+ </name>
1580
+ <affiliation>
1581
+ <organization>
1582
+ <name>IETF</name>
1583
+ <abbreviation>IETF</abbreviation>
1584
+ </organization>
1585
+ </affiliation>
1586
+ </person>
1587
+ </contributor>
1588
+ <contributor>
1589
+ <role type='author'/>
1590
+ <person>
1591
+ <name>
1592
+ <completename language='en'>J. Gettys</completename>
1593
+ </name>
1594
+ <affiliation>
1595
+ <organization>
1596
+ <name>IETF</name>
1597
+ <abbreviation>IETF</abbreviation>
1598
+ </organization>
1599
+ </affiliation>
1600
+ </person>
1601
+ </contributor>
1602
+ <contributor>
1603
+ <role type='author'/>
1604
+ <person>
1605
+ <name>
1606
+ <completename language='en'>J. Mogul</completename>
1607
+ </name>
1608
+ <affiliation>
1609
+ <organization>
1610
+ <name>IETF</name>
1611
+ <abbreviation>IETF</abbreviation>
1612
+ </organization>
1613
+ </affiliation>
1614
+ </person>
1615
+ </contributor>
1616
+ <contributor>
1617
+ <role type='author'/>
1618
+ <person>
1619
+ <name>
1620
+ <completename language='en'>H. Frystyk</completename>
1621
+ </name>
1622
+ <affiliation>
1623
+ <organization>
1624
+ <name>IETF</name>
1625
+ <abbreviation>IETF</abbreviation>
1626
+ </organization>
1627
+ </affiliation>
1628
+ </person>
1629
+ </contributor>
1630
+ <contributor>
1631
+ <role type='author'/>
1632
+ <person>
1633
+ <name>
1634
+ <completename language='en'>L. Masinter</completename>
1635
+ </name>
1636
+ <affiliation>
1637
+ <organization>
1638
+ <name>IETF</name>
1639
+ <abbreviation>IETF</abbreviation>
1640
+ </organization>
1641
+ </affiliation>
1642
+ </person>
1643
+ </contributor>
1644
+ <contributor>
1645
+ <role type='author'/>
1646
+ <person>
1647
+ <name>
1648
+ <completename language='en'>P. Leach</completename>
1649
+ </name>
1650
+ <affiliation>
1651
+ <organization>
1652
+ <name>IETF</name>
1653
+ <abbreviation>IETF</abbreviation>
1654
+ </organization>
1655
+ </affiliation>
1656
+ </person>
1657
+ </contributor>
1658
+ <contributor>
1659
+ <role type='author'/>
1660
+ <person>
1661
+ <name>
1662
+ <completename language='en'>T. Berners-Lee</completename>
1663
+ </name>
1664
+ <affiliation>
1665
+ <organization>
1666
+ <name>IETF</name>
1667
+ <abbreviation>IETF</abbreviation>
1668
+ </organization>
1669
+ </affiliation>
1670
+ </person>
1671
+ </contributor>
1672
+ <language>en</language>
1673
+ <script>Latn</script>
1674
+ <abstract format='text/plain' language='en' script='Latn'>
1675
+ HTTP has been in use by the World-Wide Web global information
1676
+ initiative since 1990. This specification defines the protocol
1677
+ referred to as &#x201C;HTTP/1.1&#x201D;, and is an update to RFC 2068.
1678
+ [STANDARDS-TRACK]
1679
+ </abstract>
1680
+ <series type='main'>
1681
+ <title format='text/plain' language='en' script='Latn'>RFC</title>
1682
+ <number>2616</number>
1683
+ </series>
1684
+ <place>Fremont, CA</place>
1685
+ </bibitem>
1686
+ </references>
1687
+ </bibliography>
1688
+ </iso-standard>
1689
+ OUTPUT
1690
+ end
1204
1691
 
1205
-
1692
+ it "processes permissions (HTML)" do
1693
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1694
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1695
+ <preface><foreword>
1696
+ <permission id="_" keep-with-next="true" keep-lines-together="true">
1697
+ <name>Permission 1</name>
1698
+ <label>/ogc/recommendation/wfs/2</label>
1699
+ <inherit>/ss/584/2015/level/1</inherit>
1700
+ <inherit><eref type="inline" bibitemid="rfc2616" citeas="RFC 2616">RFC 2616 (HTTP/1.1)</eref></inherit>
1701
+ <subject>user</subject>
1702
+ <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>
1703
+ <description>
1704
+ <p id="_">I recommend <em>this</em>.</p>
1705
+ </description>
1706
+ <specification exclude="true" type="tabular">
1707
+ <p id="_">This is the object of the recommendation:</p>
1708
+ <table id="_">
1709
+ <tbody>
1710
+ <tr>
1711
+ <td style="text-align:left;">Object</td>
1712
+ <td style="text-align:left;">Value</td>
1713
+ </tr>
1714
+ <tr>
1715
+ <td style="text-align:left;">Mission</td>
1716
+ <td style="text-align:left;">Accomplished</td>
1717
+ </tr>
1718
+ </tbody>
1719
+ </table>
1720
+ </specification>
1721
+ <description>
1722
+ <p id="_">As for the measurement targets,</p>
1723
+ </description>
1724
+ <measurement-target exclude="false">
1725
+ <p id="_">The measurement target shall be measured as:</p>
1726
+ <formula id="_">
1727
+ <stem type="AsciiMath">r/1 = 0</stem>
1728
+ </formula>
1729
+ </measurement-target>
1730
+ <verification exclude="false">
1731
+ <p id="_">The following code will be run for verification:</p>
1732
+ <sourcecode id="_">CoreRoot(success): HttpResponse
1733
+ if (success)
1734
+ recommendation(label: success-response)
1735
+ end
1736
+ </sourcecode>
1737
+ </verification>
1738
+ <import exclude="true">
1739
+ <sourcecode id="_">success-response()</sourcecode>
1740
+ </import>
1741
+ </permission>
1742
+ </foreword></preface>
1743
+ <bibliography><references id="_bibliography" obligation="informative" normative="false">
1744
+ <title>Bibliography</title>
1745
+ <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="rfc-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>
1206
1746
  </references></bibliography>
1207
1747
  </iso-standard>
1208
1748
  INPUT
@@ -1227,7 +1767,7 @@ Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
1227
1767
  </div>
1228
1768
  <div class="requirement-measurement-target">
1229
1769
  <p id="_">The measurement target shall be measured as:</p>
1230
- <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>&#160; (1)</p></div></div>
1770
+ <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span></p></div></div>
1231
1771
 
1232
1772
 
1233
1773
  </div>
@@ -1253,11 +1793,122 @@ Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
1253
1793
  OUTPUT
1254
1794
  end
1255
1795
 
1256
- it "processes requirements" do
1796
+ it "processes requirements (Presentation XML)" do
1797
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1798
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1799
+ <preface><foreword>
1800
+ <requirement id="A" unnumbered="true" keep-with-next="true" keep-lines-together="true">
1801
+ <title>A New Requirement</title>
1802
+ <label>/ogc/recommendation/wfs/2</label>
1803
+ <inherit>/ss/584/2015/level/1</inherit>
1804
+ <subject>user</subject>
1805
+ <description>
1806
+ <p id="_">I recommend <em>this</em>.</p>
1807
+ </description>
1808
+ <specification exclude="true" type="tabular">
1809
+ <p id="_">This is the object of the recommendation:</p>
1810
+ <table id="_">
1811
+ <tbody>
1812
+ <tr>
1813
+ <td style="text-align:left;">Object</td>
1814
+ <td style="text-align:left;">Value</td>
1815
+ </tr>
1816
+ <tr>
1817
+ <td style="text-align:left;">Mission</td>
1818
+ <td style="text-align:left;">Accomplished</td>
1819
+ </tr>
1820
+ </tbody>
1821
+ </table>
1822
+ </specification>
1823
+ <description>
1824
+ <p id="_">As for the measurement targets,</p>
1825
+ </description>
1826
+ <measurement-target exclude="false" keep-with-next="true" keep-lines-together="true">
1827
+ <p id="_">The measurement target shall be measured as:</p>
1828
+ <formula id="B">
1829
+ <stem type="AsciiMath">r/1 = 0</stem>
1830
+ </formula>
1831
+ </measurement-target>
1832
+ <verification exclude="false">
1833
+ <p id="_">The following code will be run for verification:</p>
1834
+ <sourcecode id="_">CoreRoot(success): HttpResponse
1835
+ if (success)
1836
+ recommendation(label: success-response)
1837
+ end
1838
+ </sourcecode>
1839
+ </verification>
1840
+ <import exclude="true">
1841
+ <sourcecode id="_">success-response()</sourcecode>
1842
+ </import>
1843
+ </requirement>
1844
+ </foreword></preface>
1845
+ </iso-standard>
1846
+ INPUT
1847
+ <?xml version='1.0'?>
1848
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
1849
+ <preface>
1850
+ <foreword>
1851
+ <requirement id='A' unnumbered='true' keep-with-next='true' keep-lines-together='true'>
1852
+ <name>Requirement</name>
1853
+ <title>A New Requirement</title>
1854
+ <label>/ogc/recommendation/wfs/2</label>
1855
+ <inherit>/ss/584/2015/level/1</inherit>
1856
+ <subject>user</subject>
1857
+ <description>
1858
+ <p id='_'>
1859
+ I recommend
1860
+ <em>this</em>
1861
+ .
1862
+ </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' keep-with-next='true' keep-lines-together='true'>
1883
+ <p id='_'>The measurement target shall be measured as:</p>
1884
+ <formula id='B'>
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='_'>
1892
+ CoreRoot(success): HttpResponse if (success) recommendation(label:
1893
+ success-response) end
1894
+ </sourcecode>
1895
+ </verification>
1896
+ <import exclude='true'>
1897
+ <sourcecode id='_'>success-response()</sourcecode>
1898
+ </import>
1899
+ </requirement>
1900
+ </foreword>
1901
+ </preface>
1902
+ </iso-standard>
1903
+ OUTPUT
1904
+ end
1905
+
1906
+ it "processes requirements (HTML)" do
1257
1907
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1258
1908
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1259
1909
  <preface><foreword>
1260
1910
  <requirement id="A" unnumbered="true" keep-with-next="true" keep-lines-together="true">
1911
+ <name>Requirement</name>
1261
1912
  <title>A New Requirement</title>
1262
1913
  <label>/ogc/recommendation/wfs/2</label>
1263
1914
  <inherit>/ss/584/2015/level/1</inherit>
@@ -1320,7 +1971,7 @@ Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
1320
1971
  </div>
1321
1972
  <div class="requirement-measurement-target" style='page-break-after: avoid;page-break-inside: avoid;'>
1322
1973
  <p id="_">The measurement target shall be measured as:</p>
1323
- <div id="B"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>&#160; (1)</p></div></div>
1974
+ <div id="B"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span></p></div></div>
1324
1975
 
1325
1976
 
1326
1977
  </div>
@@ -1338,7 +1989,125 @@ Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
1338
1989
  OUTPUT
1339
1990
  end
1340
1991
 
1341
- it "processes requirements in French" do
1992
+ it "processes requirements in French (Presentation XML)" do
1993
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1994
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1995
+ <bibdata>
1996
+ <language>fr</language>
1997
+ <script>Latn</script>
1998
+ </bibdata>
1999
+ <preface><foreword>
2000
+ <requirement id="A" unnumbered="true">
2001
+ <title>A New Requirement</title>
2002
+ <label>/ogc/recommendation/wfs/2</label>
2003
+ <inherit>/ss/584/2015/level/1</inherit>
2004
+ <subject>user</subject>
2005
+ <description>
2006
+ <p id="_">I recommend <em>this</em>.</p>
2007
+ </description>
2008
+ <specification exclude="true" type="tabular">
2009
+ <p id="_">This is the object of the recommendation:</p>
2010
+ <table id="_">
2011
+ <tbody>
2012
+ <tr>
2013
+ <td style="text-align:left;">Object</td>
2014
+ <td style="text-align:left;">Value</td>
2015
+ </tr>
2016
+ <tr>
2017
+ <td style="text-align:left;">Mission</td>
2018
+ <td style="text-align:left;">Accomplished</td>
2019
+ </tr>
2020
+ </tbody>
2021
+ </table>
2022
+ </specification>
2023
+ <description>
2024
+ <p id="_">As for the measurement targets,</p>
2025
+ </description>
2026
+ <measurement-target exclude="false">
2027
+ <p id="_">The measurement target shall be measured as:</p>
2028
+ <formula id="B">
2029
+ <stem type="AsciiMath">r/1 = 0</stem>
2030
+ </formula>
2031
+ </measurement-target>
2032
+ <verification exclude="false">
2033
+ <p id="_">The following code will be run for verification:</p>
2034
+ <sourcecode id="_">CoreRoot(success): HttpResponse
2035
+ if (success)
2036
+ recommendation(label: success-response)
2037
+ end
2038
+ </sourcecode>
2039
+ </verification>
2040
+ <import exclude="true">
2041
+ <sourcecode id="_">success-response()</sourcecode>
2042
+ </import>
2043
+ </requirement>
2044
+ </foreword></preface>
2045
+ </iso-standard>
2046
+ INPUT
2047
+ <?xml version='1.0'?>
2048
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
2049
+ <bibdata>
2050
+ <language>fr</language>
2051
+ <script>Latn</script>
2052
+ </bibdata>
2053
+ <preface>
2054
+ <foreword>
2055
+ <requirement id='A' unnumbered='true'>
2056
+ <name>Exigence</name>
2057
+ <title>A New Requirement</title>
2058
+ <label>/ogc/recommendation/wfs/2</label>
2059
+ <inherit>/ss/584/2015/level/1</inherit>
2060
+ <subject>user</subject>
2061
+ <description>
2062
+ <p id='_'>
2063
+ I recommend
2064
+ <em>this</em>
2065
+ .
2066
+ </p>
2067
+ </description>
2068
+ <specification exclude='true' type='tabular'>
2069
+ <p id='_'>This is the object of the recommendation:</p>
2070
+ <table id='_'>
2071
+ <tbody>
2072
+ <tr>
2073
+ <td style='text-align:left;'>Object</td>
2074
+ <td style='text-align:left;'>Value</td>
2075
+ </tr>
2076
+ <tr>
2077
+ <td style='text-align:left;'>Mission</td>
2078
+ <td style='text-align:left;'>Accomplished</td>
2079
+ </tr>
2080
+ </tbody>
2081
+ </table>
2082
+ </specification>
2083
+ <description>
2084
+ <p id='_'>As for the measurement targets,</p>
2085
+ </description>
2086
+ <measurement-target exclude='false'>
2087
+ <p id='_'>The measurement target shall be measured as:</p>
2088
+ <formula id='B'>
2089
+ <name>1</name>
2090
+ <stem type='AsciiMath'>r/1 = 0</stem>
2091
+ </formula>
2092
+ </measurement-target>
2093
+ <verification exclude='false'>
2094
+ <p id='_'>The following code will be run for verification:</p>
2095
+ <sourcecode id='_'>
2096
+ CoreRoot(success): HttpResponse if (success) recommendation(label:
2097
+ success-response) end
2098
+ </sourcecode>
2099
+ </verification>
2100
+ <import exclude='true'>
2101
+ <sourcecode id='_'>success-response()</sourcecode>
2102
+ </import>
2103
+ </requirement>
2104
+ </foreword>
2105
+ </preface>
2106
+ </iso-standard>
2107
+ OUTPUT
2108
+ end
2109
+
2110
+ it "processes requirements in French (HTML)" do
1342
2111
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1343
2112
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1344
2113
  <bibdata>
@@ -1347,6 +2116,7 @@ Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
1347
2116
  </bibdata>
1348
2117
  <preface><foreword>
1349
2118
  <requirement id="A" unnumbered="true">
2119
+ <name>Exigence</name>
1350
2120
  <title>A New Requirement</title>
1351
2121
  <label>/ogc/recommendation/wfs/2</label>
1352
2122
  <inherit>/ss/584/2015/level/1</inherit>
@@ -1425,7 +2195,6 @@ Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
1425
2195
  <div id='B'><div class='formula'>
1426
2196
  <p>
1427
2197
  <span class='stem'>(#(r/1 = 0)#)</span>
1428
- &#160; (1)
1429
2198
  </p>
1430
2199
  </div>
1431
2200
  </div>
@@ -1454,11 +2223,130 @@ Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
1454
2223
  OUTPUT
1455
2224
  end
1456
2225
 
1457
- it "processes recommendation" do
2226
+ it "processes recommendation (Presentation XML)" do
2227
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2228
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
2229
+ <preface><foreword>
2230
+ <recommendation id="_" obligation="shall,could" keep-with-next="true" keep-lines-together="true">
2231
+ <label>/ogc/recommendation/wfs/2</label>
2232
+ <inherit>/ss/584/2015/level/1</inherit>
2233
+ <classification><tag>type</tag><value>text</value></classification>
2234
+ <classification><tag>language</tag><value>BASIC</value></classification>
2235
+ <subject>user</subject>
2236
+ <description>
2237
+ <p id="_">I recommend <em>this</em>.</p>
2238
+ </description>
2239
+ <specification exclude="true" type="tabular">
2240
+ <p id="_">This is the object of the recommendation:</p>
2241
+ <table id="_">
2242
+ <tbody>
2243
+ <tr>
2244
+ <td style="text-align:left;">Object</td>
2245
+ <td style="text-align:left;">Value</td>
2246
+ </tr>
2247
+ <tr>
2248
+ <td style="text-align:left;">Mission</td>
2249
+ <td style="text-align:left;">Accomplished</td>
2250
+ </tr>
2251
+ </tbody>
2252
+ </table>
2253
+ </specification>
2254
+ <description>
2255
+ <p id="_">As for the measurement targets,</p>
2256
+ </description>
2257
+ <measurement-target exclude="false">
2258
+ <p id="_">The measurement target shall be measured as:</p>
2259
+ <formula id="_">
2260
+ <stem type="AsciiMath">r/1 = 0</stem>
2261
+ </formula>
2262
+ </measurement-target>
2263
+ <verification exclude="false">
2264
+ <p id="_">The following code will be run for verification:</p>
2265
+ <sourcecode id="_">CoreRoot(success): HttpResponse
2266
+ if (success)
2267
+ recommendation(label: success-response)
2268
+ end
2269
+ </sourcecode>
2270
+ </verification>
2271
+ <import exclude="true">
2272
+ <sourcecode id="_">success-response()</sourcecode>
2273
+ </import>
2274
+ </recommendation>
2275
+ </foreword></preface>
2276
+ </iso-standard>
2277
+ INPUT
2278
+ <?xml version='1.0'?>
2279
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
2280
+ <preface>
2281
+ <foreword>
2282
+ <recommendation id='_' obligation='shall,could' keep-with-next='true' keep-lines-together='true'>
2283
+ <name>Recommendation 1</name>
2284
+ <label>/ogc/recommendation/wfs/2</label>
2285
+ <inherit>/ss/584/2015/level/1</inherit>
2286
+ <classification>
2287
+ <tag>type</tag>
2288
+ <value>text</value>
2289
+ </classification>
2290
+ <classification>
2291
+ <tag>language</tag>
2292
+ <value>BASIC</value>
2293
+ </classification>
2294
+ <subject>user</subject>
2295
+ <description>
2296
+ <p id='_'>
2297
+ I recommend
2298
+ <em>this</em>
2299
+ .
2300
+ </p>
2301
+ </description>
2302
+ <specification exclude='true' type='tabular'>
2303
+ <p id='_'>This is the object of the recommendation:</p>
2304
+ <table id='_'>
2305
+ <tbody>
2306
+ <tr>
2307
+ <td style='text-align:left;'>Object</td>
2308
+ <td style='text-align:left;'>Value</td>
2309
+ </tr>
2310
+ <tr>
2311
+ <td style='text-align:left;'>Mission</td>
2312
+ <td style='text-align:left;'>Accomplished</td>
2313
+ </tr>
2314
+ </tbody>
2315
+ </table>
2316
+ </specification>
2317
+ <description>
2318
+ <p id='_'>As for the measurement targets,</p>
2319
+ </description>
2320
+ <measurement-target exclude='false'>
2321
+ <p id='_'>The measurement target shall be measured as:</p>
2322
+ <formula id='_'>
2323
+ <name>1</name>
2324
+ <stem type='AsciiMath'>r/1 = 0</stem>
2325
+ </formula>
2326
+ </measurement-target>
2327
+ <verification exclude='false'>
2328
+ <p id='_'>The following code will be run for verification:</p>
2329
+ <sourcecode id='_'>
2330
+ CoreRoot(success): HttpResponse if (success) recommendation(label:
2331
+ success-response) end
2332
+ </sourcecode>
2333
+ </verification>
2334
+ <import exclude='true'>
2335
+ <sourcecode id='_'>success-response()</sourcecode>
2336
+ </import>
2337
+ </recommendation>
2338
+ </foreword>
2339
+ </preface>
2340
+ </iso-standard>
2341
+ OUTPUT
2342
+ end
2343
+
2344
+ it "processes recommendation (HTML)" do
1458
2345
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1459
2346
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1460
2347
  <preface><foreword>
1461
2348
  <recommendation id="_" obligation="shall,could" keep-with-next="true" keep-lines-together="true">
2349
+ <name>Recommendation 1</name>
1462
2350
  <label>/ogc/recommendation/wfs/2</label>
1463
2351
  <inherit>/ss/584/2015/level/1</inherit>
1464
2352
  <classification><tag>type</tag><value>text</value></classification>
@@ -1521,7 +2409,7 @@ end
1521
2409
  </div>
1522
2410
  <div class="requirement-measurement-target">
1523
2411
  <p id="_">The measurement target shall be measured as:</p>
1524
- <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>&#160; (1)</p></div></div>
2412
+ <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span></p></div></div>
1525
2413
 
1526
2414
 
1527
2415
  </div>
@@ -1539,8 +2427,8 @@ end
1539
2427
  OUTPUT
1540
2428
  end
1541
2429
 
1542
- it "processes pseudocode" do
1543
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2430
+ it "processes pseudocode (Presentation XML)" do
2431
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1544
2432
  <itu-standard xmlns="http://riboseinc.com/isoxml">
1545
2433
  <bibdata>
1546
2434
  <language>en</language>
@@ -1550,6 +2438,59 @@ end
1550
2438
          <smallcap>B</smallcap></p>
1551
2439
  <p id="_">  <em>C</em></p></figure>
1552
2440
  </preface></itu-standard>
2441
+ INPUT
2442
+ <?xml version='1.0'?>
2443
+ <itu-standard xmlns='http://riboseinc.com/isoxml'>
2444
+ <bibdata>
2445
+ <language>en</language>
2446
+ </bibdata>
2447
+ <preface>
2448
+ <foreword>
2449
+ <figure id='_' class='pseudocode' keep-with-next='true' keep-lines-together='true'>
2450
+ <name>Figure 1&#xA0;&#x2014; Label</name>
2451
+ <p id='_'>
2452
+ &#xA0;&#xA0;
2453
+ <strong>A</strong>
2454
+ <br/>
2455
+ &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;
2456
+ <smallcap>B</smallcap>
2457
+ </p>
2458
+ <p id='_'>
2459
+ &#xA0;&#xA0;
2460
+ <em>C</em>
2461
+ </p>
2462
+ </figure>
2463
+ </foreword>
2464
+ </preface>
2465
+ </itu-standard>
2466
+ OUTPUT
2467
+ end
2468
+
2469
+ it "processes pseudocode (HTML)" do
2470
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2471
+ <itu-standard xmlns='http://riboseinc.com/isoxml'>
2472
+ <bibdata>
2473
+ <language>en</language>
2474
+ </bibdata>
2475
+ <preface>
2476
+ <foreword>
2477
+ <figure id='_' class='pseudocode' keep-with-next='true' keep-lines-together='true'>
2478
+ <name>Figure 1&#xA0;&#x2014; Label</name>
2479
+ <p id='_'>
2480
+ &#xA0;&#xA0;
2481
+ <strong>A</strong>
2482
+ <br/>
2483
+ &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;
2484
+ <smallcap>B</smallcap>
2485
+ </p>
2486
+ <p id='_'>
2487
+ &#xA0;&#xA0;
2488
+ <em>C</em>
2489
+ </p>
2490
+ </figure>
2491
+ </foreword>
2492
+ </preface>
2493
+ </itu-standard>
1553
2494
  INPUT
1554
2495
  #{HTML_HDR}
1555
2496
  <br/>
@@ -1569,18 +2510,32 @@ OUTPUT
1569
2510
  it "processes pseudocode (Word)" do
1570
2511
  FileUtils.rm_f "test.doc"
1571
2512
  IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", false)
1572
- <itu-standard xmlns="http://riboseinc.com/isoxml">
1573
- <bibdata>
2513
+ <itu-standard xmlns='http://riboseinc.com/isoxml'>
2514
+ <bibdata>
1574
2515
  <language>en</language>
1575
- </bibdata>
1576
- <preface><foreword>
1577
- <figure id="_" class="pseudocode"><name>Label</name><p id="_">  <strong>A</strong><br/>
1578
-         <smallcap>B</smallcap></p>
1579
- <p id="_">  <em>C</em></p></figure>
1580
- </preface></itu-standard>
2516
+ </bibdata>
2517
+ <preface>
2518
+ <foreword>
2519
+ <figure id='_' class='pseudocode' keep-with-next='true' keep-lines-together='true'>
2520
+ <name>Figure 1&#xA0;&#x2014; Label</name>
2521
+ <p id='_'>
2522
+ &#xA0;&#xA0;
2523
+ <strong>A</strong>
2524
+ <br/>
2525
+ &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;
2526
+ <smallcap>B</smallcap>
2527
+ </p>
2528
+ <p id='_'>
2529
+ &#xA0;&#xA0;
2530
+ <em>C</em>
2531
+ </p>
2532
+ </figure>
2533
+ </foreword>
2534
+ </preface>
2535
+ </itu-standard>
1581
2536
  INPUT
1582
2537
  expect(xmlpp( File.read("test.doc").gsub(%r{^.*<h1 class="ForewordTitle">Foreword</h1>}m, "").gsub(%r{</div>.*}m, "</div>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1583
- <div class="pseudocode"><a name="_" id="_"></a><p class="pseudocode"><a name="_" id="_"></a>&#xA0;&#xA0;<b>A</b><br/>
2538
+ <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/>
1584
2539
  &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span style="font-variant:small-caps;">B</span></p>
1585
2540
  <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>
1586
2541
  OUTPUT
@@ -1606,7 +2561,6 @@ INPUT
1606
2561
  <div>
1607
2562
  <h1 class='ForewordTitle'>Foreword</h1>
1608
2563
  <div class='example'>
1609
- <p class='example-title'>EXAMPLE</p>
1610
2564
  <pre id='B' class='prettyprint '>
1611
2565
  A B C
1612
2566
  </pre>