isodoc 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -2
- data/isodoc.gemspec +1 -1
- data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
- data/lib/isodoc-yaml/i18n-de.yaml +149 -0
- data/lib/isodoc-yaml/i18n-es.yaml +151 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
- data/lib/isodoc/common.rb +2 -0
- data/lib/isodoc/convert.rb +1 -1
- data/lib/isodoc/function/blocks.rb +10 -0
- data/lib/isodoc/function/form.rb +51 -0
- data/lib/isodoc/function/inline.rb +1 -0
- data/lib/isodoc/function/references.rb +55 -42
- data/lib/isodoc/function/table.rb +1 -0
- data/lib/isodoc/function/to_word_html.rb +15 -24
- data/lib/isodoc/html_convert.rb +2 -0
- data/lib/isodoc/html_function/form.rb +62 -0
- data/lib/isodoc/i18n.rb +13 -11
- data/lib/isodoc/presentation_function/inline.rb +46 -103
- data/lib/isodoc/presentation_function/math.rb +84 -0
- data/lib/isodoc/presentation_xml_convert.rb +1 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +28 -24
- data/spec/isodoc/form_spec.rb +156 -0
- data/spec/isodoc/inline_spec.rb +958 -928
- data/spec/isodoc/postproc_spec.rb +329 -309
- metadata +12 -4
@@ -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
|
data/lib/isodoc/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require_relative "./table
|
2
|
-
require_relative "./inline
|
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
|
-
|
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(
|
113
|
-
dl =
|
113
|
+
def figure_get_or_make_dl(node)
|
114
|
+
dl = node.at(".//table[@class = 'dl']")
|
114
115
|
if dl.nil?
|
115
|
-
|
116
|
-
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(
|
122
|
+
def figure_aside_process(fig, aside, key)
|
122
123
|
# get rid of footnote link, it is in diagram
|
123
|
-
|
124
|
-
fnref =
|
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] +=
|
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
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
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(
|
193
|
-
return unless
|
193
|
+
def formula_where(deflist, out)
|
194
|
+
return unless deflist
|
195
|
+
|
194
196
|
out.p { |p| p << @i18n.where }
|
195
|
-
parse(
|
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 |
|
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
|
214
|
+
out.li **attr_code(id: node["id"]) do |li|
|
213
215
|
if node["uncheckedcheckbox"] == "true"
|
214
216
|
li << '<span class="zzMoveToFollowing">☐ </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{^
|
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
|
+
◎ Male
|
125
|
+
<br/>
|
126
|
+
◎ Female
|
127
|
+
<br/>
|
128
|
+
◎ Other
|
129
|
+
<br/>
|
130
|
+
☐ I have a bike
|
131
|
+
<br/>
|
132
|
+
☐ I have a car
|
133
|
+
<br/>
|
134
|
+
☐ 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
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -1,783 +1,817 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
</clause>
|
16
|
-
</sections>
|
17
|
-
</iso-standard>
|
18
|
-
INPUT
|
19
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
</iso-standard>
|
43
|
-
OUTPUT
|
44
|
-
|
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ŭzo 1</xref>
|
32
|
+
and
|
33
|
+
<xref target='B'>klaŭ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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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
|
-
|
71
|
-
|
72
|
-
</body>
|
73
|
-
</html>
|
72
|
+
</body>
|
73
|
+
</html>
|
74
74
|
OUTPUT
|
75
75
|
end
|
76
76
|
|
77
|
-
|
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
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
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
|
-
|
120
|
+
it "ignores index entries" do
|
122
121
|
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
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
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
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
|
-
|
141
|
+
end
|
143
142
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
<bibitem id="ISO712" type="standard">
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
</bibitem>
|
226
|
-
</references></bibliography>
|
227
|
-
|
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
|
-
|
231
|
-
|
232
|
-
|
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><</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
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
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><</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><</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
|
-
|
387
|
-
|
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
|
-
|
400
|
-
|
401
|
-
</
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
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
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
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
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
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
|
-
|
437
|
-
|
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
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
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
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
453
|
+
#{HTML_HDR}
|
454
|
+
<br/>
|
455
|
+
<div>
|
456
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
457
|
+
<p>
|
458
|
+
<para><b role="strong"><barry fred="http://example.com">example</barry></b></para>
|
459
|
+
</p>
|
460
|
+
</div>
|
461
|
+
<p class="zzSTDTitle1"/>
|
461
462
|
</div>
|
462
|
-
|
463
|
-
|
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
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
470
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
471
|
+
<preface><foreword>
|
472
|
+
<p>
|
473
|
+
<stem type="AsciiMath"><A></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
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
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">(#(<A>)#)</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
|
-
|
495
|
-
|
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
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
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
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
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
|
-
|
523
|
-
|
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
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
<bibitem id="ISO712" type="standard">
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
</bibitem>
|
549
|
-
|
550
|
-
|
551
|
-
|
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
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
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
|
-
</
|
568
|
-
|
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
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
<bibitem id="ISO712" type="standard">
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
</bibitem>
|
608
|
-
|
609
|
-
|
610
|
-
|
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
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
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–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
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
<a href='#ISO712'>ISO 712, Table 1; Clause 1</a>
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
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–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.  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
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
<
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
</
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
</
|
734
|
-
|
735
|
-
|
736
|
-
|
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
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
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–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'>
|
780
|
-
<docidentifier>ISO
|
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
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
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
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
</
|
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> </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–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.  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
|
-
<
|
862
|
-
|
863
|
-
<
|
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–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> </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'>  </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
|
-
|
903
|
-
|
904
|
-
|
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> </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–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> </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'>  </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
|
-
|
943
|
+
end
|
912
944
|
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
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
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
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
|
-
|
995
|
+
end
|
964
996
|
|
965
|
-
it "cases xrefs" do
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
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
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
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ŭzo 1</xref>
|
1030
|
+
and
|
1031
|
+
<xref target='B'>tabelo 1</xref>
|
1032
|
+
. This is
|
1033
|
+
<xref target='A' case='capital'>Klaŭzo 1</xref>
|
1034
|
+
and
|
1035
|
+
<xref target='B' case='lowercase'>tabelo 1</xref>
|
1036
|
+
. This is
|
1037
|
+
<xref target='A' case='lowercase'>klaŭzo 1</xref>
|
1038
|
+
and
|
1039
|
+
<xref target='B' case='capital'>Tabelo 1</xref>
|
1040
|
+
.
|
1041
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1042
|
+
is clause
|
1043
|
+
<em>initial.</em>
|
1044
|
+
<br/>
|
1045
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1046
|
+
is too.
|
1047
|
+
</p>
|
1048
|
+
<p>
|
1049
|
+
<xref target='A'>Klaŭ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
|