isodoc 1.6.1 → 1.6.6

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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +2 -12
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -8
  5. data/Rakefile +2 -2
  6. data/isodoc.gemspec +4 -3
  7. data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
  8. data/lib/isodoc-yaml/i18n-de.yaml +149 -0
  9. data/lib/isodoc-yaml/i18n-en.yaml +1 -0
  10. data/lib/isodoc-yaml/i18n-es.yaml +151 -0
  11. data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
  12. data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
  13. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  14. data/lib/isodoc.rb +0 -2
  15. data/lib/isodoc/common.rb +2 -0
  16. data/lib/isodoc/convert.rb +8 -2
  17. data/lib/isodoc/function/blocks.rb +15 -4
  18. data/lib/isodoc/function/cleanup.rb +52 -43
  19. data/lib/isodoc/function/form.rb +51 -0
  20. data/lib/isodoc/function/inline.rb +8 -7
  21. data/lib/isodoc/function/references.rb +71 -77
  22. data/lib/isodoc/function/section.rb +28 -16
  23. data/lib/isodoc/function/table.rb +22 -22
  24. data/lib/isodoc/function/terms.rb +6 -7
  25. data/lib/isodoc/function/to_word_html.rb +19 -25
  26. data/lib/isodoc/function/utils.rb +181 -163
  27. data/lib/isodoc/gem_tasks.rb +8 -9
  28. data/lib/isodoc/headlesshtml_convert.rb +8 -7
  29. data/lib/isodoc/html_convert.rb +6 -0
  30. data/lib/isodoc/html_function/comments.rb +14 -12
  31. data/lib/isodoc/html_function/footnotes.rb +14 -7
  32. data/lib/isodoc/html_function/form.rb +62 -0
  33. data/lib/isodoc/html_function/html.rb +30 -26
  34. data/lib/isodoc/html_function/postprocess.rb +191 -182
  35. data/lib/isodoc/html_function/sectionsplit.rb +230 -0
  36. data/lib/isodoc/i18n.rb +13 -11
  37. data/lib/isodoc/metadata.rb +22 -20
  38. data/lib/isodoc/metadata_contributor.rb +31 -28
  39. data/lib/isodoc/pdf_convert.rb +11 -13
  40. data/lib/isodoc/presentation_function/bibdata.rb +54 -30
  41. data/lib/isodoc/presentation_function/inline.rb +70 -120
  42. data/lib/isodoc/presentation_function/math.rb +84 -0
  43. data/lib/isodoc/presentation_function/section.rb +55 -19
  44. data/lib/isodoc/presentation_xml_convert.rb +3 -0
  45. data/lib/isodoc/sassc_importer.rb +1 -1
  46. data/lib/isodoc/version.rb +1 -1
  47. data/lib/isodoc/word_function/body.rb +28 -24
  48. data/lib/isodoc/word_function/postprocess.rb +50 -36
  49. data/lib/isodoc/xref.rb +2 -0
  50. data/lib/isodoc/xref/xref_counter.rb +1 -2
  51. data/lib/isodoc/xref/xref_gen.rb +21 -14
  52. data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
  53. data/lib/isodoc/xref/xref_sect_gen.rb +15 -15
  54. data/spec/assets/scripts_override.html +3 -0
  55. data/spec/isodoc/blocks_spec.rb +624 -997
  56. data/spec/isodoc/cleanup_spec.rb +40 -42
  57. data/spec/isodoc/form_spec.rb +156 -0
  58. data/spec/isodoc/i18n_spec.rb +694 -821
  59. data/spec/isodoc/inline_spec.rb +1105 -921
  60. data/spec/isodoc/metadata_spec.rb +384 -379
  61. data/spec/isodoc/postproc_spec.rb +461 -333
  62. data/spec/isodoc/presentation_xml_spec.rb +355 -278
  63. data/spec/isodoc/ref_spec.rb +5 -5
  64. data/spec/isodoc/section_spec.rb +216 -199
  65. data/spec/isodoc/sectionsplit_spec.rb +190 -0
  66. data/spec/isodoc/table_spec.rb +41 -42
  67. data/spec/isodoc/terms_spec.rb +84 -84
  68. data/spec/isodoc/xref_spec.rb +974 -932
  69. metadata +32 -7
data/lib/isodoc/xref.rb CHANGED
@@ -11,6 +11,8 @@ module IsoDoc
11
11
  include XrefGen::Blocks
12
12
  include XrefGen::Sections
13
13
 
14
+ attr_reader :klass
15
+
14
16
  def initialize(lang, script, klass, i18n, options = {})
15
17
  @anchors = {}
16
18
  @lang = lang
@@ -49,8 +49,7 @@ module IsoDoc::XrefGen
49
49
  @base = node["number"][0..-2]
50
50
  @letter = @letter_override = node["number"][-1]
51
51
  else
52
- @number_override = node["number"]
53
- @num = n.to_i
52
+ @number_override = @num = n.to_i
54
53
  @base = b
55
54
  @letter = ""
56
55
  end
@@ -10,7 +10,7 @@ module IsoDoc::XrefGen
10
10
  autonum = amend_autonums(a)
11
11
  NUMBERED_BLOCKS.each do |b|
12
12
  a.xpath(ns("./newcontent//#{b}")).each_with_index do |e, i|
13
- autonum[b] and i == 0 and e["number"] = autonum[b]
13
+ autonum[b] && i.zero? and e["number"] = autonum[b]
14
14
  !autonum[b] and e["unnumbered"] = "true"
15
15
  end
16
16
  end
@@ -29,6 +29,13 @@ module IsoDoc::XrefGen
29
29
  @labels["termnote"].gsub(/%/, note.to_s)
30
30
  end
31
31
 
32
+ def increment_label(elems, node, counter, increment = true)
33
+ return "" if elems.size == 1 && !node["number"]
34
+
35
+ counter.increment(node) if increment
36
+ " #{counter.print}"
37
+ end
38
+
32
39
  def termnote_anchor_names(docxml)
33
40
  docxml.xpath(ns("//term[descendant::termnote]")).each do |t|
34
41
  c = Counter.new
@@ -39,7 +46,7 @@ module IsoDoc::XrefGen
39
46
  @anchors[n["id"]] =
40
47
  { label: termnote_label(c.print), type: "termnote", value: c.print,
41
48
  xref: l10n("#{anchor(t['id'], :xref)}, "\
42
- "#{@labels["note_xref"]} #{c.print}") }
49
+ "#{@labels['note_xref']} #{c.print}") }
43
50
  end
44
51
  end
45
52
  end
@@ -52,11 +59,11 @@ module IsoDoc::XrefGen
52
59
  next if n["id"].nil? || n["id"].empty?
53
60
 
54
61
  c.increment(n)
55
- idx = examples.size == 1 && !n["number"] ? "" : c.print
62
+ idx = increment_label(examples, n, c, false)
56
63
  @anchors[n["id"]] = {
57
64
  type: "termexample", label: idx, value: c.print,
58
65
  xref: l10n("#{anchor(t['id'], :xref)}, "\
59
- "#{@labels["example_xref"]} #{c.print}") }
66
+ "#{@labels['example_xref']} #{c.print}") }
60
67
  end
61
68
  end
62
69
  end
@@ -84,9 +91,9 @@ module IsoDoc::XrefGen
84
91
  notes.each do |n|
85
92
  next if @anchors[n["id"]] || n["id"].nil? || n["id"].empty?
86
93
 
87
- idx = notes.size == 1 && !n["number"] ? "" : " #{c.increment(n).print}"
88
- @anchors[n["id"]] = anchor_struct(idx, n, @labels["note_xref"],
89
- "note", false)
94
+ @anchors[n["id"]] =
95
+ anchor_struct(increment_label(notes, n, c), n,
96
+ @labels["note_xref"], "note", false)
90
97
  end
91
98
  note_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
92
99
  end
@@ -107,10 +114,9 @@ module IsoDoc::XrefGen
107
114
  notes.each do |n|
108
115
  next if @anchors[n["id"]] || n["id"].nil? || n["id"].empty?
109
116
 
110
- idx = notes.size == 1 && !n["number"] ? "" :
111
- " #{c.increment(n).print}"
112
- @anchors[n["id"]] = anchor_struct(idx, n, @labels["example_xref"],
113
- "example", n["unnumbered"])
117
+ @anchors[n["id"]] =
118
+ anchor_struct(increment_label(notes, n, c), n,
119
+ @labels["example_xref"], "example", n["unnumbered"])
114
120
  end
115
121
  example_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
116
122
  end
@@ -124,9 +130,8 @@ module IsoDoc::XrefGen
124
130
  notes.each do |n|
125
131
  next if n["id"].nil? || n["id"].empty?
126
132
 
127
- idx = notes.size == 1 && !n["number"] ? "" : " #{c.increment(n).print}"
128
- @anchors[n["id"]] = anchor_struct(idx, n, @labels["list"], "list",
129
- false)
133
+ @anchors[n["id"]] = anchor_struct(increment_label(notes, n, c), n,
134
+ @labels["list"], "list", false)
130
135
  list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
131
136
  end
132
137
  list_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
@@ -151,9 +156,11 @@ module IsoDoc::XrefGen
151
156
  def bookmark_anchor_names(docxml)
152
157
  docxml.xpath(ns(".//bookmark")).each do |n|
153
158
  next if n["id"].nil? || n["id"].empty?
159
+
154
160
  parent = nil
155
161
  n.ancestors.each do |a|
156
162
  next unless a["id"] && parent = @anchors.dig(a["id"], :xref)
163
+
157
164
  break
158
165
  end
159
166
  @anchors[n["id"]] = { type: "bookmark", label: nil, value: nil,
@@ -8,25 +8,27 @@ module IsoDoc::XrefGen
8
8
  "-"
9
9
  end
10
10
 
11
- def subfigure_increment(j, c, t)
12
- if t.parent.name == "figure" then j += 1
11
+ def subfigure_increment(idx, counter, elem)
12
+ if elem.parent.name == "figure" then idx += 1
13
13
  else
14
- j = 0
15
- c.increment(t)
14
+ idx = 0
15
+ counter.increment(elem)
16
16
  end
17
- j
17
+ idx
18
18
  end
19
19
 
20
20
  def sequential_figure_names(clause)
21
21
  c = Counter.new
22
22
  j = 0
23
- clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
24
- each do |t|
23
+ clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
24
+ .each do |t|
25
25
  j = subfigure_increment(j, c, t)
26
26
  label = c.print + (j.zero? ? "" : "-#{j}")
27
27
  next if t["id"].nil? || t["id"].empty?
28
- @anchors[t["id"]] =
29
- anchor_struct(label, nil, @labels["figure"], "figure", t["unnumbered"])
28
+
29
+ @anchors[t["id"]] = anchor_struct(
30
+ label, nil, @labels["figure"], "figure", t["unnumbered"]
31
+ )
30
32
  end
31
33
  end
32
34
 
@@ -34,8 +36,11 @@ module IsoDoc::XrefGen
34
36
  c = Counter.new
35
37
  clause.xpath(ns(".//table")).each do |t|
36
38
  next if t["id"].nil? || t["id"].empty?
37
- @anchors[t["id"]] = anchor_struct(c.increment(t).print, nil,
38
- @labels["table"], "table", t["unnumbered"])
39
+
40
+ @anchors[t["id"]] = anchor_struct(
41
+ c.increment(t).print, nil,
42
+ @labels["table"], "table", t["unnumbered"]
43
+ )
39
44
  end
40
45
  end
41
46
 
@@ -43,10 +48,12 @@ module IsoDoc::XrefGen
43
48
  c = Counter.new
44
49
  clause.xpath(ns(".//formula")).each do |t|
45
50
  next if t["id"].nil? || t["id"].empty?
46
- @anchors[t["id"]] =
47
- anchor_struct(c.increment(t).print, t,
48
- t["inequality"] ? @labels["inequality"] : @labels["formula"],
49
- "formula", t["unnumbered"])
51
+
52
+ @anchors[t["id"]] = anchor_struct(
53
+ c.increment(t).print, t,
54
+ t["inequality"] ? @labels["inequality"] : @labels["formula"],
55
+ "formula", t["unnumbered"]
56
+ )
50
57
  end
51
58
  end
52
59
 
@@ -57,22 +64,27 @@ module IsoDoc::XrefGen
57
64
  c = Counter.new
58
65
  clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
59
66
  next if t["id"].nil? || t["id"].empty?
67
+
60
68
  id = c.increment(t).print
61
69
  @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
62
70
  sequential_permission_names2(t, id)
63
71
  end
64
72
  end
65
73
 
66
- def sequential_permission_names2(t, id)
67
- sequential_permission_names1(t, id, "permission", @labels["permission"])
68
- sequential_permission_names1(t, id, "requirement", @labels["requirement"])
69
- sequential_permission_names1(t, id, "recommendation", @labels["recommendation"])
74
+ def sequential_permission_names2(elem, ident)
75
+ sequential_permission_names1(elem, ident, "permission",
76
+ @labels["permission"])
77
+ sequential_permission_names1(elem, ident, "requirement",
78
+ @labels["requirement"])
79
+ sequential_permission_names1(elem, ident, "recommendation",
80
+ @labels["recommendation"])
70
81
  end
71
82
 
72
83
  def sequential_permission_names1(block, lbl, klass, label)
73
84
  c = Counter.new
74
85
  block.xpath(ns("./#{klass}")).each do |t|
75
86
  next if t["id"].nil? || t["id"].empty?
87
+
76
88
  id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
77
89
  @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
78
90
  sequential_permission_names2(t, id)
@@ -85,20 +97,22 @@ module IsoDoc::XrefGen
85
97
  sequential_formula_names(clause)
86
98
  sequential_permission_names(clause, "permission", @labels["permission"])
87
99
  sequential_permission_names(clause, "requirement", @labels["requirement"])
88
- sequential_permission_names(clause, "recommendation", @labels["recommendation"])
100
+ sequential_permission_names(clause, "recommendation",
101
+ @labels["recommendation"])
89
102
  end
90
103
 
91
104
  def hierarchical_figure_names(clause, num)
92
105
  c = Counter.new
93
106
  j = 0
94
- clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
95
- each do |t|
107
+ clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
108
+ .each do |t|
96
109
  j = subfigure_increment(j, c, t)
97
110
  label = "#{num}#{hiersep}#{c.print}" +
98
111
  (j.zero? ? "" : "#{hierfigsep}#{j}")
99
112
  next if t["id"].nil? || t["id"].empty?
100
- @anchors[t["id"]] = anchor_struct(label, nil, @labels["figure"], "figure",
101
- t["unnumbered"])
113
+
114
+ @anchors[t["id"]] = anchor_struct(label, nil, @labels["figure"],
115
+ "figure", t["unnumbered"])
102
116
  end
103
117
  end
104
118
 
@@ -106,6 +120,7 @@ module IsoDoc::XrefGen
106
120
  c = Counter.new
107
121
  clause.xpath(ns(".//table")).each do |t|
108
122
  next if t["id"].nil? || t["id"].empty?
123
+
109
124
  @anchors[t["id"]] =
110
125
  anchor_struct("#{num}#{hiersep}#{c.increment(t).print}",
111
126
  nil, @labels["table"], "table", t["unnumbered"])
@@ -116,7 +131,8 @@ module IsoDoc::XrefGen
116
131
  hierarchical_table_names(clause, num)
117
132
  hierarchical_figure_names(clause, num)
118
133
  hierarchical_formula_names(clause, num)
119
- hierarchical_permission_names(clause, num, "permission", @labels["permission"])
134
+ hierarchical_permission_names(clause, num, "permission",
135
+ @labels["permission"])
120
136
  hierarchical_permission_names(clause, num, "requirement",
121
137
  @labels["requirement"])
122
138
  hierarchical_permission_names(clause, num, "recommendation",
@@ -127,10 +143,12 @@ module IsoDoc::XrefGen
127
143
  c = Counter.new
128
144
  clause.xpath(ns(".//formula")).each do |t|
129
145
  next if t["id"].nil? || t["id"].empty?
130
- @anchors[t["id"]] =
131
- anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", nil,
132
- t["inequality"] ? @labels["inequality"] : @labels["formula"],
133
- "formula", t["unnumbered"])
146
+
147
+ @anchors[t["id"]] = anchor_struct(
148
+ "#{num}#{hiersep}#{c.increment(t).print}", nil,
149
+ t["inequality"] ? @labels["inequality"] : @labels["formula"],
150
+ "formula", t["unnumbered"]
151
+ )
134
152
  end
135
153
  end
136
154
 
@@ -138,24 +156,31 @@ module IsoDoc::XrefGen
138
156
  c = Counter.new
139
157
  clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
140
158
  next if t["id"].nil? || t["id"].empty?
159
+
141
160
  id = "#{num}#{hiersep}#{c.increment(t).print}"
142
- @anchors[t["id"]] = anchor_struct(id, nil, label, klass, t["unnumbered"])
161
+ @anchors[t["id"]] =
162
+ anchor_struct(id, nil, label, klass, t["unnumbered"])
143
163
  hierarchical_permission_names2(t, id)
144
164
  end
145
165
  end
146
166
 
147
- def hierarchical_permission_names2(t, id)
148
- hierarchical_permission_names1(t, id, "permission", @labels["permission"])
149
- hierarchical_permission_names1(t, id, "requirement", @labels["requirement"])
150
- hierarchical_permission_names1(t, id, "recommendation", @labels["recommendation"])
167
+ def hierarchical_permission_names2(elem, ident)
168
+ hierarchical_permission_names1(elem, ident, "permission",
169
+ @labels["permission"])
170
+ hierarchical_permission_names1(elem, ident, "requirement",
171
+ @labels["requirement"])
172
+ hierarchical_permission_names1(elem, ident, "recommendation",
173
+ @labels["recommendation"])
151
174
  end
152
175
 
153
176
  def hierarchical_permission_names1(block, lbl, klass, label)
154
177
  c = Counter.new
155
178
  block.xpath(ns("./#{klass}")).each do |t|
156
179
  next if t["id"].nil? || t["id"].empty?
180
+
157
181
  id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
158
- @anchors[t["id"]] = anchor_struct(id, nil, label, klass, t["unnumbered"])
182
+ @anchors[t["id"]] =
183
+ anchor_struct(id, nil, label, klass, t["unnumbered"])
159
184
  hierarchical_permission_names2(t, id)
160
185
  end
161
186
  end
@@ -14,20 +14,20 @@ module IsoDoc::XrefGen
14
14
  end
15
15
  end
16
16
 
17
- def initial_anchor_names(d)
18
- d.xpath(ns("//preface/*")).each { |c| c.element? and preface_names(c) }
17
+ def initial_anchor_names(doc)
18
+ doc.xpath(ns("//preface/*")).each { |c| c.element? and preface_names(c) }
19
19
  # potentially overridden in middle_section_asset_names()
20
- sequential_asset_names(d.xpath(ns("//preface/*")))
20
+ sequential_asset_names(doc.xpath(ns("//preface/*")))
21
21
  n = Counter.new
22
- n = section_names(d.at(ns("//clause[@type = 'scope']")), n, 1)
23
- n = section_names(d.at(ns(@klass.norm_ref_xpath)), n, 1)
24
- n = section_names(d.at(ns("//sections/terms | "\
22
+ n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
23
+ n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
24
+ n = section_names(doc.at(ns("//sections/terms | "\
25
25
  "//sections/clause[descendant::terms]")), n, 1)
26
- n = section_names(d.at(ns("//sections/definitions")), n, 1)
27
- clause_names(d, n)
28
- middle_section_asset_names(d)
29
- termnote_anchor_names(d)
30
- termexample_anchor_names(d)
26
+ n = section_names(doc.at(ns("//sections/definitions")), n, 1)
27
+ clause_names(doc, n)
28
+ middle_section_asset_names(doc)
29
+ termnote_anchor_names(doc)
30
+ termexample_anchor_names(doc)
31
31
  end
32
32
 
33
33
  def preface_clause_name(clause)
@@ -60,17 +60,17 @@ module IsoDoc::XrefGen
60
60
  end
61
61
  end
62
62
 
63
- def middle_section_asset_names(d)
63
+ def middle_section_asset_names(doc)
64
64
  middle_sections = "//clause[@type = 'scope'] | "\
65
65
  "#{@klass.norm_ref_xpath} | "\
66
66
  "//sections/terms | //preface/* | "\
67
67
  "//sections/definitions | //clause[parent::sections]"
68
- sequential_asset_names(d.xpath(ns(middle_sections)))
68
+ sequential_asset_names(doc.xpath(ns(middle_sections)))
69
69
  end
70
70
 
71
- def clause_names(docxml, n)
71
+ def clause_names(docxml, num)
72
72
  docxml.xpath(ns(@klass.middle_clause(docxml))).each_with_index do |c, _i|
73
- section_names(c, n, 1)
73
+ section_names(c, num, 1)
74
74
  end
75
75
  end
76
76
 
@@ -0,0 +1,3 @@
1
+ <script>
2
+ This is > also a script
3
+ </script>
@@ -23,7 +23,7 @@ RSpec.describe IsoDoc do
23
23
  <title>Change Clause</title>
24
24
  <amend id='B' change='modify' path='//table[2]' path_end='//table[2]/following-sibling:example[1]' title='Change'>
25
25
  <autonumber type='table'>2</autonumber>
26
- <autonumber type='example'>7</autonumber>
26
+ <autonumber type='example'>A.7</autonumber>
27
27
  <description>
28
28
  <p id='C'>
29
29
  <em>
@@ -100,7 +100,7 @@ RSpec.describe IsoDoc do
100
100
  </ext>
101
101
  </bibdata>
102
102
  <sections>
103
- <clause id="A" inline-header="false" obligation="normative">
103
+ <clause id="A" inline-header="false" obligation="normative" displayorder="1">
104
104
  <title depth="1">1.<tab/>Change Clause</title>
105
105
  <p id="C">
106
106
  <em>
@@ -150,7 +150,7 @@ RSpec.describe IsoDoc do
150
150
  </tbody>
151
151
  </table>
152
152
  <figure id="H" unnumbered="true"><name>Figure</name></figure>
153
- <example id="F" number="7"><name>EXAMPLE 7</name>
153
+ <example id="F" number="A.7"><name>EXAMPLE A.7</name>
154
154
  <p id="G">This is not generalised further.</p>
155
155
  </example>
156
156
  </quote>
@@ -225,7 +225,7 @@ RSpec.describe IsoDoc do
225
225
  <p class='FigureTitle' style='text-align:center;'>Figure</p>
226
226
  </div>
227
227
  <div id='F' class='example'>
228
- <p class='example-title'>EXAMPLE 7</p>
228
+ <p class='example-title'>EXAMPLE A.7</p>
229
229
  <p id='G'>This is not generalised further.</p>
230
230
  </div>
231
231
  </div>
@@ -242,387 +242,320 @@ RSpec.describe IsoDoc do
242
242
  .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
243
243
  end
244
244
 
245
- it "processes unlabelled notes (Presentation XML)" do
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-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
251
+ </note>
252
+ </foreword></preface>
253
+ </iso-standard>
254
+ INPUT
255
+ presxml = <<~OUTPUT
256
+ <?xml version='1.0'?>
257
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
258
+ <preface>
259
+ <foreword displayorder="1">
260
+ <note id='A' keep-with-next='true' keep-lines-together='true'>
261
+ <name>NOTE</name>
262
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
263
+ These results are based on a study carried out on three different
264
+ types of kernel.
265
+ </p>
266
+ </note>
267
+ </foreword>
268
+ </preface>
269
+ </iso-standard>
270
+ OUTPUT
271
+ html = <<~OUTPUT
272
+ #{HTML_HDR}
273
+ <br/>
274
+ <div>
275
+ <h1 class="ForewordTitle">Foreword</h1>
276
+ <div id="A" class="Note" style="page-break-after: avoid;page-break-inside: avoid;">
277
+ <p><span class="note_label">NOTE</span>&#160; These results are based on a study carried out on three different types of kernel.</p>
278
+ </div>
279
+ </div>
280
+ <p class="zzSTDTitle1"/>
281
+ </div>
282
+ </body>
283
+ </html>
284
+ OUTPUT
285
+ doc = <<~OUTPUT
286
+ <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
287
+ <head><style/></head>
288
+ <body lang="EN-US" link="blue" vlink="#954F72">
289
+ <div class="WordSection1">
290
+ <p>&#160;</p>
291
+ </div>
292
+ <p><br clear="all" class="section"/></p>
293
+ <div class="WordSection2">
294
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
295
+ <div>
296
+ <h1 class="ForewordTitle">Foreword</h1>
297
+ <div id="A" class="Note" style='page-break-after: avoid;page-break-inside: avoid;'>
298
+ <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>
299
+ </div>
300
+ </div>
301
+ <p>&#160;</p>
302
+ </div>
303
+ <p><br clear="all" class="section"/></p>
304
+ <div class="WordSection3">
305
+ <p class="zzSTDTitle1"/>
306
+ </div>
307
+ </body>
308
+ </html>
309
+ OUTPUT
246
310
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
247
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
248
- <iso-standard xmlns="http://riboseinc.com/isoxml">
249
- <preface><foreword>
250
- <note id="A" keep-with-next="true" keep-lines-together="true">
251
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
252
- </note>
253
- </foreword></preface>
254
- </iso-standard>
255
- INPUT
256
- <?xml version='1.0'?>
257
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
258
- <preface>
259
- <foreword>
260
- <note id='A' keep-with-next='true' keep-lines-together='true'>
261
- <name>NOTE</name>
262
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
263
- These results are based on a study carried out on three different
264
- types of kernel.
265
- </p>
266
- </note>
267
- </foreword>
268
- </preface>
269
- </iso-standard>
270
- OUTPUT
271
- end
272
-
273
- it "processes unlabelled notes (HTML)" do
311
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
274
312
  expect(xmlpp(IsoDoc::HtmlConvert.new({})
275
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
276
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
277
- <preface>
278
- <foreword>
279
- <note id='A' keep-with-next='true' keep-lines-together='true'>
280
- <name>NOTE</name>
281
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
282
- These results are based on a study carried out on three different
283
- types of kernel.
284
- </p>
285
- </note>
286
- </foreword>
287
- </preface>
288
- </iso-standard>
289
- INPUT
290
- #{HTML_HDR}
291
- <br/>
292
- <div>
293
- <h1 class="ForewordTitle">Foreword</h1>
294
- <div id="A" class="Note" style="page-break-after: avoid;page-break-inside: avoid;">
295
- <p><span class="note_label">NOTE</span>&#160; These results are based on a study carried out on three different types of kernel.</p>
296
- </div>
297
- </div>
298
- <p class="zzSTDTitle1"/>
299
- </div>
300
- </body>
301
- </html>
302
- OUTPUT
303
- end
304
-
305
- it "processes unlabelled notes (Word)" do
313
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
306
314
  expect(xmlpp(IsoDoc::WordConvert.new({})
307
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
308
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
309
- <preface>
310
- <foreword>
311
- <note id='A' keep-with-next='true' keep-lines-together='true'>
312
- <name>NOTE</name>
313
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
314
- These results are based on a study carried out on three different
315
- types of kernel.
316
- </p>
317
- </note>
318
- </foreword>
319
- </preface>
320
- </iso-standard>
321
- INPUT
322
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
323
- <head><style/></head>
324
- <body lang="EN-US" link="blue" vlink="#954F72">
325
- <div class="WordSection1">
326
- <p>&#160;</p>
327
- </div>
328
- <p><br clear="all" class="section"/></p>
329
- <div class="WordSection2">
330
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
331
- <div>
332
- <h1 class="ForewordTitle">Foreword</h1>
333
- <div id="A" class="Note" style='page-break-after: avoid;page-break-inside: avoid;'>
334
- <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>
335
- </div>
336
- </div>
337
- <p>&#160;</p>
338
- </div>
339
- <p><br clear="all" class="section"/></p>
340
- <div class="WordSection3">
341
- <p class="zzSTDTitle1"/>
342
- </div>
343
- </body>
344
- </html>
345
- OUTPUT
315
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(doc)
346
316
  end
347
317
 
348
- it "processes sequences of notes (Presentation XML)" do
349
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
350
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
351
- <iso-standard xmlns="http://riboseinc.com/isoxml">
352
- <preface><foreword>
353
- <note id="note1">
354
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
355
- </note>
356
- <note id="note2">
357
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
358
- </note>
359
- </foreword></preface>
360
- </iso-standard>
361
- INPUT
362
- <?xml version='1.0'?>
363
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
364
- <preface>
365
- <foreword>
366
- <note id='note1'>
367
- <name>NOTE 1</name>
368
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
369
- These results are based on a study carried out on three different
370
- types of kernel.
371
- </p>
372
- </note>
373
- <note id='note2'>
374
- <name>NOTE 2</name>
375
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'>
376
- These results are based on a study carried out on three different
377
- types of kernel.
378
- </p>
379
- </note>
380
- </foreword>
381
- </preface>
382
- </iso-standard>
383
- OUTPUT
384
- end
318
+ it "processes sequences of notes" do
319
+ input = <<~INPUT
320
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
321
+ <preface><foreword>
322
+ <note id="note1">
323
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
324
+ </note>
325
+ <note id="note2">
326
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
327
+ </note>
328
+ </foreword></preface>
329
+ </iso-standard>
330
+ INPUT
331
+ presxml = <<~OUTPUT
332
+ <?xml version='1.0'?>
333
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
334
+ <preface>
335
+ <foreword displayorder="1">
336
+ <note id='note1'>
337
+ <name>NOTE 1</name>
338
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
339
+ These results are based on a study carried out on three different
340
+ types of kernel.
341
+ </p>
342
+ </note>
343
+ <note id='note2'>
344
+ <name>NOTE 2</name>
345
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'>
346
+ These results are based on a study carried out on three different
347
+ types of kernel.
348
+ </p>
349
+ </note>
350
+ </foreword>
351
+ </preface>
352
+ </iso-standard>
353
+ OUTPUT
385
354
 
386
- it "processes sequences of notes (HTML)" do
387
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
388
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
389
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
390
- <preface>
391
- <foreword>
392
- <note id='note1'>
393
- <name>NOTE 1</name>
394
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
395
- These results are based on a study carried out on three different
396
- types of kernel.
397
- </p>
398
- </note>
399
- <note id='note2'>
400
- <name>NOTE 2</name>
401
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'>
402
- These results are based on a study carried out on three different
403
- types of kernel.
404
- </p>
405
- </note>
406
- </foreword>
407
- </preface>
408
- </iso-standard>
409
- INPUT
410
- #{HTML_HDR}
411
- <br/>
412
- <div>
413
- <h1 class="ForewordTitle">Foreword</h1>
414
- <div id="note1" class="Note">
415
- <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>
416
- </div>
417
- <div id="note2" class="Note">
418
- <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>
419
- </div>
355
+ output = <<~OUTPUT
356
+ #{HTML_HDR}
357
+ <br/>
358
+ <div>
359
+ <h1 class="ForewordTitle">Foreword</h1>
360
+ <div id="note1" class="Note">
361
+ <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>
362
+ </div>
363
+ <div id="note2" class="Note">
364
+ <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>
420
365
  </div>
421
- <p class="zzSTDTitle1"/>
422
366
  </div>
423
- </body>
424
- </html>
425
- OUTPUT
367
+ <p class="zzSTDTitle1"/>
368
+ </div>
369
+ </body>
370
+ </html>
371
+ OUTPUT
372
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
373
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
374
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
375
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
426
376
  end
427
377
 
428
378
  it "processes multi-para notes" do
429
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
430
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
431
- <iso-standard xmlns="http://riboseinc.com/isoxml">
432
- <preface><foreword>
433
- <note>
434
- <name>NOTE</name>
435
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
436
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
437
- </note>
438
- </foreword></preface>
439
- </iso-standard>
440
- INPUT
441
- #{HTML_HDR}
442
- <br/>
443
- <div>
444
- <h1 class="ForewordTitle">Foreword</h1>
445
- <div class="Note">
446
- <p><span class="note_label">NOTE</span>&#160; These results are based on a study carried out on three different types of kernel.</p>
447
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
448
- </div>
379
+ input = <<~INPUT
380
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
381
+ <preface><foreword>
382
+ <note>
383
+ <name>NOTE</name>
384
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
385
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
386
+ </note>
387
+ </foreword></preface>
388
+ </iso-standard>
389
+ INPUT
390
+ output = <<~OUTPUT
391
+ #{HTML_HDR}
392
+ <br/>
393
+ <div>
394
+ <h1 class="ForewordTitle">Foreword</h1>
395
+ <div class="Note">
396
+ <p><span class="note_label">NOTE</span>&#160; These results are based on a study carried out on three different types of kernel.</p>
397
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
449
398
  </div>
450
- <p class="zzSTDTitle1"/>
451
399
  </div>
452
- </body>
453
- </html>
454
- OUTPUT
455
- end
456
-
457
- it "processes non-para notes" do
400
+ <p class="zzSTDTitle1"/>
401
+ </div>
402
+ </body>
403
+ </html>
404
+ OUTPUT
458
405
  expect(xmlpp(IsoDoc::HtmlConvert.new({})
459
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
460
- <iso-standard xmlns="http://riboseinc.com/isoxml">
461
- <preface><foreword>
462
- <note id="A"><name>NOTE</name>
463
- <dl>
464
- <dt>A</dt>
465
- <dd><p>B</p></dd>
466
- </dl>
467
- <ul>
468
- <li>C</li></ul>
469
- </note>
470
- </foreword></preface>
471
- </iso-standard>
472
- INPUT
473
- #{HTML_HDR}
474
- <br/>
475
- <div>
476
- <h1 class="ForewordTitle">Foreword</h1>
477
- <div id="A" class="Note"><p><span class="note_label">NOTE</span>&#160; </p>
478
- <dl><dt><p>A</p></dt><dd><p>B</p></dd></dl>
479
- <ul>
480
- <li>C</li></ul>
481
- </div>
482
- </div>
483
- <p class="zzSTDTitle1"/>
484
- </div>
485
- </body>
486
- </html>
487
-
488
- OUTPUT
406
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
489
407
  end
490
408
 
491
- it "processes non-para notes (Word)" do
492
- expect(xmlpp(IsoDoc::WordConvert.new({})
493
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
494
- <iso-standard xmlns="http://riboseinc.com/isoxml">
495
- <preface><foreword>
496
- <note id="A"><name>NOTE</name>
497
- <dl>
498
- <dt>A</dt>
499
- <dd><p>B</p></dd>
500
- </dl>
501
- <ul>
502
- <li>C</li></ul>
503
- </note>
504
- </foreword></preface>
505
- </iso-standard>
506
- INPUT
507
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
508
- <head><style/></head>
509
- <body lang="EN-US" link="blue" vlink="#954F72">
510
- <div class="WordSection1">
511
- <p>&#160;</p>
512
- </div>
513
- <p><br clear="all" class="section"/></p>
514
- <div class="WordSection2">
515
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
516
- <div>
517
- <h1 class="ForewordTitle">Foreword</h1>
518
- <div id="A" class="Note"><p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">&#160; </span></p>
519
- <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>
409
+ it "processes non-para notes" do
410
+ input = <<~INPUT
411
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
412
+ <preface><foreword>
413
+ <note id="A"><name>NOTE</name>
414
+ <dl>
415
+ <dt>A</dt>
416
+ <dd><p>B</p></dd>
417
+ </dl>
418
+ <ul>
419
+ <li>C</li></ul>
420
+ </note>
421
+ </foreword></preface>
422
+ </iso-standard>
423
+ INPUT
424
+ html = <<~OUTPUT
425
+ #{HTML_HDR}
426
+ <br/>
427
+ <div>
428
+ <h1 class="ForewordTitle">Foreword</h1>
429
+ <div id="A" class="Note"><p><span class="note_label">NOTE</span>&#160; </p>
430
+ <dl><dt><p>A</p></dt><dd><p>B</p></dd></dl>
520
431
  <ul>
521
432
  <li>C</li></ul>
522
433
  </div>
434
+ </div>
435
+ <p class="zzSTDTitle1"/>
523
436
  </div>
524
- <p>&#160;</p>
525
- </div>
526
- <p><br clear="all" class="section"/></p>
527
- <div class="WordSection3">
528
- <p class="zzSTDTitle1"/>
529
- </div>
530
- </body>
437
+ </body>
531
438
  </html>
532
- OUTPUT
533
- end
534
439
 
535
- it "processes paragraphs containing notes" do
536
- expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({})
537
- .convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
538
- <iso-standard xmlns="http://riboseinc.com/isoxml">
539
- <preface><foreword>
540
- <p id="A">ABC <note id="B"><name>NOTE 1</name><p id="C">XYZ</p></note>
541
- <note id="B1"><name>NOTE 2</name><p id="C1">XYZ1</p></note></p>
542
- </foreword></preface>
543
- </iso-standard>
544
- INPUT
545
- #{HTML_HDR}
546
- <br/>
547
- <div>
548
- <h1 class='ForewordTitle'>Foreword</h1>
549
- <p id='A'>
550
- ABC
551
- <div id='B' class='Note'>
552
- <p>
553
- <span class='note_label'>NOTE 1</span>
554
- &#160; XYZ
555
- </p>
556
- </div>
557
- <div id='B1' class='Note'>
558
- <p>
559
- <span class='note_label'>NOTE 2</span>
560
- &#160; XYZ1
561
- </p>
562
- </div>
563
- </p>
564
- </div>
565
- <p class='zzSTDTitle1'/>
566
- </div>
567
- </body>
568
- </html>
569
- OUTPUT
570
- end
571
-
572
- it "processes paragraphs containing notes (Word)" do
573
- expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
574
- .convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
575
- <iso-standard xmlns="http://riboseinc.com/isoxml">
576
- <preface><foreword>
577
- <p id="A">ABC <note id="B"><name>NOTE 1</name><p id="C">XYZ</p></note>
578
- <note id="B1"><name>NOTE 2</name><p id="C1">XYZ1</p></note></p>
579
- </foreword></preface>
580
- </iso-standard>
581
- INPUT
582
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
583
- <head>
584
- <style/>
585
- </head>
586
- <body lang='EN-US' link='blue' vlink='#954F72'>
587
- <div class='WordSection1'>
588
- <p>&#160;</p>
589
- </div>
590
- <p>
591
- <br clear='all' class='section'/>
592
- </p>
593
- <div class='WordSection2'>
594
- <p>
595
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
596
- </p>
597
- <div>
598
- <h1 class='ForewordTitle'>Foreword</h1>
599
- <p id='A'>ABC </p>
600
- <div id='B' class='Note'>
601
- <p class='Note'>
602
- <span class='note_label'>NOTE 1</span>
603
- <span style='mso-tab-count:1'>&#160; </span>
604
- XYZ
605
- </p>
606
- </div>
607
- <div id='B1' class='Note'>
608
- <p class='Note'>
609
- <span class='note_label'>NOTE 2</span>
610
- <span style='mso-tab-count:1'>&#160; </span>
611
- XYZ1
440
+ OUTPUT
441
+ doc = <<~OUTPUT
442
+ <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
443
+ <head><style/></head>
444
+ <body lang="EN-US" link="blue" vlink="#954F72">
445
+ <div class="WordSection1">
446
+ <p>&#160;</p>
447
+ </div>
448
+ <p><br clear="all" class="section"/></p>
449
+ <div class="WordSection2">
450
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
451
+ <div>
452
+ <h1 class="ForewordTitle">Foreword</h1>
453
+ <div id="A" class="Note"><p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">&#160; </span></p>
454
+ <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>
455
+ <ul>
456
+ <li>C</li></ul>
457
+ </div>
458
+ </div>
459
+ <p>&#160;</p>
460
+ </div>
461
+ <p><br clear="all" class="section"/></p>
462
+ <div class="WordSection3">
463
+ <p class="zzSTDTitle1"/>
464
+ </div>
465
+ </body>
466
+ </html>
467
+ OUTPUT
468
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
469
+ .convert("test", input, true))).to be_equivalent_to xmlpp(html)
470
+ expect(xmlpp(IsoDoc::WordConvert.new({})
471
+ .convert("test", input, true))).to be_equivalent_to xmlpp(doc)
472
+ end
473
+
474
+ it "processes paragraphs containing notes" do
475
+ input = <<~INPUT
476
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
477
+ <preface><foreword>
478
+ <p id="A">ABC <note id="B"><name>NOTE 1</name><p id="C">XYZ</p></note>
479
+ <note id="B1"><name>NOTE 2</name><p id="C1">XYZ1</p></note></p>
480
+ </foreword></preface>
481
+ </iso-standard>
482
+ INPUT
483
+ html = <<~OUTPUT
484
+ #{HTML_HDR}
485
+ <br/>
486
+ <div>
487
+ <h1 class='ForewordTitle'>Foreword</h1>
488
+ <p id='A'>
489
+ ABC
490
+ <div id='B' class='Note'>
491
+ <p>
492
+ <span class='note_label'>NOTE 1</span>
493
+ &#160; XYZ
494
+ </p>
495
+ </div>
496
+ <div id='B1' class='Note'>
497
+ <p>
498
+ <span class='note_label'>NOTE 2</span>
499
+ &#160; XYZ1
500
+ </p>
501
+ </div>
612
502
  </p>
613
503
  </div>
504
+ <p class='zzSTDTitle1'/>
614
505
  </div>
615
- <p>&#160;</p>
616
- </div>
506
+ </body>
507
+ </html>
508
+ OUTPUT
509
+
510
+ doc = <<~OUTPUT
511
+ <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
512
+ <head>
513
+ <style/>
514
+ </head>
515
+ <body lang='EN-US' link='blue' vlink='#954F72'>
516
+ <div class='WordSection1'>
517
+ <p>&#160;</p>
518
+ </div>
519
+ <p>
520
+ <br clear='all' class='section'/>
521
+ </p>
522
+ <div class='WordSection2'>
617
523
  <p>
618
- <br clear='all' class='section'/>
524
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
619
525
  </p>
620
- <div class='WordSection3'>
621
- <p class='zzSTDTitle1'/>
526
+ <div>
527
+ <h1 class='ForewordTitle'>Foreword</h1>
528
+ <p id='A'>ABC </p>
529
+ <div id='B' class='Note'>
530
+ <p class='Note'>
531
+ <span class='note_label'>NOTE 1</span>
532
+ <span style='mso-tab-count:1'>&#160; </span>
533
+ XYZ
534
+ </p>
535
+ </div>
536
+ <div id='B1' class='Note'>
537
+ <p class='Note'>
538
+ <span class='note_label'>NOTE 2</span>
539
+ <span style='mso-tab-count:1'>&#160; </span>
540
+ XYZ1
541
+ </p>
542
+ </div>
622
543
  </div>
623
- </body>
624
- </html>
625
- OUTPUT
544
+ <p>&#160;</p>
545
+ </div>
546
+ <p>
547
+ <br clear='all' class='section'/>
548
+ </p>
549
+ <div class='WordSection3'>
550
+ <p class='zzSTDTitle1'/>
551
+ </div>
552
+ </body>
553
+ </html>
554
+ OUTPUT
555
+ expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({})
556
+ .convert("test", input, true)))).to be_equivalent_to xmlpp(html)
557
+ expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
558
+ .convert("test", input, true)))).to be_equivalent_to xmlpp(doc)
626
559
  end
627
560
 
628
561
  it "processes figures" do
@@ -658,7 +591,7 @@ RSpec.describe IsoDoc do
658
591
  presxml = <<~OUTPUT
659
592
  <?xml version='1.0'?>
660
593
  <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
661
- <preface><foreword>
594
+ <preface><foreword displayorder="1">
662
595
  <figure id="figureA-1" keep-with-next="true" keep-lines-together="true">
663
596
  <name>Figure 1&#xA0;&#x2014; Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name>
664
597
  <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
@@ -802,7 +735,7 @@ RSpec.describe IsoDoc do
802
735
  presxml = <<~OUTPUT
803
736
  <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
804
737
  <preface>
805
- <foreword>
738
+ <foreword displayorder="1">
806
739
  <figure id='figureA-1'>
807
740
  <name>Figure 1</name>
808
741
  <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
@@ -884,7 +817,7 @@ RSpec.describe IsoDoc do
884
817
 
885
818
  it "converts SVG (Word)" do
886
819
  FileUtils.rm_rf "spec/assets/odf1.emf"
887
- expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.emf['"]/, "'_.emf'").gsub(/['"][^'".]+\.(gif|xml)['"]/, "'_.\\1'").gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")))).to be_equivalent_to xmlpp(<<~"OUTPUT")
820
+ input = <<~INPUT
888
821
  <iso-standard xmlns="http://riboseinc.com/isoxml">
889
822
  <preface><foreword>
890
823
  <figure id="figureA-1">
@@ -896,42 +829,49 @@ RSpec.describe IsoDoc do
896
829
  </foreword></preface>
897
830
  </iso-standard>
898
831
  INPUT
899
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
900
- <head>
901
- <style>
902
- </style>
903
- </head>
904
- <body lang='EN-US' link='blue' vlink='#954F72'>
905
- <div class='WordSection1'>
906
- <p>&#160;</p>
907
- </div>
908
- <p>
909
- <br clear='all' class='section'/>
910
- </p>
911
- <div class='WordSection2'>
912
- <p>
913
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
914
- </p>
915
- <div>
916
- <h1 class='ForewordTitle'>Foreword</h1>
917
- <div id='figureA-1' class='figure'>
918
- <img src='spec/assets/odf.emf'/>
919
- <img src='spec/assets/odf1.emf'/>
920
- <img src='_.emf' height='auto' width='auto'/>
921
- <img src='_.xml' height='20' width='auto'/>
922
- </div>
923
- </div>
924
- <p>&#160;</p>
925
- </div>
926
- <p>
927
- <br clear='all' class='section'/>
928
- </p>
929
- <div class='WordSection3'>
930
- <p class='zzSTDTitle1'/>
931
- </div>
932
- </body>
933
- </html>
832
+ output = <<~OUTPUT
833
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
834
+ <head>
835
+ <style>
836
+ </style>
837
+ </head>
838
+ <body lang='EN-US' link='blue' vlink='#954F72'>
839
+ <div class='WordSection1'>
840
+ <p>&#160;</p>
841
+ </div>
842
+ <p>
843
+ <br clear='all' class='section'/>
844
+ </p>
845
+ <div class='WordSection2'>
846
+ <p>
847
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
848
+ </p>
849
+ <div>
850
+ <h1 class='ForewordTitle'>Foreword</h1>
851
+ <div id='figureA-1' class='figure'>
852
+ <img src='spec/assets/odf.emf'/>
853
+ <img src='spec/assets/odf1.emf'/>
854
+ <img src='_.emf' height='auto' width='auto'/>
855
+ <img src='_.xml' height='20' width='auto'/>
856
+ </div>
857
+ </div>
858
+ <p>&#160;</p>
859
+ </div>
860
+ <p>
861
+ <br clear='all' class='section'/>
862
+ </p>
863
+ <div class='WordSection3'>
864
+ <p class='zzSTDTitle1'/>
865
+ </div>
866
+ </body>
867
+ </html>
934
868
  OUTPUT
869
+ expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
870
+ .convert("test", input, true)
871
+ .gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.emf['"]/, "'_.emf'")
872
+ .gsub(/['"][^'".]+\.(gif|xml)['"]/, "'_.\\1'")
873
+ .gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref"))))
874
+ .to be_equivalent_to xmlpp(output)
935
875
  end
936
876
 
937
877
  context "disable inkscape" do
@@ -942,8 +882,7 @@ RSpec.describe IsoDoc do
942
882
  allow_any_instance_of(IsoDoc::WordFunction::Body)
943
883
  .to receive(:inkscape_installed?)
944
884
 
945
- expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
946
- .convert("test", <<~"INPUT", true).gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.svg['"]/, "'_.svg'").gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")))).to be_equivalent_to xmlpp(<<~"OUTPUT")
885
+ input = <<~INPUT
947
886
  <iso-standard xmlns="http://riboseinc.com/isoxml">
948
887
  <preface><foreword>
949
888
  <figure id="figureA-1">
@@ -954,46 +893,52 @@ RSpec.describe IsoDoc do
954
893
  </foreword></preface>
955
894
  </iso-standard>
956
895
  INPUT
957
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
958
- <head>
959
- <style>
960
- </style>
961
- </head>
962
- <body lang='EN-US' link='blue' vlink='#954F72'>
963
- <div class='WordSection1'>
964
- <p>&#160;</p>
965
- </div>
966
- <p>
967
- <br clear='all' class='section'/>
968
- </p>
969
- <div class='WordSection2'>
970
- <p>
971
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
972
- </p>
973
- <div>
974
- <h1 class='ForewordTitle'>Foreword</h1>
975
- <div id='figureA-1' class='figure'>
976
- <img src='spec/assets/odf.emf'/>
977
- <img src='spec/assets/odf1.svg'/>
978
- <img src='_.svg' height='auto' width='auto'/>
979
- </div>
980
- </div>
981
- <p>&#160;</p>
982
- </div>
983
- <p>
984
- <br clear='all' class='section'/>
985
- </p>
986
- <div class='WordSection3'>
987
- <p class='zzSTDTitle1'/>
988
- </div>
989
- </body>
990
- </html>
896
+ output = <<~OUTPUT
897
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
898
+ <head>
899
+ <style>
900
+ </style>
901
+ </head>
902
+ <body lang='EN-US' link='blue' vlink='#954F72'>
903
+ <div class='WordSection1'>
904
+ <p>&#160;</p>
905
+ </div>
906
+ <p>
907
+ <br clear='all' class='section'/>
908
+ </p>
909
+ <div class='WordSection2'>
910
+ <p>
911
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
912
+ </p>
913
+ <div>
914
+ <h1 class='ForewordTitle'>Foreword</h1>
915
+ <div id='figureA-1' class='figure'>
916
+ <img src='spec/assets/odf.emf'/>
917
+ <img src='spec/assets/odf1.svg'/>
918
+ <img src='_.svg' height='auto' width='auto'/>
919
+ </div>
920
+ </div>
921
+ <p>&#160;</p>
922
+ </div>
923
+ <p>
924
+ <br clear='all' class='section'/>
925
+ </p>
926
+ <div class='WordSection3'>
927
+ <p class='zzSTDTitle1'/>
928
+ </div>
929
+ </body>
930
+ </html>
991
931
  OUTPUT
932
+ expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
933
+ .convert("test", input, true)
934
+ .gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.svg['"]/, "'_.svg'")
935
+ .gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref"))))
936
+ .to be_equivalent_to xmlpp(output)
992
937
  end
993
938
  end
994
939
 
995
- it "processes examples (Presentation XML)" do
996
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
940
+ it "processes examples" do
941
+ input = <<~INPUT
997
942
  <iso-standard xmlns="http://riboseinc.com/isoxml">
998
943
  <preface><foreword>
999
944
  <example id="samplecode" keep-with-next="true" keep-lines-together="true">
@@ -1006,10 +951,11 @@ RSpec.describe IsoDoc do
1006
951
  </foreword></preface>
1007
952
  </iso-standard>
1008
953
  INPUT
954
+ presxml = <<~OUTPUT
1009
955
  <?xml version='1.0'?>
1010
956
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1011
957
  <preface>
1012
- <foreword>
958
+ <foreword displayorder="1">
1013
959
  <example id='samplecode' keep-with-next='true' keep-lines-together='true'>
1014
960
  <name>EXAMPLE&#xA0;&#x2014; Title</name>
1015
961
  <p>Hello</p>
@@ -1021,22 +967,8 @@ RSpec.describe IsoDoc do
1021
967
  </preface>
1022
968
  </iso-standard>
1023
969
  OUTPUT
1024
- end
1025
970
 
1026
- it "processes examples (HTML)" do
1027
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1028
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1029
- <preface>
1030
- <foreword>
1031
- <example id='samplecode' keep-with-next='true' keep-lines-together='true'>
1032
- <name>EXAMPLE&#xA0;&#x2014; Title</name>
1033
- <p>Hello</p>
1034
- <sourcecode id='X'><name>Sample</name></sourcecode>
1035
- </example>
1036
- </foreword>
1037
- </preface>
1038
- </iso-standard>
1039
- INPUT
971
+ html = <<~OUTPUT
1040
972
  #{HTML_HDR}
1041
973
  <br/>
1042
974
  <div>
@@ -1044,7 +976,12 @@ RSpec.describe IsoDoc do
1044
976
  <div id="samplecode" class="example" style="page-break-after: avoid;page-break-inside: avoid;">
1045
977
  <p class="example-title">EXAMPLE&#160;&#8212; Title</p>
1046
978
  <p>Hello</p>
1047
- <pre id='X' class='prettyprint '/>
979
+ <pre id='X' class='prettyprint '>
980
+ <br/>
981
+ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
982
+ <br/>
983
+ &#160;&#160;&#160;&#160;&#160;&#160;&#160;
984
+ </pre>
1048
985
  <p class='SourceTitle' style='text-align:center;'>Sample</p>
1049
986
  </div>
1050
987
  </div>
@@ -1053,22 +990,7 @@ RSpec.describe IsoDoc do
1053
990
  </body>
1054
991
  </html>
1055
992
  OUTPUT
1056
- end
1057
-
1058
- it "processes examples (Word)" do
1059
- expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1060
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1061
- <preface>
1062
- <foreword>
1063
- <example id='samplecode' keep-with-next='true' keep-lines-together='true'>
1064
- <name>EXAMPLE&#xA0;&#x2014; Title</name>
1065
- <p>Hello</p>
1066
- <sourcecode id='X'><name>Sample</name></sourcecode>
1067
- </example>
1068
- </foreword>
1069
- </preface>
1070
- </iso-standard>
1071
- INPUT
993
+ doc = <<~OUTPUT
1072
994
  <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'><head><style>
1073
995
  </style>
1074
996
  </head>
@@ -1088,7 +1010,12 @@ RSpec.describe IsoDoc do
1088
1010
  <div id='samplecode' class='example' style='page-break-after: avoid;page-break-inside: avoid;'>
1089
1011
  <p class='example-title'>EXAMPLE&#160;&#8212; Title</p>
1090
1012
  <p>Hello</p>
1091
- <p id='X' class='Sourcecode'/>
1013
+ <p id='X' class='Sourcecode'>
1014
+ <br/>
1015
+ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
1016
+ <br/>
1017
+ &#160;&#160;&#160;&#160;&#160;&#160;&#160;
1018
+ </p>
1092
1019
  <p class='SourceTitle' style='text-align:center;'>Sample</p>
1093
1020
  </div>
1094
1021
  </div>
@@ -1103,10 +1030,16 @@ RSpec.describe IsoDoc do
1103
1030
  </body>
1104
1031
  </html>
1105
1032
  OUTPUT
1033
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1034
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1035
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1036
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1037
+ expect(xmlpp(IsoDoc::WordConvert.new({})
1038
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(doc)
1106
1039
  end
1107
1040
 
1108
1041
  it "processes sequences of examples" do
1109
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1042
+ input = <<~INPUT
1110
1043
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1111
1044
  <preface><foreword>
1112
1045
  <example id="samplecode">
@@ -1122,10 +1055,11 @@ RSpec.describe IsoDoc do
1122
1055
  </foreword></preface>
1123
1056
  </iso-standard>
1124
1057
  INPUT
1058
+ output = <<~OUTPUT
1125
1059
  <?xml version='1.0'?>
1126
1060
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1127
1061
  <preface>
1128
- <foreword>
1062
+ <foreword displayorder="1">
1129
1063
  <example id='samplecode'>
1130
1064
  <name>EXAMPLE 1</name>
1131
1065
  <p>Hello</p>
@@ -1142,10 +1076,12 @@ RSpec.describe IsoDoc do
1142
1076
  </preface>
1143
1077
  </iso-standard>
1144
1078
  OUTPUT
1079
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1080
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1145
1081
  end
1146
1082
 
1147
- it "processes sourcecode (Presentation XML)" do
1148
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1083
+ it "processes sourcecode" do
1084
+ input = <<~INPUT
1149
1085
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1150
1086
  <preface><foreword>
1151
1087
  <sourcecode lang="ruby" id="samplecode">
@@ -1158,10 +1094,11 @@ RSpec.describe IsoDoc do
1158
1094
  </foreword></preface>
1159
1095
  </iso-standard>
1160
1096
  INPUT
1097
+ presxml = <<~OUTPUT
1161
1098
  <?xml version='1.0'?>
1162
1099
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1163
1100
  <preface>
1164
- <foreword>
1101
+ <foreword displayorder="1">
1165
1102
  <sourcecode lang='ruby' id='samplecode'>
1166
1103
  <name>
1167
1104
  Figure 1&#xA0;&#x2014; Ruby
@@ -1174,102 +1111,62 @@ RSpec.describe IsoDoc do
1174
1111
  </preface>
1175
1112
  </iso-standard>
1176
1113
  OUTPUT
1177
- end
1178
1114
 
1179
- it "processes sourcecode (HTML)" do
1180
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1181
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1182
- <preface>
1183
- <foreword>
1184
- <sourcecode lang='ruby' id='samplecode'>
1185
- <name>
1186
- Figure 1&#xA0;&#x2014; Ruby
1187
- <em>code</em>
1188
- </name>
1189
- puts x
1190
- </sourcecode>
1191
- <sourcecode unnumbered='true'>
1192
- Que?
1193
- </sourcecode>
1194
- </foreword>
1195
- </preface>
1196
- </iso-standard>
1197
- INPUT
1115
+ html = <<~OUTPUT
1198
1116
  #{HTML_HDR}
1199
1117
  <br/>
1200
1118
  <div>
1201
1119
  <h1 class="ForewordTitle">Foreword</h1>
1202
- <pre id="samplecode" class="prettyprint lang-rb"><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160; puts x<br/></pre>
1120
+ <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>
1203
1121
  <p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p>
1204
- <pre class='prettyprint '>
1205
- <br/>
1206
- Que?
1207
- <br/>
1208
- </pre>
1122
+ <pre class='prettyprint '> Que? </pre>
1209
1123
  </div>
1210
1124
  <p class="zzSTDTitle1"/>
1211
1125
  </div>
1212
1126
  </body>
1213
1127
  </html>
1214
1128
  OUTPUT
1215
- end
1216
1129
 
1217
- it "processes sourcecode (Word)" do
1218
- expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1219
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1220
- <preface>
1221
- <foreword>
1222
- <sourcecode lang='ruby' id='samplecode'>
1223
- <name>
1224
- Figure 1&#xA0;&#x2014; Ruby
1225
- <em>code</em>
1226
- </name>
1227
- puts x
1228
- </sourcecode>
1229
- <sourcecode unnumbered='true'>
1230
- Que?
1231
- </sourcecode>
1232
- </foreword>
1233
- </preface>
1234
- </iso-standard>
1235
- INPUT
1236
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
1237
- <head><style/></head>
1238
- <body lang="EN-US" link="blue" vlink="#954F72">
1239
- <div class="WordSection1">
1240
- <p>&#160;</p>
1241
- </div>
1242
- <p>
1243
- <br clear="all" class="section"/>
1244
- </p>
1245
- <div class="WordSection2">
1246
- <p>
1247
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
1248
- </p>
1249
- <div>
1250
- <h1 class="ForewordTitle">Foreword</h1>
1251
- <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>
1252
- <p class='Sourcecode'>
1253
- <br/>
1254
- Que?
1255
- <br/>
1130
+ doc = <<~OUTPUT
1131
+ <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
1132
+ <head><style/></head>
1133
+ <body lang="EN-US" link="blue" vlink="#954F72">
1134
+ <div class="WordSection1">
1135
+ <p>&#160;</p>
1136
+ </div>
1137
+ <p>
1138
+ <br clear="all" class="section"/>
1139
+ </p>
1140
+ <div class="WordSection2">
1141
+ <p>
1142
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
1143
+ </p>
1144
+ <div>
1145
+ <h1 class="ForewordTitle">Foreword</h1>
1146
+ <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>
1147
+ <p class='Sourcecode'> Que? </p>
1148
+ </div>
1149
+ <p>&#160;</p>
1150
+ </div>
1151
+ <p>
1152
+ <br clear="all" class="section"/>
1256
1153
  </p>
1257
- </div>
1258
- <p>&#160;</p>
1259
- </div>
1260
- <p>
1261
- <br clear="all" class="section"/>
1262
- </p>
1263
- <div class="WordSection3">
1264
- <p class="zzSTDTitle1"/>
1265
- </div>
1266
- </body>
1267
- </html>
1154
+ <div class="WordSection3">
1155
+ <p class="zzSTDTitle1"/>
1156
+ </div>
1157
+ </body>
1158
+ </html>
1268
1159
  OUTPUT
1160
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1161
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1162
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1163
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1164
+ expect(xmlpp(IsoDoc::WordConvert.new({})
1165
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(doc)
1269
1166
  end
1270
1167
 
1271
1168
  it "processes sourcecode with escapes preserved" do
1272
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1169
+ input = <<~INPUT
1273
1170
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1274
1171
  <preface><foreword>
1275
1172
  <sourcecode id="samplecode">
@@ -1279,6 +1176,7 @@ RSpec.describe IsoDoc do
1279
1176
  </foreword></preface>
1280
1177
  </iso-standard>
1281
1178
  INPUT
1179
+ output = <<~OUTPUT
1282
1180
  #{HTML_HDR}
1283
1181
  <br/>
1284
1182
  <div>
@@ -1291,10 +1189,12 @@ RSpec.describe IsoDoc do
1291
1189
  </body>
1292
1190
  </html>
1293
1191
  OUTPUT
1192
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1193
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1294
1194
  end
1295
1195
 
1296
1196
  it "processes sourcecode with annotations" do
1297
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1197
+ input = <<~INPUT
1298
1198
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1299
1199
  <preface><foreword>
1300
1200
  <sourcecode id="_">puts "Hello, world." <callout target="A">1</callout>
@@ -1308,6 +1208,7 @@ RSpec.describe IsoDoc do
1308
1208
  </foreword></preface>
1309
1209
  </iso-standard>
1310
1210
  INPUT
1211
+ output = <<~OUTPUT
1311
1212
  #{HTML_HDR}
1312
1213
  <br/>
1313
1214
  <div>
@@ -1319,10 +1220,12 @@ RSpec.describe IsoDoc do
1319
1220
  </body>
1320
1221
  </html>
1321
1222
  OUTPUT
1223
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1224
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1322
1225
  end
1323
1226
 
1324
1227
  it "processes admonitions" do
1325
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1228
+ input = <<~INPUT
1326
1229
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1327
1230
  <preface><foreword>
1328
1231
  <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution" keep-with-next="true" keep-lines-together="true">
@@ -1331,6 +1234,7 @@ RSpec.describe IsoDoc do
1331
1234
  </foreword></preface>
1332
1235
  </iso-standard>
1333
1236
  INPUT
1237
+ output = <<~OUTPUT
1334
1238
  #{HTML_HDR}
1335
1239
  <br/>
1336
1240
  <div>
@@ -1344,10 +1248,12 @@ RSpec.describe IsoDoc do
1344
1248
  </body>
1345
1249
  </html>
1346
1250
  OUTPUT
1251
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1252
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1347
1253
  end
1348
1254
 
1349
1255
  it "processes admonitions with titles" do
1350
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1256
+ input = <<~INPUT
1351
1257
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1352
1258
  <preface><foreword>
1353
1259
  <admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution">
@@ -1357,6 +1263,7 @@ RSpec.describe IsoDoc do
1357
1263
  </foreword></preface>
1358
1264
  </iso-standard>
1359
1265
  INPUT
1266
+ output = <<~OUTPUT
1360
1267
  #{HTML_HDR}
1361
1268
  <br/>
1362
1269
  <div>
@@ -1370,10 +1277,12 @@ RSpec.describe IsoDoc do
1370
1277
  </body>
1371
1278
  </html>
1372
1279
  OUTPUT
1280
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1281
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1373
1282
  end
1374
1283
 
1375
- it "processes formulae (PresentationXML)" do
1376
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1284
+ it "processes formulae" do
1285
+ input = <<~INPUT
1377
1286
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1378
1287
  <preface><foreword>
1379
1288
  <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true" keep-with-next="true" keep-lines-together="true">
@@ -1396,43 +1305,9 @@ RSpec.describe IsoDoc do
1396
1305
  </foreword></preface>
1397
1306
  </iso-standard>
1398
1307
  INPUT
1399
- <?xml version='1.0'?>
1400
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1401
- <preface>
1402
- <foreword>
1403
- <formula id='_be9158af-7e93-4ee2-90c5-26d31c181934' unnumbered='true' keep-with-next='true' keep-lines-together='true'>
1404
- <stem type='AsciiMath'>r = 1 %</stem>
1405
- <dl id='_e4fe94fe-1cde-49d9-b1ad-743293b7e21d'>
1406
- <dt>
1407
- <stem type='AsciiMath'>r</stem>
1408
- </dt>
1409
- <dd>
1410
- <p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p>
1411
- </dd>
1412
- </dl>
1413
- <note id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0'>
1414
- <name>NOTE</name>
1415
- <p id='_511aaa98-4116-42af-8e5b-c87cdf5bfdc8'>
1416
- [durationUnits] is essentially a duration statement without the "P"
1417
- prefix. "P" is unnecessary because between "G" and "U" duration is
1418
- always expressed.
1419
- </p>
1420
- </note>
1421
- </formula>
1422
- <formula id='_be9158af-7e93-4ee2-90c5-26d31c181935'>
1423
- <name>1</name>
1424
- <stem type='AsciiMath'>r = 1 %</stem>
1425
- </formula>
1426
- </foreword>
1427
- </preface>
1428
- </iso-standard>
1429
- OUTPUT
1430
- end
1431
-
1432
- it "processes formulae (HTML)" do
1433
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1434
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1435
- <preface><foreword>
1308
+ presxml = <<~INPUT
1309
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
1310
+ <preface><foreword displayorder="1">
1436
1311
  <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true" keep-with-next="true" keep-lines-together="true">
1437
1312
  <stem type="AsciiMath">r = 1 %</stem>
1438
1313
  <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
@@ -1454,6 +1329,7 @@ RSpec.describe IsoDoc do
1454
1329
  </foreword></preface>
1455
1330
  </iso-standard>
1456
1331
  INPUT
1332
+ html = <<~OUTPUT
1457
1333
  #{HTML_HDR}
1458
1334
  <br/>
1459
1335
  <div>
@@ -1474,33 +1350,8 @@ RSpec.describe IsoDoc do
1474
1350
  </body>
1475
1351
  </html>
1476
1352
  OUTPUT
1477
- end
1478
1353
 
1479
- it "processes formulae (Word)" do
1480
- expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1481
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1482
- <preface><foreword>
1483
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true" keep-with-next="true" keep-lines-together="true">
1484
- <stem type="AsciiMath">r = 1 %</stem>
1485
- <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
1486
- <dt>
1487
- <stem type="AsciiMath">r</stem>
1488
- </dt>
1489
- <dd>
1490
- <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
1491
- </dd>
1492
- </dl>
1493
- <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
1494
- <name>NOTE</name>
1495
- <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>
1496
- </note>
1497
- </formula>
1498
- <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935"><name>1</name>
1499
- <stem type="AsciiMath">r = 1 %</stem>
1500
- </formula>
1501
- </foreword></preface>
1502
- </iso-standard>
1503
- INPUT
1354
+ word = <<~OUTPUT
1504
1355
  <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
1505
1356
  <head>
1506
1357
  <style>
@@ -1568,10 +1419,16 @@ RSpec.describe IsoDoc do
1568
1419
  </body>
1569
1420
  </html>
1570
1421
  OUTPUT
1422
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1423
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1424
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1425
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1426
+ expect(xmlpp(IsoDoc::WordConvert.new({})
1427
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
1571
1428
  end
1572
1429
 
1573
1430
  it "processes paragraph attributes" do
1574
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1431
+ input = <<~INPUT
1575
1432
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1576
1433
  <preface><foreword>
1577
1434
  <p align="left" id="_08bfe952-d57f-4150-9c95-5d52098cc2a8">Vache Equipment<br/>
@@ -1581,6 +1438,7 @@ RSpec.describe IsoDoc do
1581
1438
  </foreword></preface>
1582
1439
  </iso-standard>
1583
1440
  INPUT
1441
+ html = <<~OUTPUT
1584
1442
  #{HTML_HDR}
1585
1443
  <br/>
1586
1444
  <div>
@@ -1596,19 +1454,8 @@ RSpec.describe IsoDoc do
1596
1454
  </body>
1597
1455
  </html>
1598
1456
  OUTPUT
1599
- end
1600
1457
 
1601
- it "processes paragraph attributes (Word)" do
1602
- expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1603
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1604
- <preface><foreword>
1605
- <p align="left" id="_08bfe952-d57f-4150-9c95-5d52098cc2a8">Vache Equipment<br/>
1606
- Fictitious<br/>
1607
- World</p>
1608
- <p align="justify" keep-with-next="true" keep-lines-together="true">Justify</p>
1609
- </foreword></preface>
1610
- </iso-standard>
1611
- INPUT
1458
+ word = <<~OUTPUT
1612
1459
  <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
1613
1460
  <head><style/></head>
1614
1461
  <body lang="EN-US" link="blue" vlink="#954F72">
@@ -1635,74 +1482,56 @@ RSpec.describe IsoDoc do
1635
1482
  </body>
1636
1483
  </html>
1637
1484
  OUTPUT
1485
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1486
+ .convert("test", input, true))).to be_equivalent_to xmlpp(html)
1487
+ expect(xmlpp(IsoDoc::WordConvert.new({})
1488
+ .convert("test", input, true))).to be_equivalent_to xmlpp(word)
1638
1489
  end
1639
1490
 
1640
- it "processes blockquotes (Presentation XML)" do
1641
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1642
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1643
- <preface><foreword>
1644
- <quote id="_044bd364-c832-4b78-8fea-92242402a1d1">
1645
- <source type="inline" bibitemid="ISO7301" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality></source>
1646
- <author>ISO</author>
1647
- <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>
1648
- </quote>
1649
- </foreword></preface>
1650
- </iso-standard>
1491
+ it "processes blockquotes" do
1492
+ input = <<~INPUT
1493
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1494
+ <preface><foreword>
1495
+ <quote id="_044bd364-c832-4b78-8fea-92242402a1d1">
1496
+ <source type="inline" bibitemid="ISO7301" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality></source>
1497
+ <author>ISO</author>
1498
+ <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>
1499
+ </quote>
1500
+ </foreword></preface>
1501
+ </iso-standard>
1651
1502
  INPUT
1652
- <?xml version='1.0'?>
1653
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1654
- <preface>
1655
- <foreword>
1656
- <quote id='_044bd364-c832-4b78-8fea-92242402a1d1'>
1657
- <source type='inline' bibitemid='ISO7301' citeas='ISO 7301:2011'>
1658
- <locality type='clause'>
1659
- <referenceFrom>1</referenceFrom>
1660
- </locality>ISO 7301:2011, Clause 1
1661
- </source>
1662
- <author>ISO</author>
1663
- <p id='_d4fd0a61-f300-4285-abe6-602707590e53'>
1664
- This International Standard gives the minimum specifications for rice
1665
- (
1666
- <em>Oryza sativa</em>
1667
- L.) which is subject to international trade. It is applicable to the
1668
- following types: husked rice and milled rice, parboiled or not,
1669
- intended for direct human consumption. It is neither applicable to
1670
- other products derived from rice, nor to waxy rice (glutinous rice).
1671
- </p>
1672
- </quote>
1673
- </foreword>
1674
- </preface>
1675
- </iso-standard>
1676
- OUTPUT
1677
- end
1678
1503
 
1679
- it "processes blockquotes (HTML)" do
1680
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1681
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1682
- <preface><foreword>
1683
- <quote id="_044bd364-c832-4b78-8fea-92242402a1d1">
1684
- <source type="inline" bibitemid="ISO7301" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 7301:2011, Clause 1</source>
1685
- <author>ISO</author>
1686
- <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>
1687
- </quote>
1688
- </foreword></preface>
1689
- </iso-standard>
1504
+ presxml = <<~INPUT
1505
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
1506
+ <preface><foreword displayorder="1">
1507
+ <quote id="_044bd364-c832-4b78-8fea-92242402a1d1">
1508
+ <source type="inline" bibitemid="ISO7301" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 7301:2011, Clause 1</source>
1509
+ <author>ISO</author>
1510
+ <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>
1511
+ </quote>
1512
+ </foreword></preface>
1513
+ </iso-standard>
1690
1514
  INPUT
1515
+ html = <<~OUTPUT
1691
1516
  #{HTML_HDR}
1692
- <br/>
1693
- <div>
1694
- <h1 class="ForewordTitle">Foreword</h1>
1695
- <div class="Quote" id="_044bd364-c832-4b78-8fea-92242402a1d1">
1517
+ <br/>
1518
+ <div>
1519
+ <h1 class="ForewordTitle">Foreword</h1>
1520
+ <div class="Quote" id="_044bd364-c832-4b78-8fea-92242402a1d1">
1696
1521
 
1697
1522
 
1698
- <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>
1699
- <p class="QuoteAttribution">&#8212; ISO, <a href="#ISO7301">ISO 7301:2011, Clause 1</a></p></div>
1700
- </div>
1701
- <p class="zzSTDTitle1"/>
1702
- </div>
1703
- </body>
1704
- </html>
1523
+ <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>
1524
+ <p class="QuoteAttribution">&#8212; ISO, <a href="#ISO7301">ISO 7301:2011, Clause 1</a></p></div>
1525
+ </div>
1526
+ <p class="zzSTDTitle1"/>
1527
+ </div>
1528
+ </body>
1529
+ </html>
1705
1530
  OUTPUT
1531
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1532
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1533
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1534
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1706
1535
  end
1707
1536
 
1708
1537
  it "processes term domains" do
@@ -1731,273 +1560,11 @@ RSpec.describe IsoDoc do
1731
1560
  OUTPUT
1732
1561
  end
1733
1562
 
1734
- it "processes permissions (Presentation XML)" do
1735
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1736
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1737
- <preface><foreword>
1738
- <permission id="_" keep-with-next="true" keep-lines-together="true">
1739
- <label>/ogc/recommendation/wfs/2</label>
1740
- <inherit>/ss/584/2015/level/1</inherit>
1741
- <inherit><eref type="inline" bibitemid="rfc2616" citeas="RFC 2616">RFC 2616 (HTTP/1.1)</eref></inherit>
1742
- <subject>user</subject>
1743
- <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>
1744
- <description>
1745
- <p id="_">I recommend <em>this</em>.</p>
1746
- </description>
1747
- <specification exclude="true" type="tabular">
1748
- <p id="_">This is the object of the recommendation:</p>
1749
- <table id="_">
1750
- <tbody>
1751
- <tr>
1752
- <td style="text-align:left;">Object</td>
1753
- <td style="text-align:left;">Value</td>
1754
- </tr>
1755
- <tr>
1756
- <td style="text-align:left;">Mission</td>
1757
- <td style="text-align:left;">Accomplished</td>
1758
- </tr>
1759
- </tbody>
1760
- </table>
1761
- </specification>
1762
- <description>
1763
- <p id="_">As for the measurement targets,</p>
1764
- </description>
1765
- <measurement-target exclude="false">
1766
- <p id="_">The measurement target shall be measured as:</p>
1767
- <formula id="_">
1768
- <stem type="AsciiMath">r/1 = 0</stem>
1769
- </formula>
1770
- </measurement-target>
1771
- <verification exclude="false">
1772
- <p id="_">The following code will be run for verification:</p>
1773
- <sourcecode id="_">CoreRoot(success): HttpResponse
1774
- if (success)
1775
- recommendation(label: success-response)
1776
- end
1777
- </sourcecode>
1778
- </verification>
1779
- <import exclude="true">
1780
- <sourcecode id="_">success-response()</sourcecode>
1781
- </import>
1782
- </permission>
1783
- </foreword></preface>
1784
- <bibliography><references id="_bibliography" obligation="informative" normative="false">
1785
- <title>Bibliography</title>
1786
- <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>
1787
- </references></bibliography>
1788
- </iso-standard>
1789
- INPUT
1790
- <?xml version='1.0'?>
1791
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1792
- <preface>
1793
- <foreword>
1794
- <permission id='_' keep-with-next='true' keep-lines-together='true'>
1795
- <name>Permission 1</name>
1796
- <label>/ogc/recommendation/wfs/2</label>
1797
- <inherit>/ss/584/2015/level/1</inherit>
1798
- <inherit>
1799
- <eref type='inline' bibitemid='rfc2616' citeas='RFC 2616'>RFC 2616 (HTTP/1.1)</eref>
1800
- </inherit>
1801
- <subject>user</subject>
1802
- <classification>
1803
- <tag>control-class</tag>
1804
- <value>Technical</value>
1805
- </classification>
1806
- <classification>
1807
- <tag>priority</tag>
1808
- <value>P0</value>
1809
- </classification>
1810
- <classification>
1811
- <tag>family</tag>
1812
- <value>System and Communications Protection</value>
1813
- </classification>
1814
- <classification>
1815
- <tag>family</tag>
1816
- <value>System and Communications Protocols</value>
1817
- </classification>
1818
- <description>
1819
- <p id='_'>
1820
- I recommend
1821
- <em>this</em>
1822
- .
1823
- </p>
1824
- </description>
1825
- <specification exclude='true' type='tabular'>
1826
- <p id='_'>This is the object of the recommendation:</p>
1827
- <table id='_'>
1828
- <tbody>
1829
- <tr>
1830
- <td style='text-align:left;'>Object</td>
1831
- <td style='text-align:left;'>Value</td>
1832
- </tr>
1833
- <tr>
1834
- <td style='text-align:left;'>Mission</td>
1835
- <td style='text-align:left;'>Accomplished</td>
1836
- </tr>
1837
- </tbody>
1838
- </table>
1839
- </specification>
1840
- <description>
1841
- <p id='_'>As for the measurement targets,</p>
1842
- </description>
1843
- <measurement-target exclude='false'>
1844
- <p id='_'>The measurement target shall be measured as:</p>
1845
- <formula id='_'>
1846
- <name>1</name>
1847
- <stem type='AsciiMath'>r/1 = 0</stem>
1848
- </formula>
1849
- </measurement-target>
1850
- <verification exclude='false'>
1851
- <p id='_'>The following code will be run for verification:</p>
1852
- <sourcecode id='_'>
1853
- CoreRoot(success): HttpResponse if (success) recommendation(label:
1854
- success-response) end
1855
- </sourcecode>
1856
- </verification>
1857
- <import exclude='true'>
1858
- <sourcecode id='_'>success-response()</sourcecode>
1859
- </import>
1860
- </permission>
1861
- </foreword>
1862
- </preface>
1863
- <bibliography>
1864
- <references id='_bibliography' obligation='informative' normative='false'>
1865
- <title depth="1">Bibliography</title>
1866
- <bibitem id='rfc2616' type='standard'>
1867
- <fetched>2020-03-27</fetched>
1868
- <title format='text/plain' language='en' script='Latn'>Hypertext Transfer Protocol&#x2009;&#x2014;&#x2009;HTTP/1.1</title>
1869
- <uri type='xml'>https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri>
1870
- <uri type='src'>https://www.rfc-editor.org/info/rfc2616</uri>
1871
- <docidentifier type='IETF'>RFC 2616</docidentifier>
1872
- <docidentifier type='rfc-anchor'>RFC2616</docidentifier>
1873
- <docidentifier type='DOI'>10.17487/RFC2616</docidentifier>
1874
- <date type='published'>
1875
- <on>1999-06</on>
1876
- </date>
1877
- <contributor>
1878
- <role type='author'/>
1879
- <person>
1880
- <name>
1881
- <completename language='en'>R. Fielding</completename>
1882
- </name>
1883
- <affiliation>
1884
- <organization>
1885
- <name>IETF</name>
1886
- <abbreviation>IETF</abbreviation>
1887
- </organization>
1888
- </affiliation>
1889
- </person>
1890
- </contributor>
1891
- <contributor>
1892
- <role type='author'/>
1893
- <person>
1894
- <name>
1895
- <completename language='en'>J. Gettys</completename>
1896
- </name>
1897
- <affiliation>
1898
- <organization>
1899
- <name>IETF</name>
1900
- <abbreviation>IETF</abbreviation>
1901
- </organization>
1902
- </affiliation>
1903
- </person>
1904
- </contributor>
1905
- <contributor>
1906
- <role type='author'/>
1907
- <person>
1908
- <name>
1909
- <completename language='en'>J. Mogul</completename>
1910
- </name>
1911
- <affiliation>
1912
- <organization>
1913
- <name>IETF</name>
1914
- <abbreviation>IETF</abbreviation>
1915
- </organization>
1916
- </affiliation>
1917
- </person>
1918
- </contributor>
1919
- <contributor>
1920
- <role type='author'/>
1921
- <person>
1922
- <name>
1923
- <completename language='en'>H. Frystyk</completename>
1924
- </name>
1925
- <affiliation>
1926
- <organization>
1927
- <name>IETF</name>
1928
- <abbreviation>IETF</abbreviation>
1929
- </organization>
1930
- </affiliation>
1931
- </person>
1932
- </contributor>
1933
- <contributor>
1934
- <role type='author'/>
1935
- <person>
1936
- <name>
1937
- <completename language='en'>L. Masinter</completename>
1938
- </name>
1939
- <affiliation>
1940
- <organization>
1941
- <name>IETF</name>
1942
- <abbreviation>IETF</abbreviation>
1943
- </organization>
1944
- </affiliation>
1945
- </person>
1946
- </contributor>
1947
- <contributor>
1948
- <role type='author'/>
1949
- <person>
1950
- <name>
1951
- <completename language='en'>P. Leach</completename>
1952
- </name>
1953
- <affiliation>
1954
- <organization>
1955
- <name>IETF</name>
1956
- <abbreviation>IETF</abbreviation>
1957
- </organization>
1958
- </affiliation>
1959
- </person>
1960
- </contributor>
1961
- <contributor>
1962
- <role type='author'/>
1963
- <person>
1964
- <name>
1965
- <completename language='en'>T. Berners-Lee</completename>
1966
- </name>
1967
- <affiliation>
1968
- <organization>
1969
- <name>IETF</name>
1970
- <abbreviation>IETF</abbreviation>
1971
- </organization>
1972
- </affiliation>
1973
- </person>
1974
- </contributor>
1975
- <language>en</language>
1976
- <script>Latn</script>
1977
- <abstract format='text/plain' language='en' script='Latn'>
1978
- HTTP has been in use by the World-Wide Web global information
1979
- initiative since 1990. This specification defines the protocol
1980
- referred to as &#x201C;HTTP/1.1&#x201D;, and is an update to RFC 2068.
1981
- [STANDARDS-TRACK]
1982
- </abstract>
1983
- <series type='main'>
1984
- <title format='text/plain' language='en' script='Latn'>RFC</title>
1985
- <number>2616</number>
1986
- </series>
1987
- <place>Fremont, CA</place>
1988
- </bibitem>
1989
- </references>
1990
- </bibliography>
1991
- </iso-standard>
1992
- OUTPUT
1993
- end
1994
-
1995
- it "processes permissions (HTML)" do
1996
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1563
+ it "processes permissions" do
1564
+ input = <<~INPUT
1997
1565
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1998
1566
  <preface><foreword>
1999
1567
  <permission id="_" keep-with-next="true" keep-lines-together="true">
2000
- <name>Permission 1</name>
2001
1568
  <label>/ogc/recommendation/wfs/2</label>
2002
1569
  <inherit>/ss/584/2015/level/1</inherit>
2003
1570
  <inherit><eref type="inline" bibitemid="rfc2616" citeas="RFC 2616">RFC 2616 (HTTP/1.1)</eref></inherit>
@@ -2043,52 +1610,112 @@ RSpec.describe IsoDoc do
2043
1610
  </import>
2044
1611
  </permission>
2045
1612
  </foreword></preface>
2046
- <bibliography><references id="_bibliography" obligation="informative" normative="false">
1613
+ <bibliography><references id="_bibliography" obligation="informative" normative="false" displayorder="2">
2047
1614
  <title>Bibliography</title>
2048
1615
  <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>
2049
1616
  </references></bibliography>
2050
1617
  </iso-standard>
2051
1618
  INPUT
2052
- #{HTML_HDR}
2053
- <br/>
2054
- <div>
2055
- <h1 class="ForewordTitle">Foreword</h1>
2056
- <div class="permission" id='_' style='page-break-after: avoid;page-break-inside: avoid;'>
2057
- <p class="RecommendationTitle">Permission 1:<br/>/ogc/recommendation/wfs/2</p>
2058
- <p><i>Subject: user<br/>
2059
- Inherits: /ss/584/2015/level/1
2060
- <br/>
2061
- Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
2062
- <br/>Control-class: Technical<br/>Priority: P0<br/>Family: System and Communications Protection<br/>Family: System and Communications Protocols</i></p>
2063
- <div class="requirement-description">
2064
- <p id="_">I recommend <i>this</i>.</p>
2065
- </div>
2066
- <div class="requirement-description">
2067
- <p id="_">As for the measurement targets,</p>
2068
- </div>
2069
- <div class="requirement-measurement-target">
2070
- <p id="_">The measurement target shall be measured as:</p>
2071
- <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span></p></div></div>
2072
- </div>
2073
- <div class="requirement-verification">
2074
- <p id="_">The following code will be run for verification:</p>
2075
- <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>
1619
+ presxml = <<~OUTPUT
1620
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
1621
+ <preface><foreword displayorder='1'>
1622
+ <permission id="_" keep-with-next="true" keep-lines-together="true">
1623
+ <name>Permission 1</name>
1624
+ <label>/ogc/recommendation/wfs/2</label>
1625
+ <inherit>/ss/584/2015/level/1</inherit>
1626
+ <inherit><eref type="inline" bibitemid="rfc2616" citeas="RFC 2616">RFC 2616 (HTTP/1.1)</eref></inherit>
1627
+ <subject>user</subject>
1628
+ <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>
1629
+ <description>
1630
+ <p id="_">I recommend <em>this</em>.</p>
1631
+ </description>
1632
+ <specification exclude="true" type="tabular">
1633
+ <p id="_">This is the object of the recommendation:</p>
1634
+ <table id="_">
1635
+ <tbody>
1636
+ <tr>
1637
+ <td style="text-align:left;">Object</td>
1638
+ <td style="text-align:left;">Value</td>
1639
+ </tr>
1640
+ <tr>
1641
+ <td style="text-align:left;">Mission</td>
1642
+ <td style="text-align:left;">Accomplished</td>
1643
+ </tr>
1644
+ </tbody>
1645
+ </table>
1646
+ </specification>
1647
+ <description>
1648
+ <p id="_">As for the measurement targets,</p>
1649
+ </description>
1650
+ <measurement-target exclude="false">
1651
+ <p id="_">The measurement target shall be measured as:</p>
1652
+ <formula id="_">
1653
+ <name>1</name>
1654
+ <stem type="AsciiMath">r/1 = 0</stem>
1655
+ </formula>
1656
+ </measurement-target>
1657
+ <verification exclude="false">
1658
+ <p id="_">The following code will be run for verification:</p>
1659
+ <sourcecode id="_">CoreRoot(success): HttpResponse
1660
+ if (success)
1661
+ recommendation(label: success-response)
1662
+ end
1663
+ </sourcecode>
1664
+ </verification>
1665
+ <import exclude="true">
1666
+ <sourcecode id="_">success-response()</sourcecode>
1667
+ </import>
1668
+ </permission>
1669
+ </foreword></preface>
1670
+ <bibliography><references id="_bibliography" obligation="informative" normative="false" displayorder='2'>
1671
+ <title depth='1'>Bibliography</title>
1672
+ <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">IETF RFC 2616</docidentifier> <docidentifier type="rfc-anchor">RFC2616</docidentifier> <docidentifier type="DOI">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>
1673
+ </references></bibliography>
1674
+ </iso-standard>
1675
+ OUTPUT
1676
+ html = <<~OUTPUT
1677
+ #{HTML_HDR}
1678
+ <br/>
1679
+ <div>
1680
+ <h1 class="ForewordTitle">Foreword</h1>
1681
+ <div class="permission" id='_' style='page-break-after: avoid;page-break-inside: avoid;'>
1682
+ <p class="RecommendationTitle">Permission 1:<br/>/ogc/recommendation/wfs/2</p>
1683
+ <p><i>Subject: user<br/>
1684
+ Inherits: /ss/584/2015/level/1
1685
+ <br/>
1686
+ Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
1687
+ <br/>Control-class: Technical<br/>Priority: P0<br/>Family: System and Communications Protection<br/>Family: System and Communications Protocols</i></p>
1688
+ <div class="requirement-description">
1689
+ <p id="_">I recommend <i>this</i>.</p>
1690
+ </div>
1691
+ <div class="requirement-description">
1692
+ <p id="_">As for the measurement targets,</p>
1693
+ </div>
1694
+ <div class="requirement-measurement-target">
1695
+ <p id="_">The measurement target shall be measured as:</p>
1696
+ <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>&#160; (1)</p></div></div>
1697
+ </div>
1698
+ <div class="requirement-verification">
1699
+ <p id="_">The following code will be run for verification:</p>
1700
+ <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>
1701
+ </div>
2076
1702
  </div>
2077
- </div>
1703
+ </div>
1704
+ <p class="zzSTDTitle1"/>
1705
+ <br/>
1706
+ <div>
1707
+ <h1 class='Section3'>Bibliography</h1>
1708
+ <p id='rfc2616' class='Biblio'>
1709
+ [1]&#160; IETF RFC 2616,
1710
+ <i>Hypertext Transfer Protocol&#8201;&#8212;&#8201;HTTP/1.1</i>
1711
+ </p>
1712
+ </div>
2078
1713
  </div>
2079
- <p class="zzSTDTitle1"/>
2080
- <br/>
2081
- <div>
2082
- <h1 class='Section3'>Bibliography</h1>
2083
- <p id='rfc2616' class='Biblio'>
2084
- [1]&#160; IETF RFC 2616,
2085
- <i>Hypertext Transfer Protocol&#8201;&#8212;&#8201;HTTP/1.1</i>
2086
- </p>
2087
- </div>
2088
- </div>
2089
- </body>
2090
- </html>
1714
+ </body>
1715
+ </html>
2091
1716
  OUTPUT
1717
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1718
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
2092
1719
  end
2093
1720
 
2094
1721
  it "processes requirements (Presentation XML)" do
@@ -2145,7 +1772,7 @@ RSpec.describe IsoDoc do
2145
1772
  <?xml version='1.0'?>
2146
1773
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2147
1774
  <preface>
2148
- <foreword>
1775
+ <foreword displayorder="1">
2149
1776
  <requirement id='A' unnumbered='true' keep-with-next='true' keep-lines-together='true'>
2150
1777
  <name>Requirement</name>
2151
1778
  <title>A New Requirement</title>
@@ -2344,7 +1971,7 @@ RSpec.describe IsoDoc do
2344
1971
  <language current="true">fr</language>
2345
1972
  <script current="true">Latn</script>
2346
1973
  </bibdata>
2347
- <preface><foreword>
1974
+ <preface><foreword displayorder="1">
2348
1975
  <requirement id="A" unnumbered="true"><name>Exigence</name>
2349
1976
  <title>A New Requirement</title>
2350
1977
  <label>/ogc/recommendation/wfs/2</label>
@@ -2510,7 +2137,7 @@ RSpec.describe IsoDoc do
2510
2137
  <?xml version='1.0'?>
2511
2138
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2512
2139
  <preface>
2513
- <foreword>
2140
+ <foreword displayorder="1">
2514
2141
  <recommendation id='_' obligation='shall,could' keep-with-next='true' keep-lines-together='true'>
2515
2142
  <name>Recommendation 1</name>
2516
2143
  <label>/ogc/recommendation/wfs/2</label>
@@ -2673,7 +2300,7 @@ RSpec.describe IsoDoc do
2673
2300
  <bibdata>
2674
2301
  <language current="true">en</language>
2675
2302
  </bibdata>
2676
- <preface><foreword>
2303
+ <preface><foreword displayorder="1">
2677
2304
  <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/>
2678
2305
  &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<smallcap>B</smallcap></p>
2679
2306
  <p id="_">&#xA0;&#xA0;<em>C</em></p></figure>
@@ -2852,7 +2479,7 @@ RSpec.describe IsoDoc do
2852
2479
  </figure>
2853
2480
  </sections>
2854
2481
  <bibliography>
2855
- <references hidden='true' normative='false'>
2482
+ <references hidden='true' normative='false' displayorder="1">
2856
2483
  <bibitem id='express_action_schema' type='internal'>
2857
2484
  <docidentifier type='repository'>express/action_schema</docidentifier>
2858
2485
  </bibitem>