isodoc 1.6.7.1 → 1.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +1 -1
- data/lib/isodoc-yaml/i18n-ar.yaml +19 -25
- data/lib/isodoc-yaml/i18n-de.yaml +1 -0
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-es.yaml +1 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +1 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc.rb +1 -0
- data/lib/isodoc/convert.rb +1 -1
- data/lib/isodoc/css.rb +3 -3
- data/lib/isodoc/function/blocks.rb +180 -168
- data/lib/isodoc/function/form.rb +39 -36
- data/lib/isodoc/function/inline.rb +5 -1
- data/lib/isodoc/function/reqt.rb +91 -85
- data/lib/isodoc/function/to_word_html.rb +207 -204
- data/lib/isodoc/html_convert.rb +0 -4
- data/lib/isodoc/html_function/form.rb +48 -45
- data/lib/isodoc/html_function/html.rb +2 -0
- data/lib/isodoc/html_function/postprocess.rb +9 -4
- data/lib/isodoc/presentation_function/block.rb +7 -4
- data/lib/isodoc/presentation_function/inline.rb +29 -12
- data/lib/isodoc/presentation_function/section.rb +1 -2
- data/lib/isodoc/presentation_xml_convert.rb +2 -2
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref.rb +8 -7
- data/lib/isodoc/xref/xref_anchor.rb +45 -44
- data/lib/isodoc/xref/xref_counter.rb +113 -103
- data/lib/isodoc/xref/xref_gen.rb +39 -11
- data/lib/metanorma/output.rb +7 -0
- data/lib/metanorma/output/base.rb +13 -0
- data/lib/metanorma/output/utils.rb +17 -0
- data/lib/metanorma/output/xslfo.rb +21 -0
- data/spec/assets/outputtest/a.xml +66 -0
- data/spec/assets/outputtest/iso.international-standard.xsl +3011 -0
- data/spec/isodoc/blocks_spec.rb +358 -243
- data/spec/isodoc/form_spec.rb +94 -90
- data/spec/isodoc/inline_spec.rb +413 -234
- data/spec/isodoc/postproc_spec.rb +70 -27
- data/spec/isodoc/terms_spec.rb +2 -2
- data/spec/isodoc/xref_spec.rb +274 -652
- metadata +8 -18
- data/lib/isodoc/html_function/sectionsplit.rb +0 -230
- data/spec/isodoc/sectionsplit_spec.rb +0 -190
data/spec/isodoc/form_spec.rb
CHANGED
@@ -6,7 +6,7 @@ RSpec.describe IsoDoc do
|
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<sections>
|
8
8
|
<clause id="A">
|
9
|
-
<form action="/action_page.php" id="F0" name="F1">
|
9
|
+
<form action="/action_page.php" id="F0" name="F1" class="C">
|
10
10
|
<label for="fname">First name:</label><br/>
|
11
11
|
<input type="text" id="fname" name="fname"/><br/>
|
12
12
|
<label for="lname">Last name:</label><br/>
|
@@ -46,111 +46,115 @@ RSpec.describe IsoDoc do
|
|
46
46
|
INPUT
|
47
47
|
|
48
48
|
html = <<~HTML
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
#{HTML_HDR}
|
50
|
+
<p class='zzSTDTitle1'/>
|
51
|
+
<div id='A'>
|
52
|
+
<h1/>
|
53
|
+
<form id='F0' name='F1' action='/action_page.php' class="C">
|
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
|
+
<div class="C" id="F0">
|
113
|
+
First name:
|
55
114
|
<br/>
|
56
|
-
|
115
|
+
__________
|
57
116
|
<br/>
|
58
|
-
|
117
|
+
Last name:
|
59
118
|
<br/>
|
60
|
-
|
119
|
+
__________
|
61
120
|
<br/>
|
62
|
-
|
121
|
+
Password:
|
63
122
|
<br/>
|
64
|
-
|
123
|
+
__________
|
65
124
|
<br/>
|
66
|
-
|
67
|
-
<label for='male'>Male</label>
|
125
|
+
◎ Male
|
68
126
|
<br/>
|
69
|
-
|
70
|
-
<label for='female'>Female</label>
|
127
|
+
◎ Female
|
71
128
|
<br/>
|
72
|
-
|
73
|
-
<label for='other'>Other</label>
|
129
|
+
◎ Other
|
74
130
|
<br/>
|
75
|
-
|
76
|
-
<label for='vehicle1'> I have a bike</label>
|
131
|
+
☐ I have a bike
|
77
132
|
<br/>
|
78
|
-
|
79
|
-
<label for='vehicle2'> I have a car</label>
|
133
|
+
☐ I have a car
|
80
134
|
<br/>
|
81
|
-
|
82
|
-
<label for='vehicle3'> I have a boat</label>
|
135
|
+
☐ I have a boat
|
83
136
|
<br/>
|
84
|
-
|
137
|
+
__________
|
85
138
|
<br/>
|
86
|
-
|
87
|
-
<input id='myfile' name='myfile' type='file'/>
|
139
|
+
Select a file: __________
|
88
140
|
<br/>
|
89
|
-
|
90
|
-
<
|
91
|
-
<
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
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]
|
141
|
+
Select a car: __________
|
142
|
+
<table border='1' width='50%'>
|
143
|
+
<tr>
|
144
|
+
<td/>
|
145
|
+
</tr>
|
146
|
+
</table>
|
147
|
+
[Click Me!] [BUTTON]
|
148
|
+
</div>
|
149
|
+
</div>
|
147
150
|
</div>
|
148
|
-
</
|
149
|
-
</
|
150
|
-
</html>
|
151
|
+
</body>
|
152
|
+
</html>
|
151
153
|
DOC
|
152
154
|
|
153
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
154
|
-
|
155
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
156
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(html)
|
157
|
+
expect(xmlpp(IsoDoc::WordConvert.new({})
|
158
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(doc)
|
155
159
|
end
|
156
160
|
end
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -139,19 +139,28 @@ RSpec.describe IsoDoc do
|
|
139
139
|
<preface><foreword>
|
140
140
|
<p>
|
141
141
|
<ul>
|
142
|
-
<li
|
142
|
+
<li>
|
143
|
+
<concept><refterm>term</refterm>
|
143
144
|
<xref target='clause1'/>
|
144
145
|
</concept></li>
|
145
|
-
|
146
|
-
<
|
146
|
+
<li><concept><refterm>term</refterm>
|
147
|
+
<renderterm>term</renderterm>
|
148
|
+
<xref target='clause1'/>
|
149
|
+
</concept></li>
|
150
|
+
<li><concept><refterm>term</refterm>
|
151
|
+
<renderterm>w[o]rd</renderterm>
|
152
|
+
<xref target='clause1'>Clause #1</xref>
|
147
153
|
</concept></li>
|
148
|
-
<li><concept
|
154
|
+
<li><concept><refterm>term</refterm>
|
155
|
+
<renderterm>term</renderterm>
|
149
156
|
<eref bibitemid="ISO712" type="inline" citeas="ISO 712"/>
|
150
157
|
</concept></li>
|
151
|
-
<li><concept
|
152
|
-
<
|
158
|
+
<li><concept><refterm>term</refterm>
|
159
|
+
<renderterm>word</renderterm>
|
160
|
+
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">The Aforementioned Citation</eref>
|
153
161
|
</concept></li>
|
154
|
-
<li><concept>
|
162
|
+
<li><concept><refterm>term</refterm>
|
163
|
+
<renderterm>word</renderterm>
|
155
164
|
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
156
165
|
<locality type='clause'>
|
157
166
|
<referenceFrom>3.1</referenceFrom>
|
@@ -161,7 +170,8 @@ RSpec.describe IsoDoc do
|
|
161
170
|
</locality>
|
162
171
|
</eref>
|
163
172
|
</concept></li>
|
164
|
-
<li><concept>
|
173
|
+
<li><concept><refterm>term</refterm>
|
174
|
+
<renderterm>word</renderterm>
|
165
175
|
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
166
176
|
<localityStack>
|
167
177
|
<locality type='clause'>
|
@@ -175,7 +185,8 @@ RSpec.describe IsoDoc do
|
|
175
185
|
</localityStack>
|
176
186
|
</eref>
|
177
187
|
</concept></li>
|
178
|
-
<li><concept>
|
188
|
+
<li><concept><refterm>term</refterm>
|
189
|
+
<renderterm>word</renderterm>
|
179
190
|
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
180
191
|
<localityStack>
|
181
192
|
<locality type='clause'>
|
@@ -187,15 +198,22 @@ RSpec.describe IsoDoc do
|
|
187
198
|
<referenceFrom>b</referenceFrom>
|
188
199
|
</locality>
|
189
200
|
</localityStack>
|
190
|
-
|
201
|
+
The Aforementioned Citation
|
191
202
|
</eref>
|
192
203
|
</concept></li>
|
193
|
-
<li><concept
|
204
|
+
<li><concept><refterm>term</refterm>
|
205
|
+
<renderterm>word</renderterm>
|
194
206
|
<termref base='IEV' target='135-13-13'/>
|
195
207
|
</concept></li>
|
196
|
-
<li><concept
|
197
|
-
<
|
208
|
+
<li><concept><refterm>term</refterm>
|
209
|
+
<renderterm>word</renderterm>
|
210
|
+
<termref base='IEV' target='135-13-13'>The IEV database</termref>
|
198
211
|
</concept></li>
|
212
|
+
<li><concept><refterm>term</refterm>
|
213
|
+
<renderterm>word</renderterm>
|
214
|
+
<strong>error!</strong>
|
215
|
+
</concept>
|
216
|
+
</li>
|
199
217
|
</ul>
|
200
218
|
</p>
|
201
219
|
</foreword></preface>
|
@@ -219,190 +237,159 @@ RSpec.describe IsoDoc do
|
|
219
237
|
</iso-standard>
|
220
238
|
INPUT
|
221
239
|
presxml = <<~OUTPUT
|
222
|
-
|
223
|
-
<preface>
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
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
|
-
</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>
|
240
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
241
|
+
<preface><foreword displayorder="1">
|
242
|
+
<p>
|
243
|
+
<ul>
|
244
|
+
<li>
|
245
|
+
[term defined in <xref target="clause1">Clause 2</xref>]
|
246
|
+
</li>
|
247
|
+
<li>
|
248
|
+
<em>term</em> [term defined in <xref target="clause1">Clause 2</xref>]
|
249
|
+
</li>
|
250
|
+
<li>
|
251
|
+
<em>w[o]rd</em> [<xref target="clause1">Clause #1</xref>]
|
252
|
+
</li>
|
253
|
+
<li>
|
254
|
+
<em>term</em> [term defined in <eref bibitemid="ISO712" type="inline" citeas="ISO 712">ISO 712</eref>]
|
255
|
+
</li>
|
256
|
+
<li>
|
257
|
+
<em>word</em> [<eref bibitemid="ISO712" type="inline" citeas="ISO 712">The Aforementioned Citation</eref>]
|
258
|
+
</li>
|
259
|
+
<li>
|
260
|
+
<em>word</em> [term defined in <eref bibitemid="ISO712" type="inline" citeas="ISO 712"><locality type="clause">
|
261
|
+
<referenceFrom>3.1</referenceFrom>
|
262
|
+
</locality><locality type="figure">
|
263
|
+
<referenceFrom>a</referenceFrom>
|
264
|
+
</locality>ISO 712, Clause 3.1, Figure a</eref>]
|
265
|
+
</li>
|
266
|
+
<li>
|
267
|
+
<em>word</em> [term defined in <eref bibitemid="ISO712" type="inline" citeas="ISO 712"><localityStack>
|
268
|
+
<locality type="clause">
|
269
|
+
<referenceFrom>3.1</referenceFrom>
|
270
|
+
</locality>
|
271
|
+
</localityStack><localityStack>
|
272
|
+
<locality type="figure">
|
273
|
+
<referenceFrom>b</referenceFrom>
|
274
|
+
</locality>
|
275
|
+
</localityStack>ISO 712, Clause 3.1; Figure b</eref>]
|
276
|
+
</li>
|
277
|
+
<li>
|
278
|
+
<em>word</em> [<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
279
|
+
<localityStack>
|
280
|
+
<locality type="clause">
|
281
|
+
<referenceFrom>3.1</referenceFrom>
|
282
|
+
</locality>
|
283
|
+
</localityStack>
|
284
|
+
<localityStack>
|
285
|
+
<locality type="figure">
|
286
|
+
<referenceFrom>b</referenceFrom>
|
287
|
+
</locality>
|
288
|
+
</localityStack>
|
289
|
+
The Aforementioned Citation
|
290
|
+
</eref>]
|
291
|
+
</li>
|
292
|
+
<li>
|
293
|
+
<em>word</em> [term defined in <termref base="IEV" target="135-13-13"/>]
|
294
|
+
</li>
|
295
|
+
<li>
|
296
|
+
<em>word</em> [<termref base="IEV" target="135-13-13">The IEV database</termref>]
|
297
|
+
</li>
|
298
|
+
<li> <em>word</em> <strong>error!</strong> </li>
|
299
|
+
</ul>
|
300
|
+
</p>
|
301
|
+
</foreword></preface>
|
311
302
|
<sections>
|
312
|
-
|
313
|
-
<title depth='1'>
|
314
|
-
2.
|
315
|
-
<tab/>
|
316
|
-
Clause 1
|
317
|
-
</title>
|
318
|
-
</clause>
|
303
|
+
<clause id="clause1" displayorder="3"><title depth="1">2.<tab/>Clause 1</title></clause>
|
319
304
|
</sections>
|
320
|
-
<bibliography>
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
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>
|
305
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder="2"><title depth="1">1.<tab/>Normative References</title>
|
306
|
+
<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>
|
307
|
+
<bibitem id="ISO712" type="standard">
|
308
|
+
<title format="text/plain">Cereals or cereal products</title>
|
309
|
+
<title type="main" format="text/plain">Cereals and cereal products</title>
|
310
|
+
<docidentifier type="ISO">ISO 712</docidentifier>
|
311
|
+
<contributor>
|
312
|
+
<role type="publisher"/>
|
313
|
+
<organization>
|
314
|
+
<name>International Organization for Standardization</name>
|
315
|
+
</organization>
|
316
|
+
</contributor>
|
317
|
+
</bibitem>
|
318
|
+
</references></bibliography>
|
319
|
+
</iso-standard>
|
348
320
|
OUTPUT
|
349
321
|
output = <<~OUTPUT
|
350
322
|
#{HTML_HDR}
|
351
|
-
|
323
|
+
<br/>
|
352
324
|
<div>
|
353
325
|
<h1 class='ForewordTitle'>Foreword</h1>
|
354
326
|
<p>
|
355
327
|
<ul>
|
356
328
|
<li>
|
357
|
-
|
358
|
-
|
359
|
-
|
329
|
+
[term defined in
|
330
|
+
<a href='#clause1'>Clause 2</a>
|
331
|
+
]
|
360
332
|
</li>
|
361
333
|
<li>
|
362
|
-
<i>
|
363
|
-
|
364
|
-
</
|
334
|
+
<i>term</i>
|
335
|
+
[term defined in
|
336
|
+
<a href='#clause1'>Clause 2</a>
|
337
|
+
]
|
365
338
|
</li>
|
366
339
|
<li>
|
367
|
-
<i>
|
368
|
-
|
369
|
-
</
|
340
|
+
<i>w[o]rd</i>
|
341
|
+
[
|
342
|
+
<a href='#clause1'>Clause #1</a>
|
343
|
+
]
|
370
344
|
</li>
|
371
345
|
<li>
|
372
|
-
<i>
|
373
|
-
|
374
|
-
</
|
346
|
+
<i>term</i>
|
347
|
+
[term defined in
|
348
|
+
<a href='#ISO712'>ISO 712</a>
|
349
|
+
]
|
375
350
|
</li>
|
376
351
|
<li>
|
377
|
-
<i>
|
378
|
-
|
379
|
-
</
|
352
|
+
<i>word</i>
|
353
|
+
[
|
354
|
+
<a href='#ISO712'>The Aforementioned Citation</a>
|
355
|
+
]
|
380
356
|
</li>
|
381
357
|
<li>
|
382
|
-
<i>
|
383
|
-
|
384
|
-
</
|
358
|
+
<i>word</i>
|
359
|
+
[term defined in
|
360
|
+
<a href='#ISO712'>ISO 712, Clause 3.1, Figure a</a>
|
361
|
+
]
|
385
362
|
</li>
|
386
363
|
<li>
|
387
|
-
<i>
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
</i>
|
364
|
+
<i>word</i>
|
365
|
+
[term defined in
|
366
|
+
<a href='#ISO712'>ISO 712, Clause 3.1; Figure b</a>
|
367
|
+
]
|
392
368
|
</li>
|
393
|
-
<li> [term defined in Termbase IEV, term ID 135-13-13 ] </li>
|
394
369
|
<li>
|
395
|
-
<i>
|
370
|
+
<i>word</i>
|
371
|
+
[
|
372
|
+
<a href='#ISO712'> The Aforementioned Citation </a>
|
373
|
+
]
|
396
374
|
</li>
|
375
|
+
<li>
|
376
|
+
<i>word</i>
|
377
|
+
[term defined in Termbase IEV, term ID 135-13-13]
|
378
|
+
</li>
|
379
|
+
<li>
|
380
|
+
<i>word</i>
|
381
|
+
[The IEV database]
|
382
|
+
</li>
|
383
|
+
<li> <i>word</i> <b>error!</b> </li>
|
397
384
|
</ul>
|
398
385
|
</p>
|
399
386
|
</div>
|
400
387
|
<p class='zzSTDTitle1'/>
|
401
388
|
<div>
|
402
|
-
<h1>
|
389
|
+
<h1>1.  Normative References</h1>
|
403
390
|
<p>
|
404
|
-
|
405
|
-
|
391
|
+
The following documents are referred to in the text in such a way that
|
392
|
+
some or all of their content constitutes requirements of this
|
406
393
|
document. For dated references, only the edition cited applies. For
|
407
394
|
undated references, the latest edition of the referenced document
|
408
395
|
(including any amendments) applies.
|
@@ -413,7 +400,7 @@ RSpec.describe IsoDoc do
|
|
413
400
|
</p>
|
414
401
|
</div>
|
415
402
|
<div id='clause1'>
|
416
|
-
<h1>
|
403
|
+
<h1>2.  Clause 1</h1>
|
417
404
|
</div>
|
418
405
|
</div>
|
419
406
|
</body>
|
@@ -425,6 +412,198 @@ RSpec.describe IsoDoc do
|
|
425
412
|
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
426
413
|
end
|
427
414
|
|
415
|
+
it "processes concept attributes" do
|
416
|
+
input = <<~INPUT
|
417
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
418
|
+
<preface><foreword>
|
419
|
+
<p>
|
420
|
+
<ul>
|
421
|
+
<li>
|
422
|
+
<concept ital="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
423
|
+
<li><concept ref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
424
|
+
<li><concept ital="true" ref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
425
|
+
<li><concept ital="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
426
|
+
<li><concept ref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
427
|
+
<li><concept ital="false" ref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
428
|
+
</ul></p>
|
429
|
+
</foreword></preface>
|
430
|
+
<sections>
|
431
|
+
<clause id="clause1"><title>Clause 1</title></clause>
|
432
|
+
</sections>
|
433
|
+
</iso-standard>
|
434
|
+
INPUT
|
435
|
+
presxml = <<~OUTPUT
|
436
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
437
|
+
<preface><foreword displayorder="1">
|
438
|
+
<p>
|
439
|
+
<ul>
|
440
|
+
<li>
|
441
|
+
|
442
|
+
<em>term</em>
|
443
|
+
[term defined in <xref target="clause1">Clause 1</xref>],
|
444
|
+
</li>
|
445
|
+
<li>
|
446
|
+
<em>term</em>
|
447
|
+
[term defined in <xref target="clause1">Clause 1</xref>],
|
448
|
+
</li>
|
449
|
+
<li>
|
450
|
+
<em>term</em>
|
451
|
+
[term defined in <xref target="clause1">Clause 1</xref>],
|
452
|
+
</li>
|
453
|
+
<li>
|
454
|
+
term
|
455
|
+
[term defined in <xref target="clause1">Clause 1</xref>],
|
456
|
+
</li>
|
457
|
+
<li>
|
458
|
+
<em>term</em>,
|
459
|
+
|
460
|
+
</li>
|
461
|
+
<li>
|
462
|
+
term,
|
463
|
+
|
464
|
+
</li>
|
465
|
+
</ul></p>
|
466
|
+
</foreword></preface>
|
467
|
+
<sections>
|
468
|
+
<clause id="clause1" displayorder="2"><title depth="1">1.<tab/>Clause 1</title></clause>
|
469
|
+
</sections>
|
470
|
+
</iso-standard>
|
471
|
+
OUTPUT
|
472
|
+
output = <<~OUTPUT
|
473
|
+
#{HTML_HDR}
|
474
|
+
<br/>
|
475
|
+
<div>
|
476
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
477
|
+
<p>
|
478
|
+
<ul>
|
479
|
+
<li>
|
480
|
+
<i>term</i>
|
481
|
+
[term defined in
|
482
|
+
<a href='#clause1'>Clause 1</a>
|
483
|
+
],
|
484
|
+
</li>
|
485
|
+
<li>
|
486
|
+
<i>term</i>
|
487
|
+
[term defined in
|
488
|
+
<a href='#clause1'>Clause 1</a>
|
489
|
+
],
|
490
|
+
</li>
|
491
|
+
<li>
|
492
|
+
<i>term</i>
|
493
|
+
[term defined in
|
494
|
+
<a href='#clause1'>Clause 1</a>
|
495
|
+
],
|
496
|
+
</li>
|
497
|
+
<li>
|
498
|
+
term [term defined in
|
499
|
+
<a href='#clause1'>Clause 1</a>
|
500
|
+
],
|
501
|
+
</li>
|
502
|
+
<li>
|
503
|
+
<i>term</i>,
|
504
|
+
</li>
|
505
|
+
<li>term,</li>
|
506
|
+
</ul>
|
507
|
+
</p>
|
508
|
+
</div>
|
509
|
+
<p class='zzSTDTitle1'/>
|
510
|
+
<div id='clause1'>
|
511
|
+
<h1>1.  Clause 1</h1>
|
512
|
+
</div>
|
513
|
+
</div>
|
514
|
+
</body>
|
515
|
+
</html>
|
516
|
+
OUTPUT
|
517
|
+
expect((IsoDoc::PresentationXMLConvert.new({})
|
518
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
519
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
520
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
521
|
+
end
|
522
|
+
|
523
|
+
it "processes concept markup for symbols" do
|
524
|
+
input = <<~INPUT
|
525
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
526
|
+
<preface><foreword>
|
527
|
+
<p>
|
528
|
+
<ul>
|
529
|
+
<li><concept>
|
530
|
+
<refterm>term</refterm>
|
531
|
+
<renderterm>ISO</renderterm>
|
532
|
+
<xref target='d1'/>
|
533
|
+
</concept></li>
|
534
|
+
</ul>
|
535
|
+
</p>
|
536
|
+
</foreword>
|
537
|
+
</preface>
|
538
|
+
<sections>
|
539
|
+
<definitions id="d">
|
540
|
+
<dl>
|
541
|
+
<dt id="d1">ISO</dt> <dd>xyz</xyz>
|
542
|
+
<dt id="d2">IEC</dt> <dd>abc</xyz>
|
543
|
+
</dl>
|
544
|
+
</definitions>
|
545
|
+
</sections>
|
546
|
+
</iso-standard>
|
547
|
+
INPUT
|
548
|
+
presxml = <<~OUTPUT
|
549
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
550
|
+
<preface>
|
551
|
+
<foreword displayorder='1'>
|
552
|
+
<p>
|
553
|
+
<ul>
|
554
|
+
<li>ISO</li>
|
555
|
+
</ul>
|
556
|
+
</p>
|
557
|
+
</foreword>
|
558
|
+
</preface>
|
559
|
+
<sections>
|
560
|
+
<definitions id='d' displayorder='2'>
|
561
|
+
<title>1.</title>
|
562
|
+
<dl>
|
563
|
+
<dt id='d1'>ISO</dt>
|
564
|
+
<dd>xyz</dd>
|
565
|
+
<dt id='d2'>IEC</dt>
|
566
|
+
<dd>abc</dd>
|
567
|
+
</dl>
|
568
|
+
</definitions>
|
569
|
+
</sections>
|
570
|
+
</iso-standard>
|
571
|
+
OUTPUT
|
572
|
+
output = <<~OUTPUT
|
573
|
+
#{HTML_HDR}
|
574
|
+
<br/>
|
575
|
+
<div>
|
576
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
577
|
+
<p>
|
578
|
+
<ul>
|
579
|
+
<li>ISO</li>
|
580
|
+
</ul>
|
581
|
+
</p>
|
582
|
+
</div>
|
583
|
+
<p class='zzSTDTitle1'/>
|
584
|
+
<div id='d' class='Symbols'>
|
585
|
+
<h1>1.</h1>
|
586
|
+
<dl>
|
587
|
+
<dt id='d1'>
|
588
|
+
<p>ISO</p>
|
589
|
+
</dt>
|
590
|
+
<dd>xyz</dd>
|
591
|
+
<dt id='d2'>
|
592
|
+
<p>IEC</p>
|
593
|
+
</dt>
|
594
|
+
<dd>abc</dd>
|
595
|
+
</dl>
|
596
|
+
</div>
|
597
|
+
</div>
|
598
|
+
</body>
|
599
|
+
</html>
|
600
|
+
OUTPUT
|
601
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
602
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
603
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
604
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
605
|
+
end
|
606
|
+
|
428
607
|
it "processes embedded inline formatting" do
|
429
608
|
input = <<~INPUT
|
430
609
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
@@ -745,43 +924,43 @@ RSpec.describe IsoDoc do
|
|
745
924
|
</iso-standard>
|
746
925
|
INPUT
|
747
926
|
presxml = <<~OUTPUT
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
"2"><title depth='1'>1.<tab/>Normative References</title>
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
927
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
928
|
+
<preface><foreword displayorder="1">
|
929
|
+
<p>
|
930
|
+
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
|
931
|
+
<eref type="inline" bibitemid="ISO712">ISO 712</eref>
|
932
|
+
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Table 1</eref>
|
933
|
+
<eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
|
934
|
+
<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>
|
935
|
+
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Table 1–1</eref>
|
936
|
+
<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>
|
937
|
+
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
|
938
|
+
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality>ISO 712, Clause 1.5</eref>
|
939
|
+
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
940
|
+
<eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
|
941
|
+
<eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
|
942
|
+
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
|
943
|
+
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
|
944
|
+
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
|
945
|
+
<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>
|
946
|
+
<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>
|
947
|
+
</p>
|
948
|
+
</foreword></preface>
|
949
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder=
|
950
|
+
"2"><title depth='1'>1.<tab/>Normative References</title>
|
951
|
+
<bibitem id="ISO712" type="standard">
|
952
|
+
<title format="text/plain">Cereals and cereal products</title>
|
953
|
+
<docidentifier>ISO 712</docidentifier>
|
954
|
+
<contributor>
|
955
|
+
<role type="publisher"/>
|
956
|
+
<organization>
|
957
|
+
<abbreviation>ISO</abbreviation>
|
958
|
+
</organization>
|
959
|
+
</contributor>
|
960
|
+
</bibitem>
|
961
|
+
</references>
|
962
|
+
</bibliography>
|
963
|
+
</iso-standard>
|
785
964
|
OUTPUT
|
786
965
|
|
787
966
|
html = <<~OUTPUT
|
@@ -1104,36 +1283,36 @@ RSpec.describe IsoDoc do
|
|
1104
1283
|
</iso-standard>
|
1105
1284
|
INPUT
|
1106
1285
|
output = <<~OUTPUT
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1286
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1287
|
+
<bibdata>
|
1288
|
+
<language current='true'>en</language>
|
1289
|
+
<script current='true'>Latn</script>
|
1290
|
+
</bibdata>
|
1291
|
+
<preface>
|
1292
|
+
<clause id='A' displayorder='1'>
|
1293
|
+
<title depth='1'>ABC</title>
|
1294
|
+
</clause>
|
1295
|
+
<clause id='A1' displayorder='2'>
|
1296
|
+
<title depth='1'>ABC/DEF</title>
|
1297
|
+
</clause>
|
1298
|
+
<clause id='A2' displayorder='3'>
|
1299
|
+
<title depth='1'>ABC</title>
|
1300
|
+
</clause>
|
1301
|
+
<clause id='B' displayorder='4'>
|
1302
|
+
<title depth='1'>GHI/JKL</title>
|
1303
|
+
</clause>
|
1304
|
+
<clause id='C' displayorder='5'>
|
1305
|
+
<title depth='1'>DEF</title>
|
1306
|
+
</clause>
|
1307
|
+
<clause id='C1' displayorder='6'>
|
1308
|
+
<title depth='1'>ABC/DEF</title>
|
1309
|
+
</clause>
|
1310
|
+
<clause id='C2' displayorder='7'>
|
1311
|
+
<title depth='1'>DEF</title>
|
1312
|
+
</clause>
|
1313
|
+
<p displayorder='8'>A B D E</p>
|
1314
|
+
</preface>
|
1315
|
+
</iso-standard>
|
1137
1316
|
OUTPUT
|
1138
1317
|
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1139
1318
|
.convert("test", input, true)
|