isodoc 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,84 @@
1
+ require "twitter_cldr"
2
+ require "bigdecimal"
3
+
4
+ module IsoDoc
5
+ class PresentationXMLConvert < ::IsoDoc::Convert
6
+ MATHML = { "m" => "http://www.w3.org/1998/Math/MathML" }.freeze
7
+
8
+ def mathml(docxml)
9
+ locale = twitter_cldr_localiser
10
+ docxml.xpath("//m:math", MATHML).each do |f|
11
+ mathml1(f, locale)
12
+ end
13
+ end
14
+
15
+ # symbols is merged into
16
+ # TwitterCldr::DataReaders::NumberDataReader.new(locale).symbols
17
+ def localize_maths(node, locale)
18
+ node.xpath(".//m:mn", MATHML).each do |x|
19
+ num = BigDecimal(x.text)
20
+ precision = /\./.match?(x.text) ? x.text.sub(/^.*\./, "").size : 0
21
+ x.children = localized_number(num, locale, precision)
22
+ end
23
+ end
24
+
25
+ # By itself twitter-cldr does not support fraction part digits grouping
26
+ # and custom delimeter, will decorate fraction part manually
27
+ def localized_number(num, locale, precision)
28
+ localized = localized_number1(num, locale, precision)
29
+ twitter_cldr_reader_symbols = twitter_cldr_reader(locale)
30
+ return localized unless twitter_cldr_reader_symbols[:decimal]
31
+
32
+ integer, fraction = localized.split(twitter_cldr_reader_symbols[:decimal])
33
+ return localized if fraction.nil? || fraction.length.zero?
34
+
35
+ [integer, decorate_fraction_part(fraction, locale)]
36
+ .join(twitter_cldr_reader_symbols[:decimal])
37
+ end
38
+
39
+ def localized_number1(num, locale, precision)
40
+ if precision.zero?
41
+ num.localize(locale).to_s
42
+ else
43
+ num.localize(locale).to_decimal.to_s(precision: precision)
44
+ end
45
+ end
46
+
47
+ def decorate_fraction_part(fract, locale)
48
+ result = []
49
+ twitter_cldr_reader_symbols = twitter_cldr_reader(locale)
50
+ fract = fract.slice(0..(twitter_cldr_reader_symbols[:precision] || -1))
51
+ fr_group_digits = twitter_cldr_reader_symbols[:fraction_group_digits] || 1
52
+ until fract.empty?
53
+ result.push(fract.slice!(0, fr_group_digits))
54
+ end
55
+ result.join(twitter_cldr_reader_symbols[:fraction_group].to_s)
56
+ end
57
+
58
+ def twitter_cldr_localiser_symbols
59
+ {}
60
+ end
61
+
62
+ def twitter_cldr_reader(locale)
63
+ num = TwitterCldr::DataReaders::NumberDataReader.new(locale)
64
+ num.symbols.merge!(twitter_cldr_localiser_symbols)
65
+ end
66
+
67
+ def twitter_cldr_localiser
68
+ locale = TwitterCldr.supported_locale?(@lang.to_sym) ? @lang.to_sym : :en
69
+ twitter_cldr_reader(locale)
70
+ locale
71
+ end
72
+
73
+ def mathml1(node, locale)
74
+ localize_maths(node, locale)
75
+ return unless node.elements.size == 1 && node.elements.first.name == "mn"
76
+
77
+ if node.parent.name == "stem"
78
+ node.parent.replace(node.at("./m:mn", MATHML).children)
79
+ else
80
+ node.replace(node.at("./m:mn", MATHML).children)
81
+ end
82
+ end
83
+ end
84
+ end
@@ -1,5 +1,6 @@
1
1
  require_relative "presentation_function/block"
2
2
  require_relative "presentation_function/inline"
3
+ require_relative "presentation_function/math"
3
4
  require_relative "presentation_function/section"
4
5
  require_relative "presentation_function/bibdata"
5
6
 
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.6.1".freeze
2
+ VERSION = "1.6.2".freeze
3
3
  end
@@ -1,5 +1,5 @@
1
- require_relative "./table.rb"
2
- require_relative "./inline.rb"
1
+ require_relative "./table"
2
+ require_relative "./inline"
3
3
 
4
4
  module IsoDoc::WordFunction
5
5
  module Body
@@ -71,8 +71,8 @@ module IsoDoc::WordFunction
71
71
  node.xpath(ns("./note")).each { |n| parse(n, out) }
72
72
  end
73
73
 
74
- WORD_DT_ATTRS = {class: @note ? "Note" : nil, align: "left",
75
- style: "margin-left:0pt;text-align:left;"}.freeze
74
+ WORD_DT_ATTRS = { class: @note ? "Note" : nil, align: "left",
75
+ style: "margin-left:0pt;text-align:left;" }.freeze
76
76
 
77
77
  def dt_parse(dt, term)
78
78
  term.p **attr_code(WORD_DT_ATTRS) do |p|
@@ -102,6 +102,7 @@ module IsoDoc::WordFunction
102
102
 
103
103
  def dl_parse_notes(node, v)
104
104
  return if node.elements.reject { |n| dt_dd? n }.empty?
105
+
105
106
  v.tr do |tr|
106
107
  tr.td **{ colspan: 2 } do |td|
107
108
  node.elements.reject { |n| dt_dd? n }.each { |n| parse(n, td) }
@@ -109,19 +110,19 @@ module IsoDoc::WordFunction
109
110
  end
110
111
  end
111
112
 
112
- def figure_get_or_make_dl(t)
113
- dl = t.at(".//table[@class = 'dl']")
113
+ def figure_get_or_make_dl(node)
114
+ dl = node.at(".//table[@class = 'dl']")
114
115
  if dl.nil?
115
- t.add_child("<p><b>#{@i18n.key}</b></p><table class='dl'></table>")
116
- dl = t.at(".//table[@class = 'dl']")
116
+ node.add_child("<p><b>#{@i18n.key}</b></p><table class='dl'></table>")
117
+ dl = node.at(".//table[@class = 'dl']")
117
118
  end
118
119
  dl
119
120
  end
120
121
 
121
- def figure_aside_process(f, aside, key)
122
+ def figure_aside_process(fig, aside, key)
122
123
  # get rid of footnote link, it is in diagram
123
- f&.at("./a[@class='TableFootnoteRef']")&.remove
124
- fnref = f.at(".//span[@class='TableFootnoteRef']/..")
124
+ fig&.at("./a[@class='TableFootnoteRef']")&.remove
125
+ fnref = fig.at(".//span[@class='TableFootnoteRef']/..")
125
126
  tr = key.add_child("<tr></tr>").first
126
127
  dt = tr.add_child("<td valign='top' align='left'></td>").first
127
128
  dd = tr.add_child("<td valign='top'></td>").first
@@ -174,31 +175,32 @@ module IsoDoc::WordFunction
174
175
  attrs[:align] = node["align"] unless node["align"] == "justify"
175
176
  attrs[:style] += "text-align:#{node['align']};"
176
177
  end
177
- attrs[:style] += "#{keep_style(node)}"
178
+ attrs[:style] += keep_style(node).to_s
178
179
  attrs[:style] = nil if attrs[:style].empty?
179
180
  attrs
180
181
  end
181
182
 
182
183
  def example_table_attr(node)
183
184
  super.merge({
184
- style: "mso-table-lspace:15.0cm;margin-left:423.0pt;"\
185
- "mso-table-rspace:15.0cm;margin-right:423.0pt;"\
186
- "mso-table-anchor-horizontal:column;"\
187
- "mso-table-overlap:never;border-collapse:collapse;"\
188
- "#{keep_style(node)}"
189
- })
185
+ style: "mso-table-lspace:15.0cm;margin-left:423.0pt;"\
186
+ "mso-table-rspace:15.0cm;margin-right:423.0pt;"\
187
+ "mso-table-anchor-horizontal:column;"\
188
+ "mso-table-overlap:never;border-collapse:collapse;"\
189
+ "#{keep_style(node)}",
190
+ })
190
191
  end
191
192
 
192
- def formula_where(dl, out)
193
- return unless dl
193
+ def formula_where(deflist, out)
194
+ return unless deflist
195
+
194
196
  out.p { |p| p << @i18n.where }
195
- parse(dl, out)
197
+ parse(deflist, out)
196
198
  out.parent.at("./table")["class"] = "formula_dl"
197
199
  end
198
200
 
199
201
  def formula_parse1(node, out)
200
202
  out.div **attr_code(class: "formula") do |div|
201
- div.p do |p|
203
+ div.p do |_p|
202
204
  parse(node.at(ns("./stem")), div)
203
205
  insert_tab(div, 1)
204
206
  if lbl = node&.at(ns("./name"))&.text
@@ -209,7 +211,7 @@ module IsoDoc::WordFunction
209
211
  end
210
212
 
211
213
  def li_parse(node, out)
212
- out.li **attr_code(id: node["id"]) do |li|
214
+ out.li **attr_code(id: node["id"]) do |li|
213
215
  if node["uncheckedcheckbox"] == "true"
214
216
  li << '<span class="zzMoveToFollowing">&#x2610; </span>'
215
217
  elsif node["checkedcheckbox"] == "true"
@@ -220,7 +222,9 @@ module IsoDoc::WordFunction
220
222
  end
221
223
 
222
224
  def suffix_url(url)
223
- return url if %r{^http[s]?://}.match(url)
225
+ return url if %r{^https?://}.match?(url)
226
+ return url unless File.extname(url).empty?
227
+
224
228
  url.sub(/#{File.extname(url)}$/, ".doc")
225
229
  end
226
230
  end
@@ -0,0 +1,156 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "renders form" do
5
+ input = <<~INPUT
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <sections>
8
+ <clause id="A">
9
+ <form action="/action_page.php" id="F0" name="F1">
10
+ <label for="fname">First name:</label><br/>
11
+ <input type="text" id="fname" name="fname"/><br/>
12
+ <label for="lname">Last name:</label><br/>
13
+ <input type="text" id="lname" name="lname"/><br/>
14
+ <label for="pwd">Password:</label><br/>
15
+ <input type="password" id="pwd" name="pwd"/><br/>
16
+ <input type="radio" id="male" name="gender" value="male"/>
17
+ <label for="male">Male</label><br/>
18
+ <input type="radio" id="female" name="gender" value="female"/>
19
+ <label for="female">Female</label><br/>
20
+ <input type="radio" id="other" name="gender" value="other"/>
21
+ <label for="other">Other</label><br/>
22
+ <input type="checkbox" id="vehicle1" name="vehicle1" value="Bike" checked="true"/>
23
+ <label for="vehicle1"> I have a bike</label><br/>
24
+ <input type="checkbox" id="vehicle2" name="vehicle2" value="Car"/>
25
+ <label for="vehicle2"> I have a car</label><br/>
26
+ <input type="checkbox" id="vehicle3" name="vehicle3" value="Boat"/>
27
+ <label for="vehicle3"> I have a boat</label><br/>
28
+ <input type="date" id="birthday" name="birthday"/><br/>
29
+ <label for="myfile">Select a file:</label>
30
+ <input type="file" id="myfile" name="myfile"/><br/>
31
+ <label for="cars">Select a car:</label>
32
+ <select id="cars" name="cars" value="fiat">
33
+ <option value="volvo">Volvo</option>
34
+ <option value="saab">Saab</option>
35
+ <option value="fiat">Fiat</option>
36
+ <option value="audi">Audi</option>
37
+ </select>
38
+ <textarea id="t1" name="message" rows="10" cols="30" value="The cat was playing in the garden."/>
39
+ <input type="button" value="Click Me!"/>
40
+ <input type="button"/>
41
+ <input type="submit" value="Submit"/>
42
+ </form>
43
+ </clause>
44
+ </sections>
45
+ </iso-standard>
46
+ INPUT
47
+
48
+ html = <<~HTML
49
+ #{HTML_HDR}
50
+ <p class='zzSTDTitle1'/>
51
+ <div id='A'>
52
+ <h1/>
53
+ <form id='F0' name='F1' action='/action_page.php'>
54
+ <label for='fname'>First name:</label>
55
+ <br/>
56
+ <input id='fname' name='fname' type='text'/>
57
+ <br/>
58
+ <label for='lname'>Last name:</label>
59
+ <br/>
60
+ <input id='lname' name='lname' type='text'/>
61
+ <br/>
62
+ <label for='pwd'>Password:</label>
63
+ <br/>
64
+ <input id='pwd' name='pwd' type='password'/>
65
+ <br/>
66
+ <input id='male' name='gender' type='radio' value='male'/>
67
+ <label for='male'>Male</label>
68
+ <br/>
69
+ <input id='female' name='gender' type='radio' value='female'/>
70
+ <label for='female'>Female</label>
71
+ <br/>
72
+ <input id='other' name='gender' type='radio' value='other'/>
73
+ <label for='other'>Other</label>
74
+ <br/>
75
+ <input id='vehicle1' name='vehicle1' type='checkbox' value='Bike' checked='true'/>
76
+ <label for='vehicle1'> I have a bike</label>
77
+ <br/>
78
+ <input id='vehicle2' name='vehicle2' type='checkbox' value='Car'/>
79
+ <label for='vehicle2'> I have a car</label>
80
+ <br/>
81
+ <input id='vehicle3' name='vehicle3' type='checkbox' value='Boat'/>
82
+ <label for='vehicle3'> I have a boat</label>
83
+ <br/>
84
+ <input id='birthday' name='birthday' type='date'/>
85
+ <br/>
86
+ <label for='myfile'>Select a file:</label>
87
+ <input id='myfile' name='myfile' type='file'/>
88
+ <br/>
89
+ <label for='cars'>Select a car:</label>
90
+ <select id='cars' name='cars'>
91
+ <option value='volvo'>Volvo</option>
92
+ <option value='saab'>Saab</option>
93
+ <option selected='true' value='fiat'>Fiat</option>
94
+ <option value='audi'>Audi</option>
95
+ </select>
96
+ <textarea id='t1' name='message' rows='10' cols='30'>The cat was playing in the garden.</textarea>
97
+ <input type='button' value='Click Me!'/>
98
+ <input type='button'/>
99
+ <input type='submit' value='Submit'/>
100
+ </form>
101
+ </div>
102
+ </div>
103
+ </body>
104
+ </html>
105
+ HTML
106
+
107
+ doc = <<~DOC
108
+ #{WORD_HDR}
109
+ <p class='zzSTDTitle1'/>
110
+ <div id='A'>
111
+ <h1/>
112
+ First name:
113
+ <br/>
114
+ __________
115
+ <br/>
116
+ Last name:
117
+ <br/>
118
+ __________
119
+ <br/>
120
+ Password:
121
+ <br/>
122
+ __________
123
+ <br/>
124
+ &#9678; Male
125
+ <br/>
126
+ &#9678; Female
127
+ <br/>
128
+ &#9678; Other
129
+ <br/>
130
+ &#9744; I have a bike
131
+ <br/>
132
+ &#9744; I have a car
133
+ <br/>
134
+ &#9744; I have a boat
135
+ <br/>
136
+ __________
137
+ <br/>
138
+ Select a file: __________
139
+ <br/>
140
+ Select a car: __________
141
+ <table border='1' width='50%'>
142
+ <tr>
143
+ <td/>
144
+ </tr>
145
+ </table>
146
+ [Click Me!] [BUTTON]
147
+ </div>
148
+ </div>
149
+ </body>
150
+ </html>
151
+ DOC
152
+
153
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(html)
154
+ expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(doc)
155
+ end
156
+ end
@@ -1,783 +1,817 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
- it "droplocs xrefs" do
5
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
- <iso-standard xmlns="http://riboseinc.com/isoxml">
7
- <sections>
8
- <clause id="A">
9
- <formula id="B">
10
- </formula>
11
- </clause>
12
- <clause id="C">
13
- <p>This is <xref target="A"/> and <xref target="B"/>.
14
- This is <xref target="A" droploc="true"/> and <xref target="B" droploc="true"/>.</p>
15
- </clause>
16
- </sections>
17
- </iso-standard>
18
- INPUT
19
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
20
- <sections>
21
- <clause id='A'>
22
- <title>1.</title>
23
- <formula id='B'>
24
- <name>1</name>
25
- </formula>
26
- </clause>
27
- <clause id='C'>
28
- <title>2.</title>
29
- <p>
30
- This is
31
- <xref target='A'>kla&#x16D;zo 1</xref>
32
- and
33
- <xref target='B'>kla&#x16D;zo 1, Formula (1)</xref>
34
- . This is
35
- <xref target='A' droploc='true'>1</xref>
36
- and
37
- <xref target='B' droploc='true'>(1)</xref>
38
- .
39
- </p>
40
- </clause>
41
- </sections>
42
- </iso-standard>
43
- OUTPUT
44
- end
4
+ it "droplocs xrefs" do
5
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({ i18nyaml: "spec/assets/i18n.yaml" }).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <sections>
8
+ <clause id="A">
9
+ <formula id="B">
10
+ </formula>
11
+ </clause>
12
+ <clause id="C">
13
+ <p>This is <xref target="A"/> and <xref target="B"/>.
14
+ This is <xref target="A" droploc="true"/> and <xref target="B" droploc="true"/>.</p>
15
+ </clause>
16
+ </sections>
17
+ </iso-standard>
18
+ INPUT
19
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
20
+ <sections>
21
+ <clause id='A'>
22
+ <title>1.</title>
23
+ <formula id='B'>
24
+ <name>1</name>
25
+ </formula>
26
+ </clause>
27
+ <clause id='C'>
28
+ <title>2.</title>
29
+ <p>
30
+ This is
31
+ <xref target='A'>kla&#x16D;zo 1</xref>
32
+ and
33
+ <xref target='B'>kla&#x16D;zo 1, Formula (1)</xref>
34
+ . This is
35
+ <xref target='A' droploc='true'>1</xref>
36
+ and
37
+ <xref target='B' droploc='true'>(1)</xref>
38
+ .
39
+ </p>
40
+ </clause>
41
+ </sections>
42
+ </iso-standard>
43
+ OUTPUT
44
+ end
45
45
 
46
46
  it "processes inline formatting (HTML)" do
47
47
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
48
- <iso-standard xmlns="http://riboseinc.com/isoxml">
49
- <preface><foreword>
50
- <p>
51
- <em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
52
- <strike>F</strike> <smallcap>G</smallcap> <keyword>I</keyword> <br/> <hr/>
53
- <bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/> <underline>J</underline>
54
- </p>
55
- </foreword></preface>
56
- <sections>
57
- </iso-standard>
48
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
49
+ <preface><foreword>
50
+ <p>
51
+ <em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
52
+ <strike>F</strike> <smallcap>G</smallcap> <keyword>I</keyword> <br/> <hr/>
53
+ <bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/> <underline>J</underline>
54
+ </p>
55
+ </foreword></preface>
56
+ <sections>
57
+ </iso-standard>
58
58
  INPUT
59
- #{HTML_HDR}
60
- <br/>
61
- <div>
62
- <h1 class="ForewordTitle">Foreword</h1>
63
- <p>
64
- <i>A</i> <b>B</b> <sup>C</sup> <sub>D</sub> <tt>E</tt>
65
- <s>F</s> <span style="font-variant:small-caps;">G</span> <span class="keyword">I</span> <br/> <hr/>
66
- <a id="H"/> <br/> <br/>
67
- <span style='text-decoration: underline;'>J</span>
68
- </p>
59
+ #{HTML_HDR}
60
+ <br/>
61
+ <div>
62
+ <h1 class="ForewordTitle">Foreword</h1>
63
+ <p>
64
+ <i>A</i> <b>B</b> <sup>C</sup> <sub>D</sub> <tt>E</tt>
65
+ <s>F</s> <span style="font-variant:small-caps;">G</span> <span class="keyword">I</span> <br/> <hr/>
66
+ <a id="H"/> <br/> <br/>
67
+ <span style='text-decoration: underline;'>J</span>
68
+ </p>
69
+ </div>
70
+ <p class="zzSTDTitle1"/>
69
71
  </div>
70
- <p class="zzSTDTitle1"/>
71
- </div>
72
- </body>
73
- </html>
72
+ </body>
73
+ </html>
74
74
  OUTPUT
75
75
  end
76
76
 
77
- it "processes inline formatting (Word)" do
77
+ it "processes inline formatting (Word)" do
78
78
  expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
79
- <iso-standard xmlns="http://riboseinc.com/isoxml">
80
- <preface/><sections><clause>
81
- <p>
82
- <em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
83
- <strike>F</strike> <smallcap>G</smallcap> <keyword>I</keyword> <br/> <hr/>
84
- <bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/> <underline>J</underline>
85
- </p>
86
- </clause></sections>
87
- </iso-standard>
79
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
80
+ <preface/><sections><clause>
81
+ <p>
82
+ <em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
83
+ <strike>F</strike> <smallcap>G</smallcap> <keyword>I</keyword> <br/> <hr/>
84
+ <bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/> <underline>J</underline>
85
+ </p>
86
+ </clause></sections>
87
+ </iso-standard>
88
88
  INPUT
89
- #{WORD_HDR}
90
- <p class='zzSTDTitle1'/>
91
- <div>
92
- <h1/>
93
- <p>
94
- <i>A</i>
95
- <b>B</b>
96
- <sup>C</sup>
97
- <sub>D</sub>
98
- <tt>E</tt>
99
- <s>F</s>
100
- <span style='font-variant:small-caps;'>G</span>
101
- <span class='keyword'>I</span>
102
- <br/>
103
- <hr/>
104
- <a id='H'/>
105
- <p>
106
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
107
- </p>
108
- <p>
109
- <br clear='all' class='section' orientation='landscape'/>
110
- </p>
111
- <u>J</u>
112
- </p>
113
- </div>
114
- </div>
115
- </body>
116
- </html>
117
-
89
+ #{WORD_HDR}
90
+ <p class='zzSTDTitle1'/>
91
+ <div>
92
+ <h1/>
93
+ <p>
94
+ <i>A</i>
95
+ <b>B</b>
96
+ <sup>C</sup>
97
+ <sub>D</sub>
98
+ <tt>E</tt>
99
+ <s>F</s>
100
+ <span style='font-variant:small-caps;'>G</span>
101
+ <span class='keyword'>I</span>
102
+ <br/>
103
+ <hr/>
104
+ <a id='H'/>
105
+ <p>
106
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
107
+ </p>
108
+ <p>
109
+ <br clear='all' class='section' orientation='landscape'/>
110
+ </p>
111
+ <u>J</u>
112
+ </p>
113
+ </div>
114
+ </div>
115
+ </body>
116
+ </html>
118
117
  OUTPUT
119
118
  end
120
119
 
121
- it "ignores index entries" do
120
+ it "ignores index entries" do
122
121
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
123
- <iso-standard xmlns="http://riboseinc.com/isoxml">
124
- <preface><foreword>
125
- <p><index primary="A" secondary="B" tertiary="C"/></p>
126
- </foreword></preface>
127
- <sections/>
128
- <indexsect>
129
- <title>Index</title>
130
- </indexsect>
131
- </iso-standard>
122
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
123
+ <preface><foreword>
124
+ <p><index primary="A" secondary="B" tertiary="C"/></p>
125
+ </foreword></preface>
126
+ <sections/>
127
+ <indexsect>
128
+ <title>Index</title>
129
+ </indexsect>
130
+ </iso-standard>
132
131
  INPUT
133
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
134
- <preface>
135
- <foreword>
136
- <p/>
137
- </foreword>
138
- </preface>
139
- <sections> </sections>
140
- </iso-standard>
132
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
133
+ <preface>
134
+ <foreword>
135
+ <p/>
136
+ </foreword>
137
+ </preface>
138
+ <sections> </sections>
139
+ </iso-standard>
141
140
  OUTPUT
142
- end
141
+ end
143
142
 
144
- it "processes concept markup" do
145
- input = <<~INPUT
146
- <iso-standard xmlns="http://riboseinc.com/isoxml">
147
- <preface><foreword>
148
- <p>
149
- <ul>
150
- <li><concept term='term'>
151
- <xref target='clause1'/>
152
- </concept></li>
153
- <li><concept term='term'>
154
- <xref target='clause1'>w[o]rd</xref>
155
- </concept></li>
156
- <li><concept term='term'>
157
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712"/>
158
- </concept></li>
159
- <li><concept term='term'>
160
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712">word</eref>
161
- </concept></li>
162
- <li><concept>
163
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
164
- <locality type='clause'>
165
- <referenceFrom>3.1</referenceFrom>
166
- </locality>
167
- <locality type='figure'>
168
- <referenceFrom>a</referenceFrom>
169
- </locality>
170
- </eref>
171
- </concept></li>
172
- <li><concept>
173
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
174
- <localityStack>
175
- <locality type='clause'>
176
- <referenceFrom>3.1</referenceFrom>
177
- </locality>
178
- </localityStack>
179
- <localityStack>
180
- <locality type='figure'>
181
- <referenceFrom>b</referenceFrom>
182
- </locality>
183
- </localityStack>
184
- </eref>
185
- </concept></li>
186
- <li><concept>
187
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
188
- <localityStack>
189
- <locality type='clause'>
190
- <referenceFrom>3.1</referenceFrom>
191
- </locality>
192
- </localityStack>
193
- <localityStack>
194
- <locality type='figure'>
195
- <referenceFrom>b</referenceFrom>
196
- </locality>
197
- </localityStack>
198
- <em>word</em>
199
- </eref>
200
- </concept></li>
201
- <li><concept term='term'>
202
- <termref base='IEV' target='135-13-13'/>
203
- </concept></li>
204
- <li><concept term='term'>
205
- <termref base='IEV' target='135-13-13'><em>word</em> word</termref>
206
- </concept></li>
207
- </ul>
208
- </p>
209
- </foreword></preface>
210
- <sections>
211
- <clause id="clause1"><title>Clause 1</title></clause>
212
- </sections>
213
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
214
- <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
215
- <bibitem id="ISO712" type="standard">
216
- <title format="text/plain">Cereals or cereal products</title>
217
- <title type="main" format="text/plain">Cereals and cereal products</title>
218
- <docidentifier type="ISO">ISO 712</docidentifier>
219
- <contributor>
220
- <role type="publisher"/>
221
- <organization>
222
- <name>International Organization for Standardization</name>
223
- </organization>
224
- </contributor>
225
- </bibitem>
226
- </references></bibliography>
227
- </iso-standard>
143
+ it "processes concept markup" do
144
+ input = <<~INPUT
145
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
146
+ <preface><foreword>
147
+ <p>
148
+ <ul>
149
+ <li><concept term='term'>
150
+ <xref target='clause1'/>
151
+ </concept></li>
152
+ <li><concept term='term'>
153
+ <xref target='clause1'>w[o]rd</xref>
154
+ </concept></li>
155
+ <li><concept term='term'>
156
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712"/>
157
+ </concept></li>
158
+ <li><concept term='term'>
159
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">word</eref>
160
+ </concept></li>
161
+ <li><concept>
162
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
163
+ <locality type='clause'>
164
+ <referenceFrom>3.1</referenceFrom>
165
+ </locality>
166
+ <locality type='figure'>
167
+ <referenceFrom>a</referenceFrom>
168
+ </locality>
169
+ </eref>
170
+ </concept></li>
171
+ <li><concept>
172
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
173
+ <localityStack>
174
+ <locality type='clause'>
175
+ <referenceFrom>3.1</referenceFrom>
176
+ </locality>
177
+ </localityStack>
178
+ <localityStack>
179
+ <locality type='figure'>
180
+ <referenceFrom>b</referenceFrom>
181
+ </locality>
182
+ </localityStack>
183
+ </eref>
184
+ </concept></li>
185
+ <li><concept>
186
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
187
+ <localityStack>
188
+ <locality type='clause'>
189
+ <referenceFrom>3.1</referenceFrom>
190
+ </locality>
191
+ </localityStack>
192
+ <localityStack>
193
+ <locality type='figure'>
194
+ <referenceFrom>b</referenceFrom>
195
+ </locality>
196
+ </localityStack>
197
+ <em>word</em>
198
+ </eref>
199
+ </concept></li>
200
+ <li><concept term='term'>
201
+ <termref base='IEV' target='135-13-13'/>
202
+ </concept></li>
203
+ <li><concept term='term'>
204
+ <termref base='IEV' target='135-13-13'><em>word</em> word</termref>
205
+ </concept></li>
206
+ </ul>
207
+ </p>
208
+ </foreword></preface>
209
+ <sections>
210
+ <clause id="clause1"><title>Clause 1</title></clause>
211
+ </sections>
212
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
213
+ <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
214
+ <bibitem id="ISO712" type="standard">
215
+ <title format="text/plain">Cereals or cereal products</title>
216
+ <title type="main" format="text/plain">Cereals and cereal products</title>
217
+ <docidentifier type="ISO">ISO 712</docidentifier>
218
+ <contributor>
219
+ <role type="publisher"/>
220
+ <organization>
221
+ <name>International Organization for Standardization</name>
222
+ </organization>
223
+ </contributor>
224
+ </bibitem>
225
+ </references></bibliography>
226
+ </iso-standard>
228
227
  INPUT
229
228
  presxml = <<~OUTPUT
230
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
231
- <preface>
232
- <foreword>
233
- <p>
234
- <ul>
235
- <li>
236
- <em>
237
- <xref target='clause1'>Clause 2</xref>
238
- </em>
239
- </li>
240
- <li>
241
- <em>
242
- <xref target='clause1'>w[o]rd</xref>
243
- </em>
244
- </li>
245
- <li>
246
- <em>
247
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>ISO 712</eref>
248
- </em>
249
- </li>
250
- <li>
251
- <em>
252
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>word</eref>
253
- </em>
254
- </li>
255
- <li>
256
- <em>
257
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
258
- <locality type='clause'>
259
- <referenceFrom>3.1</referenceFrom>
260
- </locality>
261
- <locality type='figure'>
262
- <referenceFrom>a</referenceFrom>
263
- </locality>
264
- ISO 712, Clause 3.1, Figure a
265
- </eref>
266
- </em>
267
- </li>
268
- <li>
269
- <em>
270
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
271
- <localityStack>
272
- <locality type='clause'>
273
- <referenceFrom>3.1</referenceFrom>
274
- </locality>
275
- </localityStack>
276
- <localityStack>
277
- <locality type='figure'>
278
- <referenceFrom>b</referenceFrom>
279
- </locality>
280
- </localityStack>
281
- ISO 712, Clause 3.1; Figure b
282
- </eref>
283
- </em>
284
- </li>
285
- <li>
286
- <em>
287
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
288
- <localityStack>
289
- <locality type='clause'>
290
- <referenceFrom>3.1</referenceFrom>
291
- </locality>
292
- </localityStack>
293
- <localityStack>
294
- <locality type='figure'>
295
- <referenceFrom>b</referenceFrom>
296
- </locality>
297
- </localityStack>
298
- <em>word</em>
299
- </eref>
300
- </em>
301
- </li>
302
- <li>
303
- [term defined in
304
- <termref base='IEV' target='135-13-13'/>
305
- ]
306
- </li>
307
- <li>
308
- <em>
309
- <termref base='IEV' target='135-13-13'>
310
- <em>word</em>
311
- word
312
- </termref>
313
- </em>
314
- </li>
315
- </ul>
316
- </p>
317
- </foreword>
318
- </preface>
319
- <sections>
320
- <clause id='clause1'>
321
- <title depth='1'>
322
- 2.
323
- <tab/>
324
- Clause 1
325
- </title>
326
- </clause>
327
- </sections>
328
- <bibliography>
329
- <references id='_normative_references' obligation='informative' normative='true'>
330
- <title depth='1'>
331
- 1.
332
- <tab/>
333
- Normative References
334
- </title>
335
- <p>
336
- The following documents are referred to in the text in such a way that
337
- some or all of their content constitutes requirements of this document.
338
- For dated references, only the edition cited applies. For undated
339
- references, the latest edition of the referenced document (including any
340
- amendments) applies.
341
- </p>
342
- <bibitem id='ISO712' type='standard'>
343
- <title format='text/plain'>Cereals or cereal products</title>
344
- <title type='main' format='text/plain'>Cereals and cereal products</title>
345
- <docidentifier type='ISO'>ISO 712</docidentifier>
346
- <contributor>
347
- <role type='publisher'/>
348
- <organization>
349
- <name>International Organization for Standardization</name>
350
- </organization>
351
- </contributor>
352
- </bibitem>
353
- </references>
354
- </bibliography>
355
- </iso-standard>
356
- end
357
-
358
- it "processes embedded inline formatting" do
359
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
360
- <iso-standard xmlns="http://riboseinc.com/isoxml">
361
- <preface><foreword>
362
- <p>
363
- <em><strong>&lt;</strong></em> <tt><link target="B"/></tt> <xref target="_http_1_1">Requirement <tt>/req/core/http</tt></xref> <eref type="inline" bibitemid="ISO712" citeas="ISO 712">Requirement <tt>/req/core/http</tt></eref>
364
- </p>
365
- </foreword></preface>
366
- <sections>
367
- </iso-standard>
368
- INPUT
369
- #{HTML_HDR}
370
- <br/>
371
- <div>
372
- <h1 class="ForewordTitle">Foreword</h1>
229
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
230
+ <preface>
231
+ <foreword>
373
232
  <p>
374
- <i><b>&lt;</b></i> <tt><a href="B">B</a></tt> <a href="#_http_1_1">Requirement <tt>/req/core/http</tt></a> <a href="#ISO712">Requirement <tt>/req/core/http</tt></a>
375
- </p>
376
- </div>
377
- <p class="zzSTDTitle1"/>
378
- </div>
379
- </body>
380
- </html>
233
+ <ul>
234
+ <li>
235
+ <em>
236
+ <xref target='clause1'>Clause 2</xref>
237
+ </em>
238
+ </li>
239
+ <li>
240
+ <em>
241
+ <xref target='clause1'>w[o]rd</xref>
242
+ </em>
243
+ </li>
244
+ <li>
245
+ <em>
246
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>ISO 712</eref>
247
+ </em>
248
+ </li>
249
+ <li>
250
+ <em>
251
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>word</eref>
252
+ </em>
253
+ </li>
254
+ <li>
255
+ <em>
256
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
257
+ <locality type='clause'>
258
+ <referenceFrom>3.1</referenceFrom>
259
+ </locality>
260
+ <locality type='figure'>
261
+ <referenceFrom>a</referenceFrom>
262
+ </locality>
263
+ ISO 712, Clause 3.1, Figure a
264
+ </eref>
265
+ </em>
266
+ </li>
267
+ <li>
268
+ <em>
269
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
270
+ <localityStack>
271
+ <locality type='clause'>
272
+ <referenceFrom>3.1</referenceFrom>
273
+ </locality>
274
+ </localityStack>
275
+ <localityStack>
276
+ <locality type='figure'>
277
+ <referenceFrom>b</referenceFrom>
278
+ </locality>
279
+ </localityStack>
280
+ ISO 712, Clause 3.1; Figure b
281
+ </eref>
282
+ </em>
283
+ </li>
284
+ <li>
285
+ <em>
286
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
287
+ <localityStack>
288
+ <locality type='clause'>
289
+ <referenceFrom>3.1</referenceFrom>
290
+ </locality>
291
+ </localityStack>
292
+ <localityStack>
293
+ <locality type='figure'>
294
+ <referenceFrom>b</referenceFrom>
295
+ </locality>
296
+ </localityStack>
297
+ <em>word</em>
298
+ </eref>
299
+ </em>
300
+ </li>
301
+ <li>
302
+ [term defined in
303
+ <termref base='IEV' target='135-13-13'/>
304
+ ]
305
+ </li>
306
+ <li>
307
+ <em>
308
+ <termref base='IEV' target='135-13-13'>
309
+ <em>word</em>
310
+ word
311
+ </termref>
312
+ </em>
313
+ </li>
314
+ </ul>
315
+ </p>
316
+ </foreword>
317
+ </preface>
318
+ <sections>
319
+ <clause id='clause1'>
320
+ <title depth='1'>
321
+ 2.
322
+ <tab/>
323
+ Clause 1
324
+ </title>
325
+ </clause>
326
+ </sections>
327
+ <bibliography>
328
+ <references id='_normative_references' obligation='informative' normative='true'>
329
+ <title depth='1'>
330
+ 1.
331
+ <tab/>
332
+ Normative References
333
+ </title>
334
+ <p>
335
+ The following documents are referred to in the text in such a way that
336
+ some or all of their content constitutes requirements of this document.
337
+ For dated references, only the edition cited applies. For undated
338
+ references, the latest edition of the referenced document (including any
339
+ amendments) applies.
340
+ </p>
341
+ <bibitem id='ISO712' type='standard'>
342
+ <title format='text/plain'>Cereals or cereal products</title>
343
+ <title type='main' format='text/plain'>Cereals and cereal products</title>
344
+ <docidentifier type='ISO'>ISO 712</docidentifier>
345
+ <contributor>
346
+ <role type='publisher'/>
347
+ <organization>
348
+ <name>International Organization for Standardization</name>
349
+ </organization>
350
+ </contributor>
351
+ </bibitem>
352
+ </references>
353
+ </bibliography>
354
+ </iso-standard>
355
+ end
356
+
357
+ it "processes embedded inline formatting" do
358
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
359
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
360
+ <preface><foreword>
361
+ <p>
362
+ <em><strong>&lt;</strong></em> <tt><link target="B"/></tt> <xref target="_http_1_1">Requirement <tt>/req/core/http</tt></xref> <eref type="inline" bibitemid="ISO712" citeas="ISO 712">Requirement <tt>/req/core/http</tt></eref>
363
+ </p>
364
+ </foreword></preface>
365
+ <sections>
366
+ </iso-standard>
367
+ INPUT
368
+ #{HTML_HDR}
369
+ <br/>
370
+ <div>
371
+ <h1 class="ForewordTitle">Foreword</h1>
372
+ <p>
373
+ <i><b>&lt;</b></i> <tt><a href="B">B</a></tt> <a href="#_http_1_1">Requirement <tt>/req/core/http</tt></a> <a href="#ISO712">Requirement <tt>/req/core/http</tt></a>
374
+ </p>
375
+ </div>
376
+ <p class="zzSTDTitle1"/>
377
+ </div>
378
+ </body>
379
+ </html>
381
380
  OUTPUT
382
381
  end
383
382
 
384
383
  it "processes inline images" do
385
384
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
386
- <iso-standard xmlns="http://riboseinc.com/isoxml">
387
- <preface><foreword>
388
- <p>
389
- <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
390
- </p>
391
- </foreword></preface>
392
- </iso-standard>
393
- INPUT
394
- #{HTML_HDR}
395
- <br/>
396
- <div>
397
- <h1 class='ForewordTitle'>Foreword</h1>
385
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
386
+ <preface><foreword>
398
387
  <p>
399
- <img src='rice_images/rice_image1.png' height='20' width='30' title='titletxt' alt='alttext'/>
400
- </p>
401
- </div>
402
- <p class='zzSTDTitle1'/>
403
- </div>
404
- </body>
405
- </html>
406
- OUTPUT
388
+ <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
389
+ </p>
390
+ </foreword></preface>
391
+ </iso-standard>
392
+ INPUT
393
+ #{HTML_HDR}
394
+ <br/>
395
+ <div>
396
+ <h1 class='ForewordTitle'>Foreword</h1>
397
+ <p>
398
+ <img src='rice_images/rice_image1.png' height='20' width='30' title='titletxt' alt='alttext'/>
399
+ </p>
400
+ </div>
401
+ <p class='zzSTDTitle1'/>
402
+ </div>
403
+ </body>
404
+ </html>
405
+ OUTPUT
407
406
  end
408
407
 
409
408
  it "processes links" do
410
409
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
411
- <iso-standard xmlns="http://riboseinc.com/isoxml">
412
- <preface><foreword>
413
- <p>
414
- <link target="http://example.com"/>
415
- <link target="http://example.com">example</link>
416
- <link target="http://example.com" alt="tip">example</link>
417
- <link target="mailto:fred@example.com"/>
418
- <link target="mailto:fred@example.com">mailto:fred@example.com</link>
419
- </p>
420
- </foreword></preface>
421
- <sections>
422
- </iso-standard>
410
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
411
+ <preface><foreword>
412
+ <p>
413
+ <link target="http://example.com"/>
414
+ <link target="http://example.com">example</link>
415
+ <link target="http://example.com" alt="tip">example</link>
416
+ <link target="mailto:fred@example.com"/>
417
+ <link target="mailto:fred@example.com">mailto:fred@example.com</link>
418
+ </p>
419
+ </foreword></preface>
420
+ <sections>
421
+ </iso-standard>
423
422
  INPUT
424
- #{HTML_HDR}
425
- <br/>
426
- <div>
427
- <h1 class="ForewordTitle">Foreword</h1>
428
- <p>
429
- <a href="http://example.com">http://example.com</a>
430
- <a href="http://example.com">example</a>
431
- <a href="http://example.com" title="tip">example</a>
432
- <a href="mailto:fred@example.com">fred@example.com</a>
433
- <a href="mailto:fred@example.com">mailto:fred@example.com</a>
434
- </p>
423
+ #{HTML_HDR}
424
+ <br/>
425
+ <div>
426
+ <h1 class="ForewordTitle">Foreword</h1>
427
+ <p>
428
+ <a href="http://example.com">http://example.com</a>
429
+ <a href="http://example.com">example</a>
430
+ <a href="http://example.com" title="tip">example</a>
431
+ <a href="mailto:fred@example.com">fred@example.com</a>
432
+ <a href="mailto:fred@example.com">mailto:fred@example.com</a>
433
+ </p>
434
+ </div>
435
+ <p class="zzSTDTitle1"/>
435
436
  </div>
436
- <p class="zzSTDTitle1"/>
437
- </div>
438
- </body>
439
- </html>
437
+ </body>
438
+ </html>
440
439
  OUTPUT
441
440
  end
442
441
 
443
442
  it "processes unrecognised markup" do
444
443
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
445
- <iso-standard xmlns="http://riboseinc.com/isoxml">
446
- <preface><foreword>
447
- <p>
448
- <barry fred="http://example.com">example</barry>
449
- </p>
450
- </foreword></preface>
451
- <sections>
452
- </iso-standard>
444
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
445
+ <preface><foreword>
446
+ <p>
447
+ <barry fred="http://example.com">example</barry>
448
+ </p>
449
+ </foreword></preface>
450
+ <sections>
451
+ </iso-standard>
453
452
  INPUT
454
- #{HTML_HDR}
455
- <br/>
456
- <div>
457
- <h1 class="ForewordTitle">Foreword</h1>
458
- <p>
459
- <para><b role="strong">&lt;barry fred="http://example.com"&gt;example&lt;/barry&gt;</b></para>
460
- </p>
453
+ #{HTML_HDR}
454
+ <br/>
455
+ <div>
456
+ <h1 class="ForewordTitle">Foreword</h1>
457
+ <p>
458
+ <para><b role="strong">&lt;barry fred="http://example.com"&gt;example&lt;/barry&gt;</b></para>
459
+ </p>
460
+ </div>
461
+ <p class="zzSTDTitle1"/>
461
462
  </div>
462
- <p class="zzSTDTitle1"/>
463
- </div>
464
- </body>
465
- </html>
463
+ </body>
464
+ </html>
466
465
  OUTPUT
467
466
  end
468
467
 
469
468
  it "processes AsciiMath and MathML" do
470
469
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true).sub(/<html/, "<html xmlns:m='m'"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
471
- <iso-standard xmlns="http://riboseinc.com/isoxml">
472
- <preface><foreword>
473
- <p>
474
- <stem type="AsciiMath">&lt;A&gt;</stem>
475
- <stem type="MathML"><m:math><m:row>X</m:row></m:math></stem>
476
- <stem type="None">Latex?</stem>
477
- </p>
478
- </foreword></preface>
479
- <sections>
480
- </iso-standard>
470
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
471
+ <preface><foreword>
472
+ <p>
473
+ <stem type="AsciiMath">&lt;A&gt;</stem>
474
+ <stem type="MathML"><m:math><m:row>X</m:row></m:math></stem>
475
+ <stem type="None">Latex?</stem>
476
+ </p>
477
+ </foreword></preface>
478
+ <sections>
479
+ </iso-standard>
481
480
  INPUT
482
- #{HTML_HDR.sub(/<html/, "<html xmlns:m='m'")}
483
- <br/>
484
- <div>
485
- <h1 class="ForewordTitle">Foreword</h1>
486
- <p>
487
- <span class="stem">(#(&lt;A&gt;)#)</span>
488
- <span class="stem"><m:math>
489
- <m:row>X</m:row>
490
- </m:math></span>
491
- <span class="stem">Latex?</span>
492
- </p>
481
+ #{HTML_HDR.sub(/<html/, "<html xmlns:m='m'")}
482
+ <br/>
483
+ <div>
484
+ <h1 class="ForewordTitle">Foreword</h1>
485
+ <p>
486
+ <span class="stem">(#(&lt;A&gt;)#)</span>
487
+ <span class="stem"><m:math>
488
+ <m:row>X</m:row>
489
+ </m:math></span>
490
+ <span class="stem">Latex?</span>
491
+ </p>
492
+ </div>
493
+ <p class="zzSTDTitle1"/>
493
494
  </div>
494
- <p class="zzSTDTitle1"/>
495
- </div>
496
- </body>
497
- </html>
495
+ </body>
496
+ </html>
498
497
  OUTPUT
499
498
  end
500
499
 
501
500
  it "overrides AsciiMath delimiters" do
502
501
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
503
- <iso-standard xmlns="http://riboseinc.com/isoxml">
504
- <preface><foreword>
505
- <p>
506
- <stem type="AsciiMath">A</stem>
507
- (#((Hello))#)
508
- </p>
509
- </foreword></preface>
510
- <sections>
511
- </iso-standard>
502
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
503
+ <preface><foreword>
504
+ <p>
505
+ <stem type="AsciiMath">A</stem>
506
+ (#((Hello))#)
507
+ </p>
508
+ </foreword></preface>
509
+ <sections>
510
+ </iso-standard>
512
511
  INPUT
513
- #{HTML_HDR}
514
- <br/>
515
- <div>
516
- <h1 class="ForewordTitle">Foreword</h1>
517
- <p>
518
- <span class="stem">(#(((A)#)))</span>
519
- (#((Hello))#)
520
- </p>
512
+ #{HTML_HDR}
513
+ <br/>
514
+ <div>
515
+ <h1 class="ForewordTitle">Foreword</h1>
516
+ <p>
517
+ <span class="stem">(#(((A)#)))</span>
518
+ (#((Hello))#)
519
+ </p>
520
+ </div>
521
+ <p class="zzSTDTitle1"/>
521
522
  </div>
522
- <p class="zzSTDTitle1"/>
523
- </div>
524
- </body>
525
- </html>
523
+ </body>
524
+ </html>
526
525
  OUTPUT
527
526
  end
528
527
 
529
528
  it "processes eref types" do
530
529
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
531
- <iso-standard xmlns="http://riboseinc.com/isoxml">
532
- <preface><foreword>
533
- <p>
534
- <eref type="footnote" bibitemid="ISO712" citeas="ISO 712">A</stem>
535
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</stem>
536
- </p>
537
- </foreword></preface>
538
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
539
- <bibitem id="ISO712" type="standard">
540
- <title format="text/plain">Cereals and cereal products</title>
541
- <docidentifier>ISO 712</docidentifier>
542
- <contributor>
543
- <role type="publisher"/>
544
- <organization>
545
- <abbreviation>ISO</abbreviation>
546
- </organization>
547
- </contributor>
548
- </bibitem>
549
- </references>
550
- </bibliography>
551
- </iso-standard>
530
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
531
+ <preface><foreword>
532
+ <p>
533
+ <eref type="footnote" bibitemid="ISO712" citeas="ISO 712">A</stem>
534
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</stem>
535
+ </p>
536
+ </foreword></preface>
537
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
538
+ <bibitem id="ISO712" type="standard">
539
+ <title format="text/plain">Cereals and cereal products</title>
540
+ <docidentifier>ISO 712</docidentifier>
541
+ <contributor>
542
+ <role type="publisher"/>
543
+ <organization>
544
+ <abbreviation>ISO</abbreviation>
545
+ </organization>
546
+ </contributor>
547
+ </bibitem>
548
+ </references>
549
+ </bibliography>
550
+ </iso-standard>
552
551
  INPUT
553
- #{HTML_HDR}
554
- <br/>
555
- <div>
556
- <h1 class="ForewordTitle">Foreword</h1>
557
- <p>
558
- <sup><a href="#ISO712">A</a></sup>
559
- <a href="#ISO712">A</a>
560
- </p>
561
- </div>
562
- <p class="zzSTDTitle1"/>
563
- <div>
564
- <h1>Normative References</h1>
565
- <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
552
+ #{HTML_HDR}
553
+ <br/>
554
+ <div>
555
+ <h1 class="ForewordTitle">Foreword</h1>
556
+ <p>
557
+ <sup><a href="#ISO712">A</a></sup>
558
+ <a href="#ISO712">A</a>
559
+ </p>
560
+ </div>
561
+ <p class="zzSTDTitle1"/>
562
+ <div>
563
+ <h1>Normative References</h1>
564
+ <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
565
+ </div>
566
566
  </div>
567
- </div>
568
- </body>
569
- </html>
567
+ </body>
568
+ </html>
570
569
  OUTPUT
571
570
  end
572
571
 
573
572
  it "processes eref content" do
574
573
  input = <<~INPUT
575
- <iso-standard xmlns="http://riboseinc.com/isoxml">
576
- <preface><foreword>
577
- <p>
578
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
579
- <eref type="inline" bibitemid="ISO712"/>
580
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
581
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
582
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
583
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
584
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
585
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
586
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
587
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
588
- <eref type="inline" bibitemid="ISO712"><locality type="whole"></locality></eref>
589
- <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
590
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
591
- <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality></eref>
592
- <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
593
- <eref type="inline" droploc="true" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
594
- <eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
595
- </p>
596
- </foreword></preface>
597
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
598
- <bibitem id="ISO712" type="standard">
599
- <title format="text/plain">Cereals and cereal products</title>
600
- <docidentifier>ISO 712</docidentifier>
601
- <contributor>
602
- <role type="publisher"/>
603
- <organization>
604
- <abbreviation>ISO</abbreviation>
605
- </organization>
606
- </contributor>
607
- </bibitem>
608
- </references>
609
- </bibliography>
610
- </iso-standard>
574
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
575
+ <preface><foreword>
576
+ <p>
577
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
578
+ <eref type="inline" bibitemid="ISO712"/>
579
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
580
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
581
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
582
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
583
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
584
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
585
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
586
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
587
+ <eref type="inline" bibitemid="ISO712"><locality type="whole"></locality></eref>
588
+ <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
589
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
590
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality></eref>
591
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
592
+ <eref type="inline" droploc="true" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
593
+ <eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
594
+ </p>
595
+ </foreword></preface>
596
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
597
+ <bibitem id="ISO712" type="standard">
598
+ <title format="text/plain">Cereals and cereal products</title>
599
+ <docidentifier>ISO 712</docidentifier>
600
+ <contributor>
601
+ <role type="publisher"/>
602
+ <organization>
603
+ <abbreviation>ISO</abbreviation>
604
+ </organization>
605
+ </contributor>
606
+ </bibitem>
607
+ </references>
608
+ </bibliography>
609
+ </iso-standard>
611
610
  INPUT
612
611
  presxml = <<~OUTPUT
613
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
614
- <preface><foreword>
615
- <p>
616
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
617
- <eref type="inline" bibitemid="ISO712">ISO 712</eref>
618
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Table 1</eref>
619
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
620
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1; Clause 1</eref>
621
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Table 1&#x2013;1</eref>
622
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1, Table 1</eref>
623
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
624
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality>ISO 712, Clause 1.5</eref>
625
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
626
- <eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
627
- <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
628
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
629
- <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
630
- <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
631
- <eref type="inline" droploc="true" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, 1</eref>
632
- <eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, clause 1</eref>
633
- </p>
634
- </foreword></preface>
635
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title depth='1'>1.<tab/>Normative References</title>
636
- <bibitem id="ISO712" type="standard">
637
- <title format="text/plain">Cereals and cereal products</title>
638
- <docidentifier>ISO 712</docidentifier>
639
- <contributor>
640
- <role type="publisher"/>
641
- <organization>
642
- <abbreviation>ISO</abbreviation>
643
- </organization>
644
- </contributor>
645
- </bibitem>
646
- </references>
647
- </bibliography>
648
- </iso-standard>
649
- OUTPUT
612
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
613
+ <preface><foreword>
614
+ <p>
615
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
616
+ <eref type="inline" bibitemid="ISO712">ISO 712</eref>
617
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Table 1</eref>
618
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
619
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1; Clause 1</eref>
620
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Table 1&#x2013;1</eref>
621
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1, Table 1</eref>
622
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
623
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality>ISO 712, Clause 1.5</eref>
624
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
625
+ <eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
626
+ <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
627
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
628
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
629
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
630
+ <eref type="inline" droploc="true" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, 1</eref>
631
+ <eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, clause 1</eref>
632
+ </p>
633
+ </foreword></preface>
634
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title depth='1'>1.<tab/>Normative References</title>
635
+ <bibitem id="ISO712" type="standard">
636
+ <title format="text/plain">Cereals and cereal products</title>
637
+ <docidentifier>ISO 712</docidentifier>
638
+ <contributor>
639
+ <role type="publisher"/>
640
+ <organization>
641
+ <abbreviation>ISO</abbreviation>
642
+ </organization>
643
+ </contributor>
644
+ </bibitem>
645
+ </references>
646
+ </bibliography>
647
+ </iso-standard>
648
+ OUTPUT
650
649
 
651
- html = <<~OUTPUT
652
- #{HTML_HDR}
653
- <br/>
654
- <div>
655
- <h1 class="ForewordTitle">Foreword</h1>
656
- <p>
657
- <a href="#ISO712">ISO 712</a>
658
- <a href="#ISO712">ISO 712</a>
659
- <a href="#ISO712">ISO 712, Table 1</a>
660
- <a href='#ISO712'>ISO 712, Table 1</a>
661
- <a href='#ISO712'>ISO 712, Table 1; Clause 1</a>
662
- <a href="#ISO712">ISO 712, Table 1&#8211;1</a>
663
- <a href="#ISO712">ISO 712, Clause 1, Table 1</a>
664
- <a href="#ISO712">ISO 712, Clause 1</a>
665
- <a href="#ISO712">ISO 712, Clause 1.5</a>
666
- <a href="#ISO712">A</a>
667
- <a href="#ISO712">ISO 712, Whole of text</a>
668
- <a href="#ISO712">ISO 712, Prelude 7</a>
669
- <a href="#ISO712">A</a>
670
- <a href='#ISO712'>ISO 712</a>
671
- <a href='#ISO712'>ISO 712, Clause 1</a>
672
- <a href='#ISO712'>ISO 712, 1</a>
673
- <a href='#ISO712'>ISO 712, clause 1</a>
674
- </p>
675
- </div>
676
- <p class="zzSTDTitle1"/>
677
- <div>
678
- <h1>1.&#160; Normative References</h1>
679
- <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
680
- </div>
681
- </div>
682
- </body>
683
- </html>
650
+ html = <<~OUTPUT
651
+ #{HTML_HDR}
652
+ <br/>
653
+ <div>
654
+ <h1 class="ForewordTitle">Foreword</h1>
655
+ <p>
656
+ <a href="#ISO712">ISO 712</a>
657
+ <a href="#ISO712">ISO 712</a>
658
+ <a href="#ISO712">ISO 712, Table 1</a>
659
+ <a href='#ISO712'>ISO 712, Table 1</a>
660
+ <a href='#ISO712'>ISO 712, Table 1; Clause 1</a>
661
+ <a href="#ISO712">ISO 712, Table 1&#8211;1</a>
662
+ <a href="#ISO712">ISO 712, Clause 1, Table 1</a>
663
+ <a href="#ISO712">ISO 712, Clause 1</a>
664
+ <a href="#ISO712">ISO 712, Clause 1.5</a>
665
+ <a href="#ISO712">A</a>
666
+ <a href="#ISO712">ISO 712, Whole of text</a>
667
+ <a href="#ISO712">ISO 712, Prelude 7</a>
668
+ <a href="#ISO712">A</a>
669
+ <a href='#ISO712'>ISO 712</a>
670
+ <a href='#ISO712'>ISO 712, Clause 1</a>
671
+ <a href='#ISO712'>ISO 712, 1</a>
672
+ <a href='#ISO712'>ISO 712, clause 1</a>
673
+ </p>
674
+ </div>
675
+ <p class="zzSTDTitle1"/>
676
+ <div>
677
+ <h1>1.&#160; Normative References</h1>
678
+ <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
679
+ </div>
680
+ </div>
681
+ </body>
682
+ </html>
684
683
  OUTPUT
685
684
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
686
685
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
687
686
  end
688
687
 
689
- it "processes eref content pointing to reference with citation URL" do
690
- input = <<~INPUT
691
- <iso-standard xmlns="http://riboseinc.com/isoxml">
692
- <preface><foreword>
693
- <p>
694
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
695
- <eref type="inline" bibitemid="ISO712"/>
696
- <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
697
- <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
698
- <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
699
- <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
700
- <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
701
- <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
702
- <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
703
- <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
704
- <eref type="inline" bibitemid="ISO713"><locality type="whole"></locality></eref>
705
- <eref type="inline" bibitemid="ISO713"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
706
- <eref type="inline" bibitemid="ISO713" citeas="ISO 713">A</eref>
707
- <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality></eref>
708
- <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
709
- </p>
710
- </foreword></preface>
711
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
712
- <bibitem id="ISO712" type="standard">
713
- <title format="text/plain">Cereals and cereal products</title>
714
- <uri type="citation">http://www.example.com</uri>
715
- <docidentifier>ISO 712</docidentifier>
716
- <contributor>
717
- <role type="publisher"/>
718
- <organization>
719
- <abbreviation>ISO</abbreviation>
720
- </organization>
721
- </contributor>
722
- </bibitem>
723
- <bibitem id="ISO713" type="standard">
724
- <title format="text/plain">Cereals and cereal products</title>
725
- <uri type="citation">spec/assets/iso713</uri>
726
- <docidentifier>ISO 713</docidentifier>
727
- <contributor>
728
- <role type="publisher"/>
729
- <organization>
730
- <abbreviation>ISO</abbreviation>
731
- </organization>
732
- </contributor>
733
- </bibitem>
734
- </references>
735
- </bibliography>
736
- </iso-standard>
688
+ it "processes eref content pointing to reference with citation URL" do
689
+ input = <<~INPUT
690
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
691
+ <preface><foreword>
692
+ <p>
693
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
694
+ <eref type="inline" bibitemid="ISO712"/>
695
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
696
+ <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
697
+ <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
698
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
699
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
700
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
701
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
702
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
703
+ <eref type="inline" bibitemid="ISO713"><locality type="whole"></locality></eref>
704
+ <eref type="inline" bibitemid="ISO713"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
705
+ <eref type="inline" bibitemid="ISO713" citeas="ISO 713">A</eref>
706
+ <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality></eref>
707
+ <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
708
+ <eref type="inline" bibitemid="ISO714"/>
709
+ </p>
710
+ </foreword></preface>
711
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
712
+ <bibitem id="ISO712" type="standard">
713
+ <title format="text/plain">Cereals and cereal products</title>
714
+ <uri type="citation">http://www.example.com</uri>
715
+ <docidentifier>ISO 712</docidentifier>
716
+ <contributor>
717
+ <role type="publisher"/>
718
+ <organization>
719
+ <abbreviation>ISO</abbreviation>
720
+ </organization>
721
+ </contributor>
722
+ </bibitem>
723
+ <bibitem id="ISO713" type="standard">
724
+ <title format="text/plain">Cereals and cereal products</title>
725
+ <uri type="citation">spec/assets/iso713</uri>
726
+ <docidentifier>ISO 713</docidentifier>
727
+ <contributor>
728
+ <role type="publisher"/>
729
+ <organization>
730
+ <abbreviation>ISO</abbreviation>
731
+ </organization>
732
+ </contributor>
733
+ </bibitem>
734
+ <bibitem id="ISO714" type="standard">
735
+ <title format="text/plain">Cereals and cereal products</title>
736
+ <uri type="citation">spec/assets/iso714.svg</uri>
737
+ <docidentifier>ISO 714</docidentifier>
738
+ <contributor>
739
+ <role type="publisher"/>
740
+ <organization>
741
+ <abbreviation>ISO</abbreviation>
742
+ </organization>
743
+ </contributor>
744
+ </bibitem>
745
+ </references>
746
+ </bibliography>
747
+ </iso-standard>
737
748
  INPUT
738
749
  presxml = <<~OUTPUT
739
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
740
- <preface>
741
- <foreword>
742
- <p>
743
- <eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
744
- <eref type='inline' bibitemid='ISO712'>ISO 712</eref>
745
- <eref type='inline' bibitemid='ISO713'><locality type='table'>
746
- <referenceFrom>1</referenceFrom>
747
- </locality>ISO 713, Table 1</eref>
748
- <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1</eref>
749
- <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type='clause'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1; Clause 1</eref>
750
- <eref type='inline' bibitemid='ISO713'><locality type='table'>
751
- <referenceFrom>1</referenceFrom>
752
- <referenceTo>1</referenceTo>
753
- </locality>ISO 713, Table 1&#x2013;1</eref>
754
- <eref type='inline' bibitemid='ISO713'><locality type='clause'><referenceFrom>1</referenceFrom></locality><locality type='table'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1, Table 1</eref>
755
- <eref type='inline' bibitemid='ISO713'><locality type='clause'>
756
- <referenceFrom>1</referenceFrom>
757
- </locality>ISO 713, Clause 1</eref>
758
- <eref type='inline' bibitemid='ISO713'><locality type='clause'>
759
- <referenceFrom>1.5</referenceFrom>
760
- </locality>ISO 713, Clause 1.5</eref>
761
- <eref type='inline' bibitemid='ISO713'><locality type='table'>
762
- <referenceFrom>1</referenceFrom>
763
- </locality>A</eref>
764
- <eref type='inline' bibitemid='ISO713'><locality type='whole'/>ISO 713, Whole of text</eref>
765
- <eref type='inline' bibitemid='ISO713'><locality type='locality:prelude'>
766
- <referenceFrom>7</referenceFrom>
767
- </locality>ISO 713, Prelude 7</eref>
768
- <eref type='inline' bibitemid='ISO713' citeas='ISO 713'>A</eref>
769
- <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality>ISO 713</eref>
770
- <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality><locality type='clause'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1</eref>
771
- </p>
772
- </foreword>
773
- </preface>
774
- <bibliography>
775
- <references id='_normative_references' obligation='informative' normative='true'>
776
- <title depth='1'>1.<tab/>Normative References</title>
777
- <bibitem id='ISO712' type='standard'>
750
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
751
+ <preface>
752
+ <foreword>
753
+ <p>
754
+ <eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
755
+ <eref type='inline' bibitemid='ISO712'>ISO 712</eref>
756
+ <eref type='inline' bibitemid='ISO713'><locality type='table'>
757
+ <referenceFrom>1</referenceFrom>
758
+ </locality>ISO 713, Table 1</eref>
759
+ <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1</eref>
760
+ <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type='clause'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1; Clause 1</eref>
761
+ <eref type='inline' bibitemid='ISO713'><locality type='table'>
762
+ <referenceFrom>1</referenceFrom>
763
+ <referenceTo>1</referenceTo>
764
+ </locality>ISO 713, Table 1&#x2013;1</eref>
765
+ <eref type='inline' bibitemid='ISO713'><locality type='clause'><referenceFrom>1</referenceFrom></locality><locality type='table'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1, Table 1</eref>
766
+ <eref type='inline' bibitemid='ISO713'><locality type='clause'>
767
+ <referenceFrom>1</referenceFrom>
768
+ </locality>ISO 713, Clause 1</eref>
769
+ <eref type='inline' bibitemid='ISO713'><locality type='clause'>
770
+ <referenceFrom>1.5</referenceFrom>
771
+ </locality>ISO 713, Clause 1.5</eref>
772
+ <eref type='inline' bibitemid='ISO713'><locality type='table'>
773
+ <referenceFrom>1</referenceFrom>
774
+ </locality>A</eref>
775
+ <eref type='inline' bibitemid='ISO713'><locality type='whole'/>ISO 713, Whole of text</eref>
776
+ <eref type='inline' bibitemid='ISO713'><locality type='locality:prelude'>
777
+ <referenceFrom>7</referenceFrom>
778
+ </locality>ISO 713, Prelude 7</eref>
779
+ <eref type='inline' bibitemid='ISO713' citeas='ISO 713'>A</eref>
780
+ <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality>ISO 713</eref>
781
+ <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality><locality type='clause'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1</eref>
782
+ <eref type='inline' bibitemid='ISO714'>ISO 714</eref>
783
+ </p>
784
+ </foreword>
785
+ </preface>
786
+ <bibliography>
787
+ <references id='_normative_references' obligation='informative' normative='true'>
788
+ <title depth='1'>1.<tab/>Normative References</title>
789
+ <bibitem id='ISO712' type='standard'>
790
+ <title format='text/plain'>Cereals and cereal products</title>
791
+ <uri type='citation'>http://www.example.com</uri>
792
+ <docidentifier>ISO 712</docidentifier>
793
+ <contributor>
794
+ <role type='publisher'/>
795
+ <organization>
796
+ <abbreviation>ISO</abbreviation>
797
+ </organization>
798
+ </contributor>
799
+ </bibitem>
800
+ <bibitem id='ISO713' type='standard'>
801
+ <title format='text/plain'>Cereals and cereal products</title>
802
+ <uri type='citation'>spec/assets/iso713</uri>
803
+ <docidentifier>ISO 713</docidentifier>
804
+ <contributor>
805
+ <role type='publisher'/>
806
+ <organization>
807
+ <abbreviation>ISO</abbreviation>
808
+ </organization>
809
+ </contributor>
810
+ </bibitem>
811
+ <bibitem id='ISO714' type='standard'>
778
812
  <title format='text/plain'>Cereals and cereal products</title>
779
- <uri type='citation'>http://www.example.com</uri>
780
- <docidentifier>ISO 712</docidentifier>
813
+ <uri type='citation'>spec/assets/iso714.svg</uri>
814
+ <docidentifier>ISO 714</docidentifier>
781
815
  <contributor>
782
816
  <role type='publisher'/>
783
817
  <organization>
@@ -785,243 +819,241 @@ html = <<~OUTPUT
785
819
  </organization>
786
820
  </contributor>
787
821
  </bibitem>
788
- <bibitem id='ISO713' type='standard'>
789
- <title format='text/plain'>Cereals and cereal products</title>
790
- <uri type='citation'>spec/assets/iso713</uri>
791
- <docidentifier>ISO 713</docidentifier>
792
- <contributor>
793
- <role type='publisher'/>
794
- <organization>
795
- <abbreviation>ISO</abbreviation>
796
- </organization>
797
- </contributor>
798
- </bibitem>
799
- </references>
800
- </bibliography>
801
- </iso-standard>
802
- OUTPUT
822
+ </references>
823
+ </bibliography>
824
+ </iso-standard>
825
+ OUTPUT
803
826
 
804
827
  html = <<~OUTPUT
805
- #{HTML_HDR}
806
- <br/>
807
- <div>
808
- <h1 class='ForewordTitle'>Foreword</h1>
809
- <p>
810
- <a href='http://www.example.com'>ISO 712</a>
811
- <a href='http://www.example.com'>ISO 712</a>
812
- <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
813
- <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
814
- <a href='spec/assets/iso713.html'>ISO 713, Table 1; Clause 1</a>
815
- <a href='spec/assets/iso713.html'>ISO 713, Table 1&#8211;1</a>
816
- <a href='spec/assets/iso713.html'>ISO 713, Clause 1, Table 1</a>
817
- <a href='spec/assets/iso713.html'>ISO 713, Clause 1</a>
818
- <a href='spec/assets/iso713.html'>ISO 713, Clause 1.5</a>
819
- <a href='spec/assets/iso713.html'>A</a>
820
- <a href='spec/assets/iso713.html'>ISO 713, Whole of text</a>
821
- <a href='spec/assets/iso713.html'>ISO 713, Prelude 7</a>
822
- <a href='spec/assets/iso713.html'>A</a>
823
- <a href='spec/assets/iso713.html#xyz'>ISO 713</a>
824
- <a href='spec/assets/iso713.html#xyz'>ISO 713, Clause 1</a>
825
- </p>
826
- </div>
827
- <p class='zzSTDTitle1'/>
828
- <div>
829
- <h1>1.&#160; Normative References</h1>
830
- <p id='ISO712' class='NormRef'>
831
- ISO 712,
832
- <i>Cereals and cereal products</i>
833
- </p>
834
- <p id='ISO713' class='NormRef'>
835
- ISO 713,
836
- <i>Cereals and cereal products</i>
837
- </p>
838
- </div>
839
- </div>
840
- </body>
841
- </html>
842
- OUTPUT
843
-
844
- word = <<~OUTPUT
845
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
846
- <head>
847
- <style>
848
- </style>
849
- </head>
850
- <body lang='EN-US' link='blue' vlink='#954F72'>
851
- <div class='WordSection1'>
852
- <p>&#160;</p>
853
- </div>
854
- <p>
855
- <br clear='all' class='section'/>
856
- </p>
857
- <div class='WordSection2'>
858
- <p>
859
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
828
+ #{HTML_HDR}
829
+ <br/>
830
+ <div>
831
+ <h1 class='ForewordTitle'>Foreword</h1>
832
+ <p>
833
+ <a href='http://www.example.com'>ISO 712</a>
834
+ <a href='http://www.example.com'>ISO 712</a>
835
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
836
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
837
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1; Clause 1</a>
838
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1&#8211;1</a>
839
+ <a href='spec/assets/iso713.html'>ISO 713, Clause 1, Table 1</a>
840
+ <a href='spec/assets/iso713.html'>ISO 713, Clause 1</a>
841
+ <a href='spec/assets/iso713.html'>ISO 713, Clause 1.5</a>
842
+ <a href='spec/assets/iso713.html'>A</a>
843
+ <a href='spec/assets/iso713.html'>ISO 713, Whole of text</a>
844
+ <a href='spec/assets/iso713.html'>ISO 713, Prelude 7</a>
845
+ <a href='spec/assets/iso713.html'>A</a>
846
+ <a href='spec/assets/iso713.html#xyz'>ISO 713</a>
847
+ <a href='spec/assets/iso713.html#xyz'>ISO 713, Clause 1</a>
848
+ <a href='spec/assets/iso714.svg'>ISO 714</a>
849
+ </p>
850
+ </div>
851
+ <p class='zzSTDTitle1'/>
852
+ <div>
853
+ <h1>1.&#160; Normative References</h1>
854
+ <p id='ISO712' class='NormRef'>
855
+ ISO 712,
856
+ <i>Cereals and cereal products</i>
857
+ </p>
858
+ <p id='ISO713' class='NormRef'>
859
+ ISO 713,
860
+ <i>Cereals and cereal products</i>
860
861
  </p>
861
- <div>
862
- <h1 class='ForewordTitle'>Foreword</h1>
863
- <p>
864
- <a href='http://www.example.com'>ISO 712</a>
865
- <a href='http://www.example.com'>ISO 712</a>
866
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
867
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
868
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1; Clause 1</a>
869
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1&#8211;1</a>
870
- <a href='spec/assets/iso713.doc'>ISO 713, Clause 1, Table 1</a>
871
- <a href='spec/assets/iso713.doc'>ISO 713, Clause 1</a>
872
- <a href='spec/assets/iso713.doc'>ISO 713, Clause 1.5</a>
873
- <a href='spec/assets/iso713.doc'>A</a>
874
- <a href='spec/assets/iso713.doc'>ISO 713, Whole of text</a>
875
- <a href='spec/assets/iso713.doc'>ISO 713, Prelude 7</a>
876
- <a href='spec/assets/iso713.doc'>A</a>
877
- <a href='spec/assets/iso713.doc#xyz'>ISO 713</a>
878
- <a href='spec/assets/iso713.doc#xyz'>ISO 713, Clause 1</a>
879
- </p>
880
- </div>
881
- <p>&#160;</p>
882
- </div>
883
- <p>
884
- <br clear='all' class='section'/>
885
- </p>
886
- <div class='WordSection3'>
887
- <p class='zzSTDTitle1'/>
888
- <div>
889
- <h1>
890
- 1.
891
- <span style='mso-tab-count:1'>&#160; </span>
892
- Normative References
893
- </h1>
894
- <p id='ISO712' class='NormRef'>
895
- ISO 712,
896
- <i>Cereals and cereal products</i>
897
- </p>
898
- <p id='ISO713' class='NormRef'>
899
- ISO 713,
900
- <i>Cereals and cereal products</i>
862
+ <p id='ISO714' class='NormRef'>
863
+ ISO 714,
864
+ <i>Cereals and cereal products</i>
901
865
  </p>
902
- </div>
903
- </div>
904
- </body>
905
- </html>
866
+ </div>
867
+ </div>
868
+ </body>
869
+ </html>
870
+ OUTPUT
906
871
 
907
- OUTPUT
872
+ word = <<~OUTPUT
873
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
874
+ <head>
875
+ <style>
876
+ </style>
877
+ </head>
878
+ <body lang='EN-US' link='blue' vlink='#954F72'>
879
+ <div class='WordSection1'>
880
+ <p>&#160;</p>
881
+ </div>
882
+ <p>
883
+ <br clear='all' class='section'/>
884
+ </p>
885
+ <div class='WordSection2'>
886
+ <p>
887
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
888
+ </p>
889
+ <div>
890
+ <h1 class='ForewordTitle'>Foreword</h1>
891
+ <p>
892
+ <a href='http://www.example.com'>ISO 712</a>
893
+ <a href='http://www.example.com'>ISO 712</a>
894
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
895
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
896
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1; Clause 1</a>
897
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1&#8211;1</a>
898
+ <a href='spec/assets/iso713.doc'>ISO 713, Clause 1, Table 1</a>
899
+ <a href='spec/assets/iso713.doc'>ISO 713, Clause 1</a>
900
+ <a href='spec/assets/iso713.doc'>ISO 713, Clause 1.5</a>
901
+ <a href='spec/assets/iso713.doc'>A</a>
902
+ <a href='spec/assets/iso713.doc'>ISO 713, Whole of text</a>
903
+ <a href='spec/assets/iso713.doc'>ISO 713, Prelude 7</a>
904
+ <a href='spec/assets/iso713.doc'>A</a>
905
+ <a href='spec/assets/iso713.doc#xyz'>ISO 713</a>
906
+ <a href='spec/assets/iso713.doc#xyz'>ISO 713, Clause 1</a>
907
+ <a href='spec/assets/iso714.svg'>ISO 714</a>
908
+ </p>
909
+ </div>
910
+ <p>&#160;</p>
911
+ </div>
912
+ <p>
913
+ <br clear='all' class='section'/>
914
+ </p>
915
+ <div class='WordSection3'>
916
+ <p class='zzSTDTitle1'/>
917
+ <div>
918
+ <h1>
919
+ 1.
920
+ <span style='mso-tab-count:1'>&#160; </span>
921
+ Normative References
922
+ </h1>
923
+ <p id='ISO712' class='NormRef'>
924
+ ISO 712,
925
+ <i>Cereals and cereal products</i>
926
+ </p>
927
+ <p id='ISO713' class='NormRef'>
928
+ ISO 713,
929
+ <i>Cereals and cereal products</i>
930
+ </p>
931
+ <p id='ISO714' class='NormRef'>
932
+ ISO 714,
933
+ <i>Cereals and cereal products</i>
934
+ </p>
935
+ </div>
936
+ </div>
937
+ </body>
938
+ </html>
939
+ OUTPUT
908
940
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
909
941
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
910
942
  expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
911
- end
943
+ end
912
944
 
913
- it "processes variant" do
914
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
915
- <iso-standard xmlns="http://riboseinc.com/isoxml">
916
- <bibdata>
917
- <language>en</language>
918
- <script>Latn</script>
919
- </bibdata>
920
- <preface>
921
- <clause id="A"><title><variant lang="en" script="Latn">ABC</variant><variant lang="fr" script="Latn">DEF</variant></title></clause>
922
- <clause id="A1"><title><variant lang="en" script="Grek">ABC</variant><variant lang="fr" script="Grek">DEF</variant></title></clause>
923
- <clause id="A2"><title><variant lang="en">ABC</variant><variant lang="fr">DEF</variant></title></clause>
924
- <clause id="B"><title><variant lang="de" script="Latn">GHI</variant><variant lang="es" script="Latn">JKL</variant></title></clause>
925
- <clause id="C"><title><variant lang="fr" script="Latn">ABC</variant><variant lang="en" script="Latn">DEF</variant></title></clause>
926
- <clause id="C1"><title><variant lang="fr" script="Grek">ABC</variant><variant lang="en" script="Grek">DEF</variant></title></clause>
927
- <clause id="C2"><title><variant lang="fr">ABC</variant><variant lang="en">DEF</variant></title></clause>
928
- <p>A <variant><variant lang="en">B</variant><variant lang="fr">C</variant></variant> D <variant><variant lang="en" script="Latn">E</variant><variant lang="fr" script="Latn">F</variant></variant></p>
929
- </preface>
930
- </iso-standard>
945
+ it "processes variant" do
946
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
947
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
948
+ <bibdata>
949
+ <language>en</language>
950
+ <script>Latn</script>
951
+ </bibdata>
952
+ <preface>
953
+ <clause id="A"><title><variant lang="en" script="Latn">ABC</variant><variant lang="fr" script="Latn">DEF</variant></title></clause>
954
+ <clause id="A1"><title><variant lang="en" script="Grek">ABC</variant><variant lang="fr" script="Grek">DEF</variant></title></clause>
955
+ <clause id="A2"><title><variant lang="en">ABC</variant><variant lang="fr">DEF</variant></title></clause>
956
+ <clause id="B"><title><variant lang="de" script="Latn">GHI</variant><variant lang="es" script="Latn">JKL</variant></title></clause>
957
+ <clause id="C"><title><variant lang="fr" script="Latn">ABC</variant><variant lang="en" script="Latn">DEF</variant></title></clause>
958
+ <clause id="C1"><title><variant lang="fr" script="Grek">ABC</variant><variant lang="en" script="Grek">DEF</variant></title></clause>
959
+ <clause id="C2"><title><variant lang="fr">ABC</variant><variant lang="en">DEF</variant></title></clause>
960
+ <p>A <variant><variant lang="en">B</variant><variant lang="fr">C</variant></variant> D <variant><variant lang="en" script="Latn">E</variant><variant lang="fr" script="Latn">F</variant></variant></p>
961
+ </preface>
962
+ </iso-standard>
931
963
  INPUT
932
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
933
- <bibdata>
934
- <language current='true'>en</language>
935
- <script current='true'>Latn</script>
936
- </bibdata>
937
- <preface>
938
- <clause id='A'>
939
- <title depth='1'>ABC</title>
940
- </clause>
941
- <clause id='A1'>
942
- <title depth='1'>ABC/DEF</title>
943
- </clause>
944
- <clause id='A2'>
945
- <title depth='1'>ABC</title>
946
- </clause>
947
- <clause id='B'>
948
- <title depth='1'>GHI/JKL</title>
949
- </clause>
950
- <clause id='C'>
951
- <title depth='1'>DEF</title>
952
- </clause>
953
- <clause id='C1'>
954
- <title depth='1'>ABC/DEF</title>
955
- </clause>
956
- <clause id='C2'>
957
- <title depth='1'>DEF</title>
958
- </clause>
959
- <p>A B D E</p>
960
- </preface>
961
- </iso-standard>
964
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
965
+ <bibdata>
966
+ <language current='true'>en</language>
967
+ <script current='true'>Latn</script>
968
+ </bibdata>
969
+ <preface>
970
+ <clause id='A'>
971
+ <title depth='1'>ABC</title>
972
+ </clause>
973
+ <clause id='A1'>
974
+ <title depth='1'>ABC/DEF</title>
975
+ </clause>
976
+ <clause id='A2'>
977
+ <title depth='1'>ABC</title>
978
+ </clause>
979
+ <clause id='B'>
980
+ <title depth='1'>GHI/JKL</title>
981
+ </clause>
982
+ <clause id='C'>
983
+ <title depth='1'>DEF</title>
984
+ </clause>
985
+ <clause id='C1'>
986
+ <title depth='1'>ABC/DEF</title>
987
+ </clause>
988
+ <clause id='C2'>
989
+ <title depth='1'>DEF</title>
990
+ </clause>
991
+ <p>A B D E</p>
992
+ </preface>
993
+ </iso-standard>
962
994
  OUTPUT
963
- end
995
+ end
964
996
 
965
- it "cases xrefs" do
966
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
967
- <iso-standard xmlns="http://riboseinc.com/isoxml">
968
- <sections>
969
- <clause id="A">
970
- <table id="B">
971
- </table>
972
- </clause>
973
- <clause id="C">
974
- <p>This is <xref target="A"/> and <xref target="B"/>.
975
- This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
976
- This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
977
- <xref target="A"/> is clause <em>initial.</em><br/>
978
- <xref target="A"/> is too. </p>
979
- <p><xref target="A"/> is also.</p>
980
- </clause>
981
- </sections>
982
- </iso-standard>
983
- INPUT
984
- <?xml version='1.0'?>
985
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
986
- <sections>
987
- <clause id='A'>
988
- <title>1.</title>
989
- <table id='B'>
990
- <name>Tabelo 1</name>
991
- </table>
992
- </clause>
993
- <clause id='C'>
994
- <title>2.</title>
995
- <p>
996
- This is
997
- <xref target='A'>kla&#x16D;zo 1</xref>
998
- and
999
- <xref target='B'>tabelo 1</xref>
1000
- . This is
1001
- <xref target='A' case='capital'>Kla&#x16D;zo 1</xref>
1002
- and
1003
- <xref target='B' case='lowercase'>tabelo 1</xref>
1004
- . This is
1005
- <xref target='A' case='lowercase'>kla&#x16D;zo 1</xref>
1006
- and
1007
- <xref target='B' case='capital'>Tabelo 1</xref>
1008
- .
1009
- <xref target='A'>Kla&#x16D;zo 1</xref>
1010
- is clause
1011
- <em>initial.</em>
1012
- <br/>
1013
- <xref target='A'>Kla&#x16D;zo 1</xref>
1014
- is too.
1015
- </p>
1016
- <p>
1017
- <xref target='A'>Kla&#x16D;zo 1</xref>
1018
- is also.
1019
- </p>
1020
- </clause>
1021
- </sections>
1022
- </iso-standard>
1023
- OUTPUT
1024
- end
997
+ it "cases xrefs" do
998
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({ i18nyaml: "spec/assets/i18n.yaml" }).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
999
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1000
+ <sections>
1001
+ <clause id="A">
1002
+ <table id="B">
1003
+ </table>
1004
+ </clause>
1005
+ <clause id="C">
1006
+ <p>This is <xref target="A"/> and <xref target="B"/>.
1007
+ This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
1008
+ This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
1009
+ <xref target="A"/> is clause <em>initial.</em><br/>
1010
+ <xref target="A"/> is too. </p>
1011
+ <p><xref target="A"/> is also.</p>
1012
+ </clause>
1013
+ </sections>
1014
+ </iso-standard>
1015
+ INPUT
1016
+ <?xml version='1.0'?>
1017
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1018
+ <sections>
1019
+ <clause id='A'>
1020
+ <title>1.</title>
1021
+ <table id='B'>
1022
+ <name>Tabelo 1</name>
1023
+ </table>
1024
+ </clause>
1025
+ <clause id='C'>
1026
+ <title>2.</title>
1027
+ <p>
1028
+ This is
1029
+ <xref target='A'>kla&#x16D;zo 1</xref>
1030
+ and
1031
+ <xref target='B'>tabelo 1</xref>
1032
+ . This is
1033
+ <xref target='A' case='capital'>Kla&#x16D;zo 1</xref>
1034
+ and
1035
+ <xref target='B' case='lowercase'>tabelo 1</xref>
1036
+ . This is
1037
+ <xref target='A' case='lowercase'>kla&#x16D;zo 1</xref>
1038
+ and
1039
+ <xref target='B' case='capital'>Tabelo 1</xref>
1040
+ .
1041
+ <xref target='A'>Kla&#x16D;zo 1</xref>
1042
+ is clause
1043
+ <em>initial.</em>
1044
+ <br/>
1045
+ <xref target='A'>Kla&#x16D;zo 1</xref>
1046
+ is too.
1047
+ </p>
1048
+ <p>
1049
+ <xref target='A'>Kla&#x16D;zo 1</xref>
1050
+ is also.
1051
+ </p>
1052
+ </clause>
1053
+ </sections>
1054
+ </iso-standard>
1055
+ OUTPUT
1056
+ end
1025
1057
 
1026
1058
  it "processes add, del" do
1027
1059
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
@@ -1049,6 +1081,4 @@ end
1049
1081
  </html>
1050
1082
  OUTPUT
1051
1083
  end
1052
-
1053
-
1054
1084
  end