isodoc 1.5.5 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +2 -12
- data/.hound.yml +3 -1
- data/.rubocop.yml +3 -7
- data/Gemfile +2 -2
- data/Rakefile +2 -2
- data/bin/rspec +1 -2
- data/isodoc.gemspec +11 -11
- 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.rb +0 -2
- data/lib/isodoc/base_style/all.css +7 -0
- data/lib/isodoc/base_style/metanorma_word.css +7 -0
- data/lib/isodoc/base_style/metanorma_word.scss +8 -0
- data/lib/isodoc/base_style/reset.css +7 -0
- data/lib/isodoc/base_style/reset.scss +9 -0
- data/lib/isodoc/base_style/scripts.html +187 -0
- data/lib/isodoc/class_utils.rb +6 -5
- data/lib/isodoc/common.rb +2 -0
- data/lib/isodoc/convert.rb +30 -17
- data/lib/isodoc/css.rb +43 -34
- data/lib/isodoc/function/blocks.rb +21 -4
- data/lib/isodoc/function/blocks_example_note.rb +2 -2
- data/lib/isodoc/function/cleanup.rb +53 -45
- data/lib/isodoc/function/form.rb +51 -0
- data/lib/isodoc/function/inline.rb +37 -15
- data/lib/isodoc/function/references.rb +55 -42
- data/lib/isodoc/function/section.rb +29 -16
- data/lib/isodoc/function/table.rb +1 -0
- data/lib/isodoc/function/to_word_html.rb +33 -29
- data/lib/isodoc/function/utils.rb +180 -159
- data/lib/isodoc/gem_tasks.rb +30 -31
- data/lib/isodoc/headlesshtml_convert.rb +8 -7
- data/lib/isodoc/html_convert.rb +6 -4
- data/lib/isodoc/html_function/comments.rb +2 -0
- data/lib/isodoc/html_function/footnotes.rb +14 -7
- data/lib/isodoc/html_function/form.rb +62 -0
- data/lib/isodoc/html_function/html.rb +30 -26
- data/lib/isodoc/html_function/postprocess.rb +41 -82
- data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
- data/lib/isodoc/i18n.rb +33 -31
- data/lib/isodoc/pdf_convert.rb +12 -16
- data/lib/isodoc/presentation_function/bibdata.rb +54 -30
- data/lib/isodoc/presentation_function/block.rb +17 -8
- data/lib/isodoc/presentation_function/inline.rb +84 -120
- data/lib/isodoc/presentation_function/math.rb +84 -0
- data/lib/isodoc/presentation_function/section.rb +20 -22
- data/lib/isodoc/presentation_xml_convert.rb +2 -1
- data/lib/isodoc/sassc_importer.rb +1 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +28 -24
- data/lib/isodoc/word_function/footnotes.rb +22 -15
- data/lib/isodoc/word_function/postprocess.rb +50 -36
- data/lib/isodoc/xref.rb +9 -10
- data/lib/isodoc/xref/xref_counter.rb +32 -17
- data/lib/isodoc/xref/xref_gen.rb +33 -21
- data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
- data/lib/isodoc/xref/xref_sect_gen.rb +37 -35
- data/lib/isodoc/xslfo_convert.rb +36 -27
- data/spec/assets/scripts_override.html +3 -0
- data/spec/isodoc/blocks_spec.rb +2490 -2591
- data/spec/isodoc/cleanup_spec.rb +1107 -1109
- data/spec/isodoc/footnotes_spec.rb +1 -16
- data/spec/isodoc/form_spec.rb +156 -0
- data/spec/isodoc/i18n_spec.rb +984 -972
- data/spec/isodoc/inline_spec.rb +1129 -912
- data/spec/isodoc/lists_spec.rb +316 -315
- data/spec/isodoc/postproc_spec.rb +1751 -1540
- data/spec/isodoc/presentation_xml_spec.rb +403 -323
- data/spec/isodoc/ref_spec.rb +718 -723
- data/spec/isodoc/section_spec.rb +910 -902
- data/spec/isodoc/table_spec.rb +566 -556
- data/spec/isodoc/terms_spec.rb +251 -255
- data/spec/isodoc/xref_spec.rb +3041 -2992
- data/spec/isodoc/xslfo_convert_spec.rb +39 -0
- data/spec/spec_helper.rb +30 -29
- metadata +77 -65
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -1,95 +1,80 @@
|
|
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
|
-
<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
|
-
|
46
|
-
it "processes inline formatting (HTML)" do
|
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>
|
4
|
+
it "droplocs xrefs" do
|
5
|
+
input = <<~INPUT
|
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>
|
58
18
|
INPUT
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
19
|
+
output = <<~OUTPUT
|
20
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
21
|
+
<sections>
|
22
|
+
<clause id='A'>
|
23
|
+
<title>1.</title>
|
24
|
+
<formula id='B'>
|
25
|
+
<name>1</name>
|
26
|
+
</formula>
|
27
|
+
</clause>
|
28
|
+
<clause id='C'>
|
29
|
+
<title>2.</title>
|
30
|
+
<p>
|
31
|
+
This is
|
32
|
+
<xref target='A'>klaŭzo 1</xref>
|
33
|
+
and
|
34
|
+
<xref target='B'>klaŭzo 1, Formula (1)</xref>
|
35
|
+
. This is
|
36
|
+
<xref target='A' droploc='true'>1</xref>
|
37
|
+
and
|
38
|
+
<xref target='B' droploc='true'>(1)</xref>
|
39
|
+
.
|
40
|
+
</p>
|
41
|
+
</clause>
|
42
|
+
</sections>
|
43
|
+
</iso-standard>
|
74
44
|
OUTPUT
|
45
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
46
|
+
.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
47
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
75
48
|
end
|
76
49
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
50
|
+
it "processes inline formatting" do
|
51
|
+
input = <<~INPUT
|
52
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
53
|
+
<preface><foreword>
|
54
|
+
<p>
|
55
|
+
<em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
|
56
|
+
<strike>F</strike> <smallcap>G</smallcap> <keyword>I</keyword> <br/> <hr/>
|
57
|
+
<bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/> <underline>J</underline>
|
58
|
+
</p>
|
59
|
+
</foreword></preface>
|
60
|
+
<sections>
|
61
|
+
</iso-standard>
|
88
62
|
INPUT
|
89
|
-
|
90
|
-
|
63
|
+
html = <<~OUTPUT
|
64
|
+
<div>
|
65
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
66
|
+
<p>
|
67
|
+
<i>A</i> <b>B</b> <sup>C</sup> <sub>D</sub> <tt>E</tt>
|
68
|
+
<s>F</s> <span style="font-variant:small-caps;">G</span> <span class="keyword">I</span> <br/> <hr/>
|
69
|
+
<a id="H"/> <br/> <br/>
|
70
|
+
<span style='text-decoration: underline;'>J</span>
|
71
|
+
</p>
|
72
|
+
</div>
|
73
|
+
OUTPUT
|
74
|
+
|
75
|
+
doc = <<~OUTPUT
|
91
76
|
<div>
|
92
|
-
<h1
|
77
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
93
78
|
<p>
|
94
79
|
<i>A</i>
|
95
80
|
<b>B</b>
|
@@ -111,667 +96,860 @@ OUTPUT
|
|
111
96
|
<u>J</u>
|
112
97
|
</p>
|
113
98
|
</div>
|
114
|
-
</div>
|
115
|
-
</body>
|
116
|
-
</html>
|
117
|
-
|
118
99
|
OUTPUT
|
100
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
101
|
+
.convert("test", input, true))
|
102
|
+
.sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
|
103
|
+
.to be_equivalent_to xmlpp(html)
|
104
|
+
expect(xmlpp(IsoDoc::WordConvert.new({})
|
105
|
+
.convert("test", input, true))
|
106
|
+
.sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
|
107
|
+
.to be_equivalent_to xmlpp(doc)
|
119
108
|
end
|
120
109
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
110
|
+
it "ignores index entries" do
|
111
|
+
input = <<~INPUT
|
112
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
113
|
+
<preface><foreword>
|
114
|
+
<p><index primary="A" secondary="B" tertiary="C"/></p>
|
115
|
+
</foreword></preface>
|
116
|
+
<sections/>
|
117
|
+
<indexsect>
|
118
|
+
<title>Index</title>
|
119
|
+
</indexsect>
|
120
|
+
</iso-standard>
|
132
121
|
INPUT
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
</
|
122
|
+
output = <<~OUTPUT
|
123
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
124
|
+
<preface>
|
125
|
+
<foreword>
|
126
|
+
<p/>
|
127
|
+
</foreword>
|
128
|
+
</preface>
|
129
|
+
<sections> </sections>
|
130
|
+
</iso-standard>
|
141
131
|
OUTPUT
|
142
|
-
|
132
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
133
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
134
|
+
end
|
143
135
|
|
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
|
-
|
136
|
+
it "processes concept markup" do
|
137
|
+
input = <<~INPUT
|
138
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
139
|
+
<preface><foreword>
|
140
|
+
<p>
|
141
|
+
<ul>
|
142
|
+
<li><concept term='term'>
|
143
|
+
<xref target='clause1'/>
|
144
|
+
</concept></li>
|
145
|
+
<li><concept term='term'>
|
146
|
+
<xref target='clause1'>w[o]rd</xref>
|
147
|
+
</concept></li>
|
148
|
+
<li><concept term='term'>
|
149
|
+
<eref bibitemid="ISO712" type="inline" citeas="ISO 712"/>
|
150
|
+
</concept></li>
|
151
|
+
<li><concept term='term'>
|
152
|
+
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">word</eref>
|
153
|
+
</concept></li>
|
154
|
+
<li><concept>
|
155
|
+
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
156
|
+
<locality type='clause'>
|
157
|
+
<referenceFrom>3.1</referenceFrom>
|
158
|
+
</locality>
|
159
|
+
<locality type='figure'>
|
160
|
+
<referenceFrom>a</referenceFrom>
|
161
|
+
</locality>
|
162
|
+
</eref>
|
163
|
+
</concept></li>
|
164
|
+
<li><concept>
|
165
|
+
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
166
|
+
<localityStack>
|
167
|
+
<locality type='clause'>
|
168
|
+
<referenceFrom>3.1</referenceFrom>
|
169
|
+
</locality>
|
170
|
+
</localityStack>
|
171
|
+
<localityStack>
|
172
|
+
<locality type='figure'>
|
173
|
+
<referenceFrom>b</referenceFrom>
|
174
|
+
</locality>
|
175
|
+
</localityStack>
|
176
|
+
</eref>
|
177
|
+
</concept></li>
|
178
|
+
<li><concept>
|
179
|
+
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
180
|
+
<localityStack>
|
181
|
+
<locality type='clause'>
|
182
|
+
<referenceFrom>3.1</referenceFrom>
|
183
|
+
</locality>
|
184
|
+
</localityStack>
|
185
|
+
<localityStack>
|
186
|
+
<locality type='figure'>
|
187
|
+
<referenceFrom>b</referenceFrom>
|
188
|
+
</locality>
|
189
|
+
</localityStack>
|
190
|
+
<em>word</em>
|
191
|
+
</eref>
|
192
|
+
</concept></li>
|
193
|
+
<li><concept term='term'>
|
194
|
+
<termref base='IEV' target='135-13-13'/>
|
195
|
+
</concept></li>
|
196
|
+
<li><concept term='term'>
|
197
|
+
<termref base='IEV' target='135-13-13'><em>word</em> word</termref>
|
198
|
+
</concept></li>
|
199
|
+
</ul>
|
200
|
+
</p>
|
201
|
+
</foreword></preface>
|
202
|
+
<sections>
|
203
|
+
<clause id="clause1"><title>Clause 1</title></clause>
|
204
|
+
</sections>
|
205
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
206
|
+
<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>
|
207
|
+
<bibitem id="ISO712" type="standard">
|
208
|
+
<title format="text/plain">Cereals or cereal products</title>
|
209
|
+
<title type="main" format="text/plain">Cereals and cereal products</title>
|
210
|
+
<docidentifier type="ISO">ISO 712</docidentifier>
|
211
|
+
<contributor>
|
212
|
+
<role type="publisher"/>
|
213
|
+
<organization>
|
214
|
+
<name>International Organization for Standardization</name>
|
215
|
+
</organization>
|
216
|
+
</contributor>
|
217
|
+
</bibitem>
|
218
|
+
</references></bibliography>
|
219
|
+
</iso-standard>
|
228
220
|
INPUT
|
229
221
|
presxml = <<~OUTPUT
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
222
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
223
|
+
<preface>
|
224
|
+
<foreword>
|
225
|
+
<p>
|
226
|
+
<ul>
|
227
|
+
<li>
|
228
|
+
<em>
|
229
|
+
<xref target='clause1'>Clause 2</xref>
|
230
|
+
</em>
|
231
|
+
</li>
|
232
|
+
<li>
|
233
|
+
<em>
|
234
|
+
<xref target='clause1'>w[o]rd</xref>
|
235
|
+
</em>
|
236
|
+
</li>
|
237
|
+
<li>
|
238
|
+
<em>
|
239
|
+
<eref bibitemid='ISO712' type='inline' citeas='ISO 712'>ISO 712</eref>
|
240
|
+
</em>
|
241
|
+
</li>
|
242
|
+
<li>
|
243
|
+
<em>
|
244
|
+
<eref bibitemid='ISO712' type='inline' citeas='ISO 712'>word</eref>
|
245
|
+
</em>
|
246
|
+
</li>
|
247
|
+
<li>
|
248
|
+
<em>
|
249
|
+
<eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
|
250
|
+
<locality type='clause'>
|
251
|
+
<referenceFrom>3.1</referenceFrom>
|
252
|
+
</locality>
|
253
|
+
<locality type='figure'>
|
254
|
+
<referenceFrom>a</referenceFrom>
|
255
|
+
</locality>
|
256
|
+
ISO 712, Clause 3.1, Figure a
|
257
|
+
</eref>
|
258
|
+
</em>
|
259
|
+
</li>
|
260
|
+
<li>
|
261
|
+
<em>
|
262
|
+
<eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
|
263
|
+
<localityStack>
|
264
|
+
<locality type='clause'>
|
265
|
+
<referenceFrom>3.1</referenceFrom>
|
266
|
+
</locality>
|
267
|
+
</localityStack>
|
268
|
+
<localityStack>
|
269
|
+
<locality type='figure'>
|
270
|
+
<referenceFrom>b</referenceFrom>
|
271
|
+
</locality>
|
272
|
+
</localityStack>
|
273
|
+
ISO 712, Clause 3.1; Figure b
|
274
|
+
</eref>
|
275
|
+
</em>
|
276
|
+
</li>
|
277
|
+
<li>
|
278
|
+
<em>
|
279
|
+
<eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
|
280
|
+
<localityStack>
|
281
|
+
<locality type='clause'>
|
282
|
+
<referenceFrom>3.1</referenceFrom>
|
283
|
+
</locality>
|
284
|
+
</localityStack>
|
285
|
+
<localityStack>
|
286
|
+
<locality type='figure'>
|
287
|
+
<referenceFrom>b</referenceFrom>
|
288
|
+
</locality>
|
289
|
+
</localityStack>
|
290
|
+
<em>word</em>
|
291
|
+
</eref>
|
292
|
+
</em>
|
293
|
+
</li>
|
294
|
+
<li>
|
295
|
+
[term defined in
|
296
|
+
<termref base='IEV' target='135-13-13'/>
|
297
|
+
]
|
298
|
+
</li>
|
299
|
+
<li>
|
300
|
+
<em>
|
301
|
+
<termref base='IEV' target='135-13-13'>
|
302
|
+
<em>word</em>
|
303
|
+
word
|
304
|
+
</termref>
|
305
|
+
</em>
|
306
|
+
</li>
|
307
|
+
</ul>
|
308
|
+
</p>
|
309
|
+
</foreword>
|
310
|
+
</preface>
|
311
|
+
<sections>
|
312
|
+
<clause id='clause1'>
|
313
|
+
<title depth='1'>
|
314
|
+
2.
|
315
|
+
<tab/>
|
316
|
+
Clause 1
|
317
|
+
</title>
|
318
|
+
</clause>
|
319
|
+
</sections>
|
320
|
+
<bibliography>
|
321
|
+
<references id='_normative_references' obligation='informative' normative='true'>
|
322
|
+
<title depth='1'>
|
323
|
+
1.
|
324
|
+
<tab/>
|
325
|
+
Normative References
|
326
|
+
</title>
|
327
|
+
<p>
|
328
|
+
The following documents are referred to in the text in such a way that
|
329
|
+
some or all of their content constitutes requirements of this document.
|
330
|
+
For dated references, only the edition cited applies. For undated
|
331
|
+
references, the latest edition of the referenced document (including any
|
332
|
+
amendments) applies.
|
333
|
+
</p>
|
334
|
+
<bibitem id='ISO712' type='standard'>
|
335
|
+
<title format='text/plain'>Cereals or cereal products</title>
|
336
|
+
<title type='main' format='text/plain'>Cereals and cereal products</title>
|
337
|
+
<docidentifier type='ISO'>ISO 712</docidentifier>
|
338
|
+
<contributor>
|
339
|
+
<role type='publisher'/>
|
340
|
+
<organization>
|
341
|
+
<name>International Organization for Standardization</name>
|
342
|
+
</organization>
|
343
|
+
</contributor>
|
344
|
+
</bibitem>
|
345
|
+
</references>
|
346
|
+
</bibliography>
|
347
|
+
</iso-standard>
|
348
|
+
OUTPUT
|
349
|
+
output = <<~OUTPUT
|
350
|
+
#{HTML_HDR}
|
351
|
+
<br/>
|
352
|
+
<div>
|
353
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
354
|
+
<p>
|
355
|
+
<ul>
|
356
|
+
<li>
|
357
|
+
<i>
|
358
|
+
<a href='#clause1'>Clause 2</a>
|
359
|
+
</i>
|
360
|
+
</li>
|
361
|
+
<li>
|
362
|
+
<i>
|
363
|
+
<a href='#clause1'>w[o]rd</a>
|
364
|
+
</i>
|
365
|
+
</li>
|
366
|
+
<li>
|
367
|
+
<i>
|
368
|
+
<a href='#ISO712'>ISO 712</a>
|
369
|
+
</i>
|
370
|
+
</li>
|
371
|
+
<li>
|
372
|
+
<i>
|
373
|
+
<a href='#ISO712'>word</a>
|
374
|
+
</i>
|
375
|
+
</li>
|
376
|
+
<li>
|
377
|
+
<i>
|
378
|
+
<a href='#ISO712'> ISO 712, Clause 3.1, Figure a </a>
|
379
|
+
</i>
|
380
|
+
</li>
|
381
|
+
<li>
|
382
|
+
<i>
|
383
|
+
<a href='#ISO712'> ISO 712, Clause 3.1; Figure b </a>
|
384
|
+
</i>
|
385
|
+
</li>
|
386
|
+
<li>
|
387
|
+
<i>
|
388
|
+
<a href='#ISO712'>
|
389
|
+
<i>word</i>
|
390
|
+
</a>
|
391
|
+
</i>
|
392
|
+
</li>
|
393
|
+
<li> [term defined in Termbase IEV, term ID 135-13-13 ] </li>
|
394
|
+
<li>
|
395
|
+
<i> Termbase IEV, term ID 135-13-13 </i>
|
396
|
+
</li>
|
397
|
+
</ul>
|
398
|
+
</p>
|
399
|
+
</div>
|
400
|
+
<p class='zzSTDTitle1'/>
|
401
|
+
<div>
|
402
|
+
<h1> 1.   Normative References </h1>
|
403
|
+
<p>
|
404
|
+
The following documents are referred to in the text in such a way
|
405
|
+
that some or all of their content constitutes requirements of this
|
406
|
+
document. For dated references, only the edition cited applies. For
|
407
|
+
undated references, the latest edition of the referenced document
|
408
|
+
(including any amendments) applies.
|
409
|
+
</p>
|
410
|
+
<p id='ISO712' class='NormRef'>
|
411
|
+
ISO 712,
|
412
|
+
<i>Cereals and cereal products</i>
|
413
|
+
</p>
|
414
|
+
</div>
|
415
|
+
<div id='clause1'>
|
416
|
+
<h1> 2.   Clause 1 </h1>
|
417
|
+
</div>
|
418
|
+
</div>
|
419
|
+
</body>
|
420
|
+
</html>
|
421
|
+
OUTPUT
|
422
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
423
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
424
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
425
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
426
|
+
end
|
357
427
|
|
358
428
|
it "processes embedded inline formatting" do
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
429
|
+
input = <<~INPUT
|
430
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
431
|
+
<preface><foreword>
|
432
|
+
<p>
|
433
|
+
<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>
|
434
|
+
</p>
|
435
|
+
</foreword></preface>
|
436
|
+
<sections>
|
437
|
+
</iso-standard>
|
368
438
|
INPUT
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
<
|
373
|
-
|
374
|
-
|
375
|
-
|
439
|
+
output = <<~OUTPUT
|
440
|
+
#{HTML_HDR}
|
441
|
+
<br/>
|
442
|
+
<div>
|
443
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
444
|
+
<p>
|
445
|
+
<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>
|
446
|
+
</p>
|
447
|
+
</div>
|
448
|
+
<p class="zzSTDTitle1"/>
|
376
449
|
</div>
|
377
|
-
|
378
|
-
|
379
|
-
</body>
|
380
|
-
</html>
|
450
|
+
</body>
|
451
|
+
</html>
|
381
452
|
OUTPUT
|
453
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
454
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
382
455
|
end
|
383
456
|
|
384
457
|
it "processes inline images" do
|
385
|
-
|
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>
|
458
|
+
input = <<~INPUT
|
459
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
460
|
+
<preface><foreword>
|
398
461
|
<p>
|
399
|
-
|
400
|
-
|
401
|
-
</
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
462
|
+
<image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
|
463
|
+
</p>
|
464
|
+
</foreword></preface>
|
465
|
+
</iso-standard>
|
466
|
+
INPUT
|
467
|
+
output = <<~OUTPUT
|
468
|
+
#{HTML_HDR}
|
469
|
+
<br/>
|
470
|
+
<div>
|
471
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
472
|
+
<p>
|
473
|
+
<img src='rice_images/rice_image1.png' height='20' width='30' title='titletxt' alt='alttext'/>
|
474
|
+
</p>
|
475
|
+
</div>
|
476
|
+
<p class='zzSTDTitle1'/>
|
477
|
+
</div>
|
478
|
+
</body>
|
479
|
+
</html>
|
480
|
+
OUTPUT
|
481
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
482
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
407
483
|
end
|
408
484
|
|
409
485
|
it "processes links" do
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
486
|
+
input = <<~INPUT
|
487
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
488
|
+
<preface><foreword>
|
489
|
+
<p>
|
490
|
+
<link target="http://example.com"/>
|
491
|
+
<link target="http://example.com">example</link>
|
492
|
+
<link target="http://example.com" alt="tip">example</link>
|
493
|
+
<link target="mailto:fred@example.com"/>
|
494
|
+
<link target="mailto:fred@example.com">mailto:fred@example.com</link>
|
495
|
+
</p>
|
496
|
+
</foreword></preface>
|
497
|
+
<sections>
|
498
|
+
</iso-standard>
|
423
499
|
INPUT
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
<
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
500
|
+
output = <<~OUTPUT
|
501
|
+
#{HTML_HDR}
|
502
|
+
<br/>
|
503
|
+
<div>
|
504
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
505
|
+
<p>
|
506
|
+
<a href="http://example.com">http://example.com</a>
|
507
|
+
<a href="http://example.com">example</a>
|
508
|
+
<a href="http://example.com" title="tip">example</a>
|
509
|
+
<a href="mailto:fred@example.com">fred@example.com</a>
|
510
|
+
<a href="mailto:fred@example.com">mailto:fred@example.com</a>
|
511
|
+
</p>
|
512
|
+
</div>
|
513
|
+
<p class="zzSTDTitle1"/>
|
435
514
|
</div>
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
515
|
+
</body>
|
516
|
+
</html>
|
517
|
+
OUTPUT
|
518
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
519
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
520
|
+
end
|
521
|
+
|
522
|
+
it "processes updatetype links" do
|
523
|
+
input = <<~INPUT
|
524
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
525
|
+
<preface><foreword>
|
526
|
+
<p>
|
527
|
+
<link updatetype="true" target="http://example.com"/>
|
528
|
+
<link updatetype="true" target="list.adoc">example</link>
|
529
|
+
<link updatetype="true" target="list" alt="tip">example</link>
|
530
|
+
</p>
|
531
|
+
</foreword></preface>
|
532
|
+
<sections>
|
533
|
+
</iso-standard>
|
534
|
+
INPUT
|
535
|
+
html = <<~OUTPUT
|
536
|
+
<div>
|
537
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
538
|
+
<p>
|
539
|
+
<a href="http://example.com">http://example.com</a>
|
540
|
+
<a href='list.adoc'>example</a>
|
541
|
+
<a href='list.html' title='tip'>example</a>
|
542
|
+
</p>
|
543
|
+
</div>
|
544
|
+
OUTPUT
|
545
|
+
doc = <<~OUTPUT
|
546
|
+
<div>
|
547
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
548
|
+
<p>
|
549
|
+
<a href="http://example.com">http://example.com</a>
|
550
|
+
<a href='list.adoc'>example</a>
|
551
|
+
<a href='list.doc' title='tip'>example</a>
|
552
|
+
</p>
|
553
|
+
</div>
|
440
554
|
OUTPUT
|
555
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
556
|
+
.convert("test", input, true))
|
557
|
+
.sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
|
558
|
+
.to be_equivalent_to xmlpp(html)
|
559
|
+
expect(xmlpp(IsoDoc::WordConvert.new({})
|
560
|
+
.convert("test", input, true))
|
561
|
+
.sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
|
562
|
+
.to be_equivalent_to xmlpp(doc)
|
441
563
|
end
|
442
564
|
|
443
565
|
it "processes unrecognised markup" do
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
566
|
+
input = <<~INPUT
|
567
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
568
|
+
<preface><foreword>
|
569
|
+
<p>
|
570
|
+
<barry fred="http://example.com">example</barry>
|
571
|
+
</p>
|
572
|
+
</foreword></preface>
|
573
|
+
<sections>
|
574
|
+
</iso-standard>
|
453
575
|
INPUT
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
<
|
458
|
-
|
459
|
-
|
460
|
-
|
576
|
+
output = <<~OUTPUT
|
577
|
+
#{HTML_HDR}
|
578
|
+
<br/>
|
579
|
+
<div>
|
580
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
581
|
+
<p>
|
582
|
+
<para><b role="strong"><barry fred="http://example.com">example</barry></b></para>
|
583
|
+
</p>
|
584
|
+
</div>
|
585
|
+
<p class="zzSTDTitle1"/>
|
461
586
|
</div>
|
462
|
-
|
463
|
-
|
464
|
-
</body>
|
465
|
-
</html>
|
587
|
+
</body>
|
588
|
+
</html>
|
466
589
|
OUTPUT
|
590
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
591
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
467
592
|
end
|
468
593
|
|
469
594
|
it "processes AsciiMath and MathML" do
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
595
|
+
input = <<~INPUT
|
596
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
597
|
+
<preface><foreword>
|
598
|
+
<p>
|
599
|
+
<stem type="AsciiMath"><A></stem>
|
600
|
+
<stem type="MathML"><m:math><m:row>X</m:row></m:math></stem>
|
601
|
+
<stem type="None">Latex?</stem>
|
602
|
+
</p>
|
603
|
+
</foreword></preface>
|
604
|
+
<sections>
|
605
|
+
</iso-standard>
|
481
606
|
INPUT
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
<
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
<m:
|
490
|
-
|
491
|
-
|
492
|
-
|
607
|
+
output = <<~OUTPUT
|
608
|
+
#{HTML_HDR.sub(/<html/, "<html xmlns:m='m'")}
|
609
|
+
<br/>
|
610
|
+
<div>
|
611
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
612
|
+
<p>
|
613
|
+
<span class="stem">(#(<A>)#)</span>
|
614
|
+
<span class="stem"><m:math>
|
615
|
+
<m:row>X</m:row>
|
616
|
+
</m:math></span>
|
617
|
+
<span class="stem">Latex?</span>
|
618
|
+
</p>
|
619
|
+
</div>
|
620
|
+
<p class="zzSTDTitle1"/>
|
493
621
|
</div>
|
494
|
-
|
495
|
-
|
496
|
-
</body>
|
497
|
-
</html>
|
622
|
+
</body>
|
623
|
+
</html>
|
498
624
|
OUTPUT
|
625
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
626
|
+
.convert("test", input, true).sub(/<html/, "<html xmlns:m='m'")))
|
627
|
+
.to be_equivalent_to xmlpp(output)
|
499
628
|
end
|
500
629
|
|
501
630
|
it "overrides AsciiMath delimiters" do
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
631
|
+
input = <<~INPUT
|
632
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
633
|
+
<preface><foreword>
|
634
|
+
<p>
|
635
|
+
<stem type="AsciiMath">A</stem>
|
636
|
+
(#((Hello))#)
|
637
|
+
</p>
|
638
|
+
</foreword></preface>
|
639
|
+
<sections>
|
640
|
+
</iso-standard>
|
512
641
|
INPUT
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
<
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
642
|
+
output = <<~OUTPUT
|
643
|
+
#{HTML_HDR}
|
644
|
+
<br/>
|
645
|
+
<div>
|
646
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
647
|
+
<p>
|
648
|
+
<span class="stem">(#(((A)#)))</span>
|
649
|
+
(#((Hello))#)
|
650
|
+
</p>
|
651
|
+
</div>
|
652
|
+
<p class="zzSTDTitle1"/>
|
521
653
|
</div>
|
522
|
-
|
523
|
-
|
524
|
-
</body>
|
525
|
-
</html>
|
654
|
+
</body>
|
655
|
+
</html>
|
526
656
|
OUTPUT
|
657
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
658
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
527
659
|
end
|
528
660
|
|
529
661
|
it "processes eref types" do
|
530
|
-
|
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
|
-
|
662
|
+
input = <<~INPUT
|
663
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
664
|
+
<preface><foreword>
|
665
|
+
<p>
|
666
|
+
<eref type="footnote" bibitemid="ISO712" citeas="ISO 712">A</stem>
|
667
|
+
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</stem>
|
668
|
+
</p>
|
669
|
+
</foreword></preface>
|
670
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
671
|
+
<bibitem id="ISO712" type="standard">
|
672
|
+
<title format="text/plain">Cereals and cereal products</title>
|
673
|
+
<docidentifier>ISO 712</docidentifier>
|
674
|
+
<contributor>
|
675
|
+
<role type="publisher"/>
|
676
|
+
<organization>
|
677
|
+
<abbreviation>ISO</abbreviation>
|
678
|
+
</organization>
|
679
|
+
</contributor>
|
680
|
+
</bibitem>
|
681
|
+
</references>
|
682
|
+
</bibliography>
|
683
|
+
</iso-standard>
|
552
684
|
INPUT
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
<
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
<
|
565
|
-
|
685
|
+
output = <<~OUTPUT
|
686
|
+
#{HTML_HDR}
|
687
|
+
<br/>
|
688
|
+
<div>
|
689
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
690
|
+
<p>
|
691
|
+
<sup><a href="#ISO712">A</a></sup>
|
692
|
+
<a href="#ISO712">A</a>
|
693
|
+
</p>
|
694
|
+
</div>
|
695
|
+
<p class="zzSTDTitle1"/>
|
696
|
+
<div>
|
697
|
+
<h1>Normative References</h1>
|
698
|
+
<p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
|
699
|
+
</div>
|
566
700
|
</div>
|
567
|
-
</
|
568
|
-
|
569
|
-
</html>
|
701
|
+
</body>
|
702
|
+
</html>
|
570
703
|
OUTPUT
|
704
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
705
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
571
706
|
end
|
572
707
|
|
573
708
|
it "processes eref content" do
|
574
709
|
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
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
</
|
606
|
-
|
607
|
-
|
608
|
-
|
710
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
711
|
+
<preface><foreword>
|
712
|
+
<p>
|
713
|
+
<eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
|
714
|
+
<eref type="inline" bibitemid="ISO712"/>
|
715
|
+
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
716
|
+
<eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
|
717
|
+
<eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
|
718
|
+
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
|
719
|
+
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
720
|
+
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
721
|
+
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
|
722
|
+
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
723
|
+
<eref type="inline" bibitemid="ISO712"><locality type="whole"></locality></eref>
|
724
|
+
<eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
|
725
|
+
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
|
726
|
+
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality></eref>
|
727
|
+
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
728
|
+
<eref type="inline" droploc="true" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
729
|
+
<eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
730
|
+
</p>
|
731
|
+
</foreword></preface>
|
732
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
733
|
+
<bibitem id="ISO712" type="standard">
|
734
|
+
<title format="text/plain">Cereals and cereal products</title>
|
735
|
+
<docidentifier>ISO 712</docidentifier>
|
736
|
+
<contributor>
|
737
|
+
<role type="publisher"/>
|
738
|
+
<organization>
|
739
|
+
<abbreviation>ISO</abbreviation>
|
740
|
+
</organization>
|
741
|
+
</contributor>
|
742
|
+
</bibitem>
|
743
|
+
</references>
|
744
|
+
</bibliography>
|
745
|
+
</iso-standard>
|
609
746
|
INPUT
|
610
747
|
presxml = <<~OUTPUT
|
611
|
-
|
612
|
-
|
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
|
-
|
748
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
749
|
+
<preface><foreword>
|
750
|
+
<p>
|
751
|
+
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
|
752
|
+
<eref type="inline" bibitemid="ISO712">ISO 712</eref>
|
753
|
+
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Table 1</eref>
|
754
|
+
<eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
|
755
|
+
<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>
|
756
|
+
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Table 1–1</eref>
|
757
|
+
<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>
|
758
|
+
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
|
759
|
+
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality>ISO 712, Clause 1.5</eref>
|
760
|
+
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
761
|
+
<eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
|
762
|
+
<eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
|
763
|
+
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
|
764
|
+
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
|
765
|
+
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
|
766
|
+
<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>
|
767
|
+
<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>
|
768
|
+
</p>
|
769
|
+
</foreword></preface>
|
770
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title depth='1'>1.<tab/>Normative References</title>
|
771
|
+
<bibitem id="ISO712" type="standard">
|
772
|
+
<title format="text/plain">Cereals and cereal products</title>
|
773
|
+
<docidentifier>ISO 712</docidentifier>
|
774
|
+
<contributor>
|
775
|
+
<role type="publisher"/>
|
776
|
+
<organization>
|
777
|
+
<abbreviation>ISO</abbreviation>
|
778
|
+
</organization>
|
779
|
+
</contributor>
|
780
|
+
</bibitem>
|
781
|
+
</references>
|
782
|
+
</bibliography>
|
783
|
+
</iso-standard>
|
784
|
+
OUTPUT
|
646
785
|
|
647
|
-
html = <<~OUTPUT
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
<a href='#ISO712'>ISO 712, Table 1; Clause 1</a>
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
786
|
+
html = <<~OUTPUT
|
787
|
+
#{HTML_HDR}
|
788
|
+
<br/>
|
789
|
+
<div>
|
790
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
791
|
+
<p>
|
792
|
+
<a href="#ISO712">ISO 712</a>
|
793
|
+
<a href="#ISO712">ISO 712</a>
|
794
|
+
<a href="#ISO712">ISO 712, Table 1</a>
|
795
|
+
<a href='#ISO712'>ISO 712, Table 1</a>
|
796
|
+
<a href='#ISO712'>ISO 712, Table 1; Clause 1</a>
|
797
|
+
<a href="#ISO712">ISO 712, Table 1–1</a>
|
798
|
+
<a href="#ISO712">ISO 712, Clause 1, Table 1</a>
|
799
|
+
<a href="#ISO712">ISO 712, Clause 1</a>
|
800
|
+
<a href="#ISO712">ISO 712, Clause 1.5</a>
|
801
|
+
<a href="#ISO712">A</a>
|
802
|
+
<a href="#ISO712">ISO 712, Whole of text</a>
|
803
|
+
<a href="#ISO712">ISO 712, Prelude 7</a>
|
804
|
+
<a href="#ISO712">A</a>
|
805
|
+
<a href='#ISO712'>ISO 712</a>
|
806
|
+
<a href='#ISO712'>ISO 712, Clause 1</a>
|
807
|
+
<a href='#ISO712'>ISO 712, 1</a>
|
808
|
+
<a href='#ISO712'>ISO 712, clause 1</a>
|
809
|
+
</p>
|
810
|
+
</div>
|
811
|
+
<p class="zzSTDTitle1"/>
|
812
|
+
<div>
|
813
|
+
<h1>1.  Normative References</h1>
|
814
|
+
<p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
|
815
|
+
</div>
|
816
|
+
</div>
|
817
|
+
</body>
|
818
|
+
</html>
|
678
819
|
OUTPUT
|
679
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
680
|
-
|
820
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
821
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
822
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
823
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
681
824
|
end
|
682
825
|
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
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
|
-
|
826
|
+
it "processes eref content pointing to reference with citation URL" do
|
827
|
+
input = <<~INPUT
|
828
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
829
|
+
<preface><foreword>
|
830
|
+
<p>
|
831
|
+
<eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
|
832
|
+
<eref type="inline" bibitemid="ISO712"/>
|
833
|
+
<eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
834
|
+
<eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
|
835
|
+
<eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
|
836
|
+
<eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
|
837
|
+
<eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
838
|
+
<eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
839
|
+
<eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
|
840
|
+
<eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
841
|
+
<eref type="inline" bibitemid="ISO713"><locality type="whole"></locality></eref>
|
842
|
+
<eref type="inline" bibitemid="ISO713"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
|
843
|
+
<eref type="inline" bibitemid="ISO713" citeas="ISO 713">A</eref>
|
844
|
+
<eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality></eref>
|
845
|
+
<eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
846
|
+
<eref type="inline" bibitemid="ISO714"/>
|
847
|
+
</p>
|
848
|
+
</foreword></preface>
|
849
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
850
|
+
<bibitem id="ISO712" type="standard">
|
851
|
+
<title format="text/plain">Cereals and cereal products</title>
|
852
|
+
<uri type="citation">http://www.example.com</uri>
|
853
|
+
<docidentifier>ISO 712</docidentifier>
|
854
|
+
<contributor>
|
855
|
+
<role type="publisher"/>
|
856
|
+
<organization>
|
857
|
+
<abbreviation>ISO</abbreviation>
|
858
|
+
</organization>
|
859
|
+
</contributor>
|
860
|
+
</bibitem>
|
861
|
+
<bibitem id="ISO713" type="standard">
|
862
|
+
<title format="text/plain">Cereals and cereal products</title>
|
863
|
+
<uri type="citation">spec/assets/iso713</uri>
|
864
|
+
<docidentifier>ISO 713</docidentifier>
|
865
|
+
<contributor>
|
866
|
+
<role type="publisher"/>
|
867
|
+
<organization>
|
868
|
+
<abbreviation>ISO</abbreviation>
|
869
|
+
</organization>
|
870
|
+
</contributor>
|
871
|
+
</bibitem>
|
872
|
+
<bibitem id="ISO714" type="standard">
|
873
|
+
<title format="text/plain">Cereals and cereal products</title>
|
874
|
+
<uri type="citation">spec/assets/iso714.svg</uri>
|
875
|
+
<docidentifier>ISO 714</docidentifier>
|
876
|
+
<contributor>
|
877
|
+
<role type="publisher"/>
|
878
|
+
<organization>
|
879
|
+
<abbreviation>ISO</abbreviation>
|
880
|
+
</organization>
|
881
|
+
</contributor>
|
882
|
+
</bibitem>
|
883
|
+
</references>
|
884
|
+
</bibliography>
|
885
|
+
</iso-standard>
|
731
886
|
INPUT
|
732
887
|
presxml = <<~OUTPUT
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
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
|
-
|
888
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
889
|
+
<preface>
|
890
|
+
<foreword>
|
891
|
+
<p>
|
892
|
+
<eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
|
893
|
+
<eref type='inline' bibitemid='ISO712'>ISO 712</eref>
|
894
|
+
<eref type='inline' bibitemid='ISO713'><locality type='table'>
|
895
|
+
<referenceFrom>1</referenceFrom>
|
896
|
+
</locality>ISO 713, Table 1</eref>
|
897
|
+
<eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1</eref>
|
898
|
+
<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>
|
899
|
+
<eref type='inline' bibitemid='ISO713'><locality type='table'>
|
900
|
+
<referenceFrom>1</referenceFrom>
|
901
|
+
<referenceTo>1</referenceTo>
|
902
|
+
</locality>ISO 713, Table 1–1</eref>
|
903
|
+
<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>
|
904
|
+
<eref type='inline' bibitemid='ISO713'><locality type='clause'>
|
905
|
+
<referenceFrom>1</referenceFrom>
|
906
|
+
</locality>ISO 713, Clause 1</eref>
|
907
|
+
<eref type='inline' bibitemid='ISO713'><locality type='clause'>
|
908
|
+
<referenceFrom>1.5</referenceFrom>
|
909
|
+
</locality>ISO 713, Clause 1.5</eref>
|
910
|
+
<eref type='inline' bibitemid='ISO713'><locality type='table'>
|
911
|
+
<referenceFrom>1</referenceFrom>
|
912
|
+
</locality>A</eref>
|
913
|
+
<eref type='inline' bibitemid='ISO713'><locality type='whole'/>ISO 713, Whole of text</eref>
|
914
|
+
<eref type='inline' bibitemid='ISO713'><locality type='locality:prelude'>
|
915
|
+
<referenceFrom>7</referenceFrom>
|
916
|
+
</locality>ISO 713, Prelude 7</eref>
|
917
|
+
<eref type='inline' bibitemid='ISO713' citeas='ISO 713'>A</eref>
|
918
|
+
<eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality>ISO 713</eref>
|
919
|
+
<eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality><locality type='clause'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1</eref>
|
920
|
+
<eref type='inline' bibitemid='ISO714'>ISO 714</eref>
|
921
|
+
</p>
|
922
|
+
</foreword>
|
923
|
+
</preface>
|
924
|
+
<bibliography>
|
925
|
+
<references id='_normative_references' obligation='informative' normative='true'>
|
926
|
+
<title depth='1'>1.<tab/>Normative References</title>
|
927
|
+
<bibitem id='ISO712' type='standard'>
|
928
|
+
<title format='text/plain'>Cereals and cereal products</title>
|
929
|
+
<uri type='citation'>http://www.example.com</uri>
|
930
|
+
<docidentifier>ISO 712</docidentifier>
|
931
|
+
<contributor>
|
932
|
+
<role type='publisher'/>
|
933
|
+
<organization>
|
934
|
+
<abbreviation>ISO</abbreviation>
|
935
|
+
</organization>
|
936
|
+
</contributor>
|
937
|
+
</bibitem>
|
938
|
+
<bibitem id='ISO713' type='standard'>
|
939
|
+
<title format='text/plain'>Cereals and cereal products</title>
|
940
|
+
<uri type='citation'>spec/assets/iso713</uri>
|
941
|
+
<docidentifier>ISO 713</docidentifier>
|
942
|
+
<contributor>
|
943
|
+
<role type='publisher'/>
|
944
|
+
<organization>
|
945
|
+
<abbreviation>ISO</abbreviation>
|
946
|
+
</organization>
|
947
|
+
</contributor>
|
948
|
+
</bibitem>
|
949
|
+
<bibitem id='ISO714' type='standard'>
|
772
950
|
<title format='text/plain'>Cereals and cereal products</title>
|
773
|
-
<uri type='citation'>
|
774
|
-
<docidentifier>ISO
|
951
|
+
<uri type='citation'>spec/assets/iso714.svg</uri>
|
952
|
+
<docidentifier>ISO 714</docidentifier>
|
775
953
|
<contributor>
|
776
954
|
<role type='publisher'/>
|
777
955
|
<organization>
|
@@ -779,242 +957,281 @@ html = <<~OUTPUT
|
|
779
957
|
</organization>
|
780
958
|
</contributor>
|
781
959
|
</bibitem>
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
<contributor>
|
787
|
-
<role type='publisher'/>
|
788
|
-
<organization>
|
789
|
-
<abbreviation>ISO</abbreviation>
|
790
|
-
</organization>
|
791
|
-
</contributor>
|
792
|
-
</bibitem>
|
793
|
-
</references>
|
794
|
-
</bibliography>
|
795
|
-
</iso-standard>
|
796
|
-
OUTPUT
|
960
|
+
</references>
|
961
|
+
</bibliography>
|
962
|
+
</iso-standard>
|
963
|
+
OUTPUT
|
797
964
|
|
798
965
|
html = <<~OUTPUT
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
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
|
-
</div>
|
833
|
-
</div>
|
834
|
-
</body>
|
835
|
-
</html>
|
836
|
-
OUTPUT
|
837
|
-
|
838
|
-
word = <<~OUTPUT
|
839
|
-
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
|
840
|
-
<head>
|
841
|
-
<style>
|
842
|
-
</style>
|
843
|
-
</head>
|
844
|
-
<body lang='EN-US' link='blue' vlink='#954F72'>
|
845
|
-
<div class='WordSection1'>
|
846
|
-
<p> </p>
|
847
|
-
</div>
|
848
|
-
<p>
|
849
|
-
<br clear='all' class='section'/>
|
850
|
-
</p>
|
851
|
-
<div class='WordSection2'>
|
852
|
-
<p>
|
853
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
966
|
+
#{HTML_HDR}
|
967
|
+
<br/>
|
968
|
+
<div>
|
969
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
970
|
+
<p>
|
971
|
+
<a href='http://www.example.com'>ISO 712</a>
|
972
|
+
<a href='http://www.example.com'>ISO 712</a>
|
973
|
+
<a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
|
974
|
+
<a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
|
975
|
+
<a href='spec/assets/iso713.html'>ISO 713, Table 1; Clause 1</a>
|
976
|
+
<a href='spec/assets/iso713.html'>ISO 713, Table 1–1</a>
|
977
|
+
<a href='spec/assets/iso713.html'>ISO 713, Clause 1, Table 1</a>
|
978
|
+
<a href='spec/assets/iso713.html'>ISO 713, Clause 1</a>
|
979
|
+
<a href='spec/assets/iso713.html'>ISO 713, Clause 1.5</a>
|
980
|
+
<a href='spec/assets/iso713.html'>A</a>
|
981
|
+
<a href='spec/assets/iso713.html'>ISO 713, Whole of text</a>
|
982
|
+
<a href='spec/assets/iso713.html'>ISO 713, Prelude 7</a>
|
983
|
+
<a href='spec/assets/iso713.html'>A</a>
|
984
|
+
<a href='spec/assets/iso713.html#xyz'>ISO 713</a>
|
985
|
+
<a href='spec/assets/iso713.html#xyz'>ISO 713, Clause 1</a>
|
986
|
+
<a href='spec/assets/iso714.svg'>ISO 714</a>
|
987
|
+
</p>
|
988
|
+
</div>
|
989
|
+
<p class='zzSTDTitle1'/>
|
990
|
+
<div>
|
991
|
+
<h1>1.  Normative References</h1>
|
992
|
+
<p id='ISO712' class='NormRef'>
|
993
|
+
ISO 712,
|
994
|
+
<i>Cereals and cereal products</i>
|
995
|
+
</p>
|
996
|
+
<p id='ISO713' class='NormRef'>
|
997
|
+
ISO 713,
|
998
|
+
<i>Cereals and cereal products</i>
|
854
999
|
</p>
|
855
|
-
<
|
856
|
-
|
857
|
-
<
|
858
|
-
<a href='http://www.example.com'>ISO 712</a>
|
859
|
-
<a href='http://www.example.com'>ISO 712</a>
|
860
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
|
861
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
|
862
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Table 1; Clause 1</a>
|
863
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Table 1–1</a>
|
864
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Clause 1, Table 1</a>
|
865
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Clause 1</a>
|
866
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Clause 1.5</a>
|
867
|
-
<a href='spec/assets/iso713.doc'>A</a>
|
868
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Whole of text</a>
|
869
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Prelude 7</a>
|
870
|
-
<a href='spec/assets/iso713.doc'>A</a>
|
871
|
-
<a href='spec/assets/iso713.doc#xyz'>ISO 713</a>
|
872
|
-
<a href='spec/assets/iso713.doc#xyz'>ISO 713, Clause 1</a>
|
1000
|
+
<p id='ISO714' class='NormRef'>
|
1001
|
+
ISO 714,
|
1002
|
+
<i>Cereals and cereal products</i>
|
873
1003
|
</p>
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
</p>
|
880
|
-
<div class='WordSection3'>
|
881
|
-
<p class='zzSTDTitle1'/>
|
882
|
-
<div>
|
883
|
-
<h1>
|
884
|
-
1.
|
885
|
-
<span style='mso-tab-count:1'>  </span>
|
886
|
-
Normative References
|
887
|
-
</h1>
|
888
|
-
<p id='ISO712' class='NormRef'>
|
889
|
-
ISO 712,
|
890
|
-
<i>Cereals and cereal products</i>
|
891
|
-
</p>
|
892
|
-
<p id='ISO713' class='NormRef'>
|
893
|
-
ISO 713,
|
894
|
-
<i>Cereals and cereal products</i>
|
895
|
-
</p>
|
896
|
-
</div>
|
897
|
-
</div>
|
898
|
-
</body>
|
899
|
-
</html>
|
1004
|
+
</div>
|
1005
|
+
</div>
|
1006
|
+
</body>
|
1007
|
+
</html>
|
1008
|
+
OUTPUT
|
900
1009
|
|
901
|
-
OUTPUT
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
1010
|
+
word = <<~OUTPUT
|
1011
|
+
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
|
1012
|
+
<head>
|
1013
|
+
<style>
|
1014
|
+
</style>
|
1015
|
+
</head>
|
1016
|
+
<body lang='EN-US' link='blue' vlink='#954F72'>
|
1017
|
+
<div class='WordSection1'>
|
1018
|
+
<p> </p>
|
1019
|
+
</div>
|
1020
|
+
<p>
|
1021
|
+
<br clear='all' class='section'/>
|
1022
|
+
</p>
|
1023
|
+
<div class='WordSection2'>
|
1024
|
+
<p>
|
1025
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1026
|
+
</p>
|
1027
|
+
<div>
|
1028
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
1029
|
+
<p>
|
1030
|
+
<a href='http://www.example.com'>ISO 712</a>
|
1031
|
+
<a href='http://www.example.com'>ISO 712</a>
|
1032
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
|
1033
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
|
1034
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Table 1; Clause 1</a>
|
1035
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Table 1–1</a>
|
1036
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Clause 1, Table 1</a>
|
1037
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Clause 1</a>
|
1038
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Clause 1.5</a>
|
1039
|
+
<a href='spec/assets/iso713.doc'>A</a>
|
1040
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Whole of text</a>
|
1041
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Prelude 7</a>
|
1042
|
+
<a href='spec/assets/iso713.doc'>A</a>
|
1043
|
+
<a href='spec/assets/iso713.doc#xyz'>ISO 713</a>
|
1044
|
+
<a href='spec/assets/iso713.doc#xyz'>ISO 713, Clause 1</a>
|
1045
|
+
<a href='spec/assets/iso714.svg'>ISO 714</a>
|
1046
|
+
</p>
|
1047
|
+
</div>
|
1048
|
+
<p> </p>
|
1049
|
+
</div>
|
1050
|
+
<p>
|
1051
|
+
<br clear='all' class='section'/>
|
1052
|
+
</p>
|
1053
|
+
<div class='WordSection3'>
|
1054
|
+
<p class='zzSTDTitle1'/>
|
1055
|
+
<div>
|
1056
|
+
<h1>
|
1057
|
+
1.
|
1058
|
+
<span style='mso-tab-count:1'>  </span>
|
1059
|
+
Normative References
|
1060
|
+
</h1>
|
1061
|
+
<p id='ISO712' class='NormRef'>
|
1062
|
+
ISO 712,
|
1063
|
+
<i>Cereals and cereal products</i>
|
1064
|
+
</p>
|
1065
|
+
<p id='ISO713' class='NormRef'>
|
1066
|
+
ISO 713,
|
1067
|
+
<i>Cereals and cereal products</i>
|
1068
|
+
</p>
|
1069
|
+
<p id='ISO714' class='NormRef'>
|
1070
|
+
ISO 714,
|
1071
|
+
<i>Cereals and cereal products</i>
|
1072
|
+
</p>
|
1073
|
+
</div>
|
1074
|
+
</div>
|
1075
|
+
</body>
|
1076
|
+
</html>
|
1077
|
+
OUTPUT
|
1078
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1079
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
1080
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
1081
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
1082
|
+
expect(xmlpp(IsoDoc::WordConvert.new({})
|
1083
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
|
1084
|
+
end
|
906
1085
|
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
1086
|
+
it "processes variant" do
|
1087
|
+
input = <<~INPUT
|
1088
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1089
|
+
<bibdata>
|
1090
|
+
<language>en</language>
|
1091
|
+
<script>Latn</script>
|
1092
|
+
</bibdata>
|
1093
|
+
<preface>
|
1094
|
+
<clause id="A"><title><variant lang="en" script="Latn">ABC</variant><variant lang="fr" script="Latn">DEF</variant></title></clause>
|
1095
|
+
<clause id="A1"><title><variant lang="en" script="Grek">ABC</variant><variant lang="fr" script="Grek">DEF</variant></title></clause>
|
1096
|
+
<clause id="A2"><title><variant lang="en">ABC</variant><variant lang="fr">DEF</variant></title></clause>
|
1097
|
+
<clause id="B"><title><variant lang="de" script="Latn">GHI</variant><variant lang="es" script="Latn">JKL</variant></title></clause>
|
1098
|
+
<clause id="C"><title><variant lang="fr" script="Latn">ABC</variant><variant lang="en" script="Latn">DEF</variant></title></clause>
|
1099
|
+
<clause id="C1"><title><variant lang="fr" script="Grek">ABC</variant><variant lang="en" script="Grek">DEF</variant></title></clause>
|
1100
|
+
<clause id="C2"><title><variant lang="fr">ABC</variant><variant lang="en">DEF</variant></title></clause>
|
1101
|
+
<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>
|
1102
|
+
</preface>
|
1103
|
+
</iso-standard>
|
925
1104
|
INPUT
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
</
|
1105
|
+
output = <<~OUTPUT
|
1106
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1107
|
+
<bibdata>
|
1108
|
+
<language current='true'>en</language>
|
1109
|
+
<script current='true'>Latn</script>
|
1110
|
+
</bibdata>
|
1111
|
+
<preface>
|
1112
|
+
<clause id='A'>
|
1113
|
+
<title depth='1'>ABC</title>
|
1114
|
+
</clause>
|
1115
|
+
<clause id='A1'>
|
1116
|
+
<title depth='1'>ABC/DEF</title>
|
1117
|
+
</clause>
|
1118
|
+
<clause id='A2'>
|
1119
|
+
<title depth='1'>ABC</title>
|
1120
|
+
</clause>
|
1121
|
+
<clause id='B'>
|
1122
|
+
<title depth='1'>GHI/JKL</title>
|
1123
|
+
</clause>
|
1124
|
+
<clause id='C'>
|
1125
|
+
<title depth='1'>DEF</title>
|
1126
|
+
</clause>
|
1127
|
+
<clause id='C1'>
|
1128
|
+
<title depth='1'>ABC/DEF</title>
|
1129
|
+
</clause>
|
1130
|
+
<clause id='C2'>
|
1131
|
+
<title depth='1'>DEF</title>
|
1132
|
+
</clause>
|
1133
|
+
<p>A B D E</p>
|
1134
|
+
</preface>
|
1135
|
+
</iso-standard>
|
956
1136
|
OUTPUT
|
957
|
-
|
1137
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1138
|
+
.convert("test", input, true)
|
1139
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, "")))
|
1140
|
+
.to be_equivalent_to xmlpp(output)
|
1141
|
+
end
|
958
1142
|
|
959
|
-
it "cases xrefs" do
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
</clause>
|
975
|
-
</sections>
|
976
|
-
</iso-standard>
|
977
|
-
INPUT
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
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
|
-
|
1143
|
+
it "cases xrefs" do
|
1144
|
+
input = <<~INPUT
|
1145
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1146
|
+
<sections>
|
1147
|
+
<clause id="A">
|
1148
|
+
<table id="B">
|
1149
|
+
</table>
|
1150
|
+
</clause>
|
1151
|
+
<clause id="C">
|
1152
|
+
<p>This is <xref target="A"/> and <xref target="B"/>.
|
1153
|
+
This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
|
1154
|
+
This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
|
1155
|
+
<xref target="A"/> is clause <em>initial.</em><br/>
|
1156
|
+
<xref target="A"/> is too. </p>
|
1157
|
+
<p><xref target="A"/> is also.</p>
|
1158
|
+
</clause>
|
1159
|
+
</sections>
|
1160
|
+
</iso-standard>
|
1161
|
+
INPUT
|
1162
|
+
output = <<~OUTPUT
|
1163
|
+
<?xml version='1.0'?>
|
1164
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
1165
|
+
<sections>
|
1166
|
+
<clause id='A'>
|
1167
|
+
<title>1.</title>
|
1168
|
+
<table id='B'>
|
1169
|
+
<name>Tabelo 1</name>
|
1170
|
+
</table>
|
1171
|
+
</clause>
|
1172
|
+
<clause id='C'>
|
1173
|
+
<title>2.</title>
|
1174
|
+
<p>
|
1175
|
+
This is
|
1176
|
+
<xref target='A'>klaŭzo 1</xref>
|
1177
|
+
and
|
1178
|
+
<xref target='B'>tabelo 1</xref>
|
1179
|
+
. This is
|
1180
|
+
<xref target='A' case='capital'>Klaŭzo 1</xref>
|
1181
|
+
and
|
1182
|
+
<xref target='B' case='lowercase'>tabelo 1</xref>
|
1183
|
+
. This is
|
1184
|
+
<xref target='A' case='lowercase'>klaŭzo 1</xref>
|
1185
|
+
and
|
1186
|
+
<xref target='B' case='capital'>Tabelo 1</xref>
|
1187
|
+
.
|
1188
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1189
|
+
is clause
|
1190
|
+
<em>initial.</em>
|
1191
|
+
<br/>
|
1192
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1193
|
+
is too.
|
1194
|
+
</p>
|
1195
|
+
<p>
|
1196
|
+
<xref target='A'>Klaŭzo 1</xref>
|
1197
|
+
is also.
|
1198
|
+
</p>
|
1199
|
+
</clause>
|
1200
|
+
</sections>
|
1201
|
+
</iso-standard>
|
1202
|
+
OUTPUT
|
1203
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
1204
|
+
.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
1205
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1206
|
+
end
|
1019
1207
|
|
1208
|
+
it "processes add, del" do
|
1209
|
+
input = <<~INPUT
|
1210
|
+
<itu-standard xmlns="https://www.calconnect.org/standards/itu">
|
1211
|
+
<preface><foreword id="A">
|
1212
|
+
<add>ABC <xref target="A"></add> <del><strong>B</strong></del>
|
1213
|
+
</foreword></preface>
|
1214
|
+
</itu-standard>
|
1215
|
+
INPUT
|
1216
|
+
output = <<~OUTPUT
|
1217
|
+
#{HTML_HDR}
|
1218
|
+
<br/>
|
1219
|
+
<div id='A'>
|
1220
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
1221
|
+
<span class='addition'>
|
1222
|
+
ABC
|
1223
|
+
<a href='#A'/>
|
1224
|
+
<span class='deletion'>
|
1225
|
+
<b>B</b>
|
1226
|
+
</span>
|
1227
|
+
</span>
|
1228
|
+
</div>
|
1229
|
+
<p class='zzSTDTitle1'/>
|
1230
|
+
</div>
|
1231
|
+
</body>
|
1232
|
+
</html>
|
1233
|
+
OUTPUT
|
1234
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
1235
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1236
|
+
end
|
1020
1237
|
end
|