isodoc 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isodoc-yaml/i18n-en.yaml +4 -1
- data/lib/isodoc-yaml/i18n-fr.yaml +4 -1
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +4 -1
- data/lib/isodoc.rb +1 -0
- data/lib/isodoc/common.rb +0 -2
- data/lib/isodoc/convert.rb +33 -27
- data/lib/isodoc/function/blocks.rb +10 -22
- data/lib/isodoc/function/blocks_example_note.rb +14 -15
- data/lib/isodoc/function/cleanup.rb +5 -4
- data/lib/isodoc/function/inline.rb +6 -76
- data/lib/isodoc/function/references.rb +10 -9
- data/lib/isodoc/function/reqt.rb +12 -11
- data/lib/isodoc/function/section.rb +39 -54
- data/lib/isodoc/function/table.rb +1 -6
- data/lib/isodoc/function/terms.rb +13 -6
- data/lib/isodoc/function/to_word_html.rb +1 -0
- data/lib/isodoc/function/utils.rb +4 -3
- data/lib/isodoc/html_function/html.rb +0 -1
- data/lib/isodoc/{function/i18n.rb → i18n.rb} +37 -36
- data/lib/isodoc/metadata.rb +4 -3
- data/lib/isodoc/metadata_date.rb +1 -1
- data/lib/isodoc/presentation_function/block.rb +138 -0
- data/lib/isodoc/presentation_function/inline.rb +131 -0
- data/lib/isodoc/presentation_function/section.rb +46 -0
- data/lib/isodoc/presentation_xml_convert.rb +38 -5
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +12 -8
- data/lib/isodoc/word_function/inline.rb +3 -1
- data/lib/isodoc/xref.rb +5 -3
- data/lib/isodoc/xref/xref_sect_gen.rb +3 -3
- data/spec/assets/i18n.yaml +12 -1
- data/spec/isodoc/blocks_spec.rb +1101 -147
- data/spec/isodoc/cleanup_spec.rb +2 -2
- data/spec/isodoc/footnotes_spec.rb +2 -2
- data/spec/isodoc/i18n_spec.rb +679 -110
- data/spec/isodoc/inline_spec.rb +323 -142
- data/spec/isodoc/lists_spec.rb +2 -2
- data/spec/isodoc/postproc_spec.rb +1311 -1333
- data/spec/isodoc/ref_spec.rb +181 -3
- data/spec/isodoc/section_spec.rb +508 -680
- data/spec/isodoc/table_spec.rb +155 -4
- data/spec/isodoc/terms_spec.rb +111 -79
- data/spec/isodoc/xref_spec.rb +1569 -1186
- metadata +6 -3
data/spec/isodoc/cleanup_spec.rb
CHANGED
@@ -46,7 +46,7 @@ RSpec.describe IsoDoc do
|
|
46
46
|
<aside><div id="ftntableD-1a">
|
47
47
|
|
48
48
|
</div></aside>
|
49
|
-
<p><b
|
49
|
+
<p><b>Key</b></p><dl><dt><span><span id="tableD-1a" class="TableFootnoteRef">a</span>  </span></dt><dd><p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p></dd></dl></div>
|
50
50
|
</body>
|
51
51
|
</html>
|
52
52
|
OUTPUT
|
@@ -73,7 +73,7 @@ RSpec.describe IsoDoc do
|
|
73
73
|
<aside><div id="ftntableD-1a">
|
74
74
|
|
75
75
|
</div></aside>
|
76
|
-
<p><b
|
76
|
+
<p><b>Key</b></p><table class="dl"><tr><td valign="top" align="left"><span><span id="tableD-1a" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">  </span></span></td><td valign="top"><p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p></td></tr></table></div>
|
77
77
|
</body>
|
78
78
|
</html>
|
79
79
|
OUTPUT
|
@@ -149,7 +149,7 @@ RSpec.describe IsoDoc do
|
|
149
149
|
<p id="C">C.</p>
|
150
150
|
<review reviewer="ISO" id="_4f4dff63-23c1-4ecb-8ac6-d3ffba93c712" date="20170108T0000" from="C" to="C"><p id="_c54b9549-369f-4f85-b5b2-9db3fd3d4c08">Second note.</p></review>
|
151
151
|
</foreword>
|
152
|
-
<introduction>
|
152
|
+
<introduction><title>Introduction</title>
|
153
153
|
<review reviewer="ISO" id="_4f4dff63-23c1-4ecb-8ac6-d3ffba93c712" date="20170108T0000" from="A" to="C"><p id="_c54b9549-369f-4f85-b5b2-9db3fd3d4c08">Second note.</p></review>
|
154
154
|
</introduction>
|
155
155
|
</preface>
|
@@ -203,7 +203,7 @@ RSpec.describe IsoDoc do
|
|
203
203
|
<p id="C">C.</p>
|
204
204
|
<review reviewer="ISO" id="_4f4dff63-23c1-4ecb-8ac6-d3ffba93c712" date="20170108T0000" from="C" to="C"><p id="_c54b9549-369f-4f85-b5b2-9db3fd3d4c08">Second note.</p></review>
|
205
205
|
</foreword>
|
206
|
-
<introduction>
|
206
|
+
<introduction><title>Introduction</title>
|
207
207
|
<review reviewer="ISO" id="_4f4dff63-23c1-4ecb-8ac6-d3ffba93c712" date="20170108T0000" from="A" to="C"><p id="_c54b9549-369f-4f85-b5b2-9db3fd3d4c08">Second note.</p></review>
|
208
208
|
</introduction>
|
209
209
|
</preface>
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes English" do
|
5
|
-
|
5
|
+
input = <<~"INPUT"
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<bibdata>
|
8
8
|
<language>en</language>
|
@@ -10,13 +10,13 @@ RSpec.describe IsoDoc do
|
|
10
10
|
<preface>
|
11
11
|
<foreword obligation="informative">
|
12
12
|
<title>Foreword</title>
|
13
|
-
<p id="A">
|
13
|
+
<p id="A">See <xref target="M"/></p>
|
14
14
|
</foreword>
|
15
15
|
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
16
16
|
<title>Introduction Subsection</title>
|
17
17
|
</clause>
|
18
18
|
</introduction></preface><sections>
|
19
|
-
<clause id="D" obligation="normative">
|
19
|
+
<clause id="D" obligation="normative" type="scope">
|
20
20
|
<title>Scope</title>
|
21
21
|
<p id="E">Text</p>
|
22
22
|
</clause>
|
@@ -66,11 +66,102 @@ RSpec.describe IsoDoc do
|
|
66
66
|
</bibliography>
|
67
67
|
</iso-standard>
|
68
68
|
INPUT
|
69
|
+
|
70
|
+
presxml = <<~"PRESXML"
|
71
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
72
|
+
<bibdata>
|
73
|
+
<language>en</language>
|
74
|
+
</bibdata>
|
75
|
+
<preface>
|
76
|
+
<foreword obligation='informative'>
|
77
|
+
<title>Foreword</title>
|
78
|
+
<p id='A'>See <xref target='M'>Clause 5</xref></p>
|
79
|
+
</foreword>
|
80
|
+
<introduction id='B' obligation='informative'>
|
81
|
+
<title>Introduction</title>
|
82
|
+
<clause id='C' inline-header='false' obligation='informative'>
|
83
|
+
<title depth='2'>Introduction Subsection</title>
|
84
|
+
</clause>
|
85
|
+
</introduction>
|
86
|
+
</preface>
|
87
|
+
<sections>
|
88
|
+
<clause id='D' obligation='normative' type="scope">
|
89
|
+
<title depth='1'>1.<tab/>Scope</title>
|
90
|
+
<p id='E'>Text</p>
|
91
|
+
</clause>
|
92
|
+
<clause id='H' obligation='normative'>
|
93
|
+
<title depth='1'>3.<tab/>Terms, definitions, symbols and abbreviated terms</title>
|
94
|
+
<terms id='I' obligation='normative'>
|
95
|
+
<title depth='2'>3.1.<tab/>Normal Terms</title>
|
96
|
+
<term id='J'>
|
97
|
+
<name>3.1.1.</name>
|
98
|
+
<preferred>Term2</preferred>
|
99
|
+
</term>
|
100
|
+
</terms>
|
101
|
+
<definitions id='K'>
|
102
|
+
<title>3.2.</title>
|
103
|
+
<dl>
|
104
|
+
<dt>Symbol</dt>
|
105
|
+
<dd>Definition</dd>
|
106
|
+
</dl>
|
107
|
+
</definitions>
|
108
|
+
</clause>
|
109
|
+
<definitions id='L'>
|
110
|
+
<title>4.</title>
|
111
|
+
<dl>
|
112
|
+
<dt>Symbol</dt>
|
113
|
+
<dd>Definition</dd>
|
114
|
+
</dl>
|
115
|
+
</definitions>
|
116
|
+
<clause id='M' inline-header='false' obligation='normative'>
|
117
|
+
<title depth='1'>5.<tab/>Clause 4</title>
|
118
|
+
<clause id='N' inline-header='false' obligation='normative'>
|
119
|
+
<title depth='2'>5.1.<tab/>Introduction</title>
|
120
|
+
</clause>
|
121
|
+
<clause id='O' inline-header='false' obligation='normative'>
|
122
|
+
<title depth='2'>5.2.<tab/>Clause 4.2</title>
|
123
|
+
</clause>
|
124
|
+
</clause>
|
125
|
+
</sections>
|
126
|
+
<annex id='P' inline-header='false' obligation='normative'>
|
127
|
+
<title>
|
128
|
+
<strong>Annex A</strong>
|
129
|
+
<br/>
|
130
|
+
(normative)
|
131
|
+
<br/>
|
132
|
+
<br/>
|
133
|
+
<strong>Annex</strong>
|
134
|
+
</title>
|
135
|
+
<clause id='Q' inline-header='false' obligation='normative'>
|
136
|
+
<title depth='2'>A.1.<tab/>Annex A.1</title>
|
137
|
+
<clause id='Q1' inline-header='false' obligation='normative'>
|
138
|
+
<title depth='3'>A.1.1.<tab/>Annex A.1a</title>
|
139
|
+
</clause>
|
140
|
+
</clause>
|
141
|
+
</annex>
|
142
|
+
<bibliography>
|
143
|
+
<references id='R' obligation='informative' normative='true'>
|
144
|
+
<title depth='1'>2.<tab/>Normative References</title>
|
145
|
+
</references>
|
146
|
+
<clause id='S' obligation='informative'>
|
147
|
+
<title depth="1">Bibliography</title>
|
148
|
+
<references id='T' obligation='informative' normative='false'>
|
149
|
+
<title depth="2">Bibliography Subsection</title>
|
150
|
+
</references>
|
151
|
+
</clause>
|
152
|
+
</bibliography>
|
153
|
+
</iso-standard>
|
154
|
+
PRESXML
|
155
|
+
|
156
|
+
output = <<~"OUTPUT"
|
69
157
|
#{HTML_HDR}
|
70
158
|
<br/>
|
71
159
|
<div>
|
72
160
|
<h1 class="ForewordTitle">Foreword</h1>
|
73
|
-
<p id=
|
161
|
+
<p id='A'>
|
162
|
+
See
|
163
|
+
<a href='#M'>Clause 5</a>
|
164
|
+
</p>
|
74
165
|
</div>
|
75
166
|
<br/>
|
76
167
|
<div class="Section3" id="B">
|
@@ -85,7 +176,7 @@ RSpec.describe IsoDoc do
|
|
85
176
|
<p id="E">Text</p>
|
86
177
|
</div>
|
87
178
|
<div>
|
88
|
-
<h1>2.  Normative
|
179
|
+
<h1>2.  Normative References</h1>
|
89
180
|
</div>
|
90
181
|
<div id="H"><h1>3.  Terms, definitions, symbols and abbreviated terms</h1>
|
91
182
|
<div id="I">
|
@@ -93,11 +184,11 @@ RSpec.describe IsoDoc do
|
|
93
184
|
<p class="TermNum" id="J">3.1.1.</p>
|
94
185
|
<p class="Terms" style="text-align:left;">Term2</p>
|
95
186
|
|
96
|
-
</div><div id="K"><h2>3.2
|
187
|
+
</div><div id="K"><h2>3.2.</h2>
|
97
188
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
98
189
|
</div></div>
|
99
190
|
<div id="L" class="Symbols">
|
100
|
-
<h1>4
|
191
|
+
<h1>4.</h1>
|
101
192
|
<dl>
|
102
193
|
<dt>
|
103
194
|
<p>Symbol</p>
|
@@ -135,10 +226,12 @@ RSpec.describe IsoDoc do
|
|
135
226
|
</body>
|
136
227
|
</html>
|
137
228
|
OUTPUT
|
229
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
230
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
138
231
|
end
|
139
232
|
|
140
233
|
it "defaults to English" do
|
141
|
-
expect(xmlpp(IsoDoc::
|
234
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
142
235
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
143
236
|
<bibdata>
|
144
237
|
<language>tlh</language>
|
@@ -146,13 +239,13 @@ RSpec.describe IsoDoc do
|
|
146
239
|
<preface>
|
147
240
|
<foreword obligation="informative">
|
148
241
|
<title>Foreword</title>
|
149
|
-
<p id="A">
|
242
|
+
<p id="A">See <xref target="M"/></p>
|
150
243
|
</foreword>
|
151
244
|
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
152
245
|
<title>Introduction Subsection</title>
|
153
246
|
</clause>
|
154
247
|
</introduction></preface><sections>
|
155
|
-
<clause id="D" obligation="normative">
|
248
|
+
<clause id="D" obligation="normative" type="scope">
|
156
249
|
<title>Scope</title>
|
157
250
|
<p id="E">Text</p>
|
158
251
|
</clause>
|
@@ -202,79 +295,95 @@ RSpec.describe IsoDoc do
|
|
202
295
|
</bibliography>
|
203
296
|
</iso-standard>
|
204
297
|
INPUT
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
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
|
-
|
298
|
+
<?xml version='1.0'?>
|
299
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
300
|
+
<bibdata>
|
301
|
+
<language>tlh</language>
|
302
|
+
</bibdata>
|
303
|
+
<preface>
|
304
|
+
<foreword obligation='informative'>
|
305
|
+
<title>Foreword</title>
|
306
|
+
<p id='A'>See <xref target='M'>Clause 5</xref></p>
|
307
|
+
</foreword>
|
308
|
+
<introduction id='B' obligation='informative'>
|
309
|
+
<title>Introduction</title>
|
310
|
+
<clause id='C' inline-header='false' obligation='informative'>
|
311
|
+
<title depth='2'>Introduction Subsection</title>
|
312
|
+
</clause>
|
313
|
+
</introduction>
|
314
|
+
</preface>
|
315
|
+
<sections>
|
316
|
+
<clause id='D' obligation='normative' type="scope">
|
317
|
+
<title depth='1'>1.<tab/>Scope</title>
|
318
|
+
<p id='E'>Text</p>
|
319
|
+
</clause>
|
320
|
+
<clause id='H' obligation='normative'>
|
321
|
+
<title depth='1'>3.<tab/>Terms, definitions, symbols and abbreviated terms</title>
|
322
|
+
<terms id='I' obligation='normative'>
|
323
|
+
<title depth='2'>3.1.<tab/>Normal Terms</title>
|
324
|
+
<term id='J'>
|
325
|
+
<name>3.1.1.</name>
|
326
|
+
<preferred>Term2</preferred>
|
327
|
+
</term>
|
328
|
+
</terms>
|
329
|
+
<definitions id='K'>
|
330
|
+
<title>3.2.</title>
|
331
|
+
<dl>
|
332
|
+
<dt>Symbol</dt>
|
333
|
+
<dd>Definition</dd>
|
334
|
+
</dl>
|
335
|
+
</definitions>
|
336
|
+
</clause>
|
337
|
+
<definitions id='L'>
|
338
|
+
<title>4.</title>
|
339
|
+
<dl>
|
340
|
+
<dt>Symbol</dt>
|
341
|
+
<dd>Definition</dd>
|
342
|
+
</dl>
|
343
|
+
</definitions>
|
344
|
+
<clause id='M' inline-header='false' obligation='normative'>
|
345
|
+
<title depth='1'>5.<tab/>Clause 4</title>
|
346
|
+
<clause id='N' inline-header='false' obligation='normative'>
|
347
|
+
<title depth='2'>5.1.<tab/>Introduction</title>
|
348
|
+
</clause>
|
349
|
+
<clause id='O' inline-header='false' obligation='normative'>
|
350
|
+
<title depth='2'>5.2.<tab/>Clause 4.2</title>
|
351
|
+
</clause>
|
352
|
+
</clause>
|
353
|
+
</sections>
|
354
|
+
<annex id='P' inline-header='false' obligation='normative'>
|
355
|
+
<title>
|
356
|
+
<strong>Annex A</strong>
|
357
|
+
<br/>
|
358
|
+
(normative)
|
359
|
+
<br/>
|
360
|
+
<br/>
|
361
|
+
<strong>Annex</strong>
|
362
|
+
</title>
|
363
|
+
<clause id='Q' inline-header='false' obligation='normative'>
|
364
|
+
<title depth='2'>A.1.<tab/>Annex A.1</title>
|
365
|
+
<clause id='Q1' inline-header='false' obligation='normative'>
|
366
|
+
<title depth='3'>A.1.1.<tab/>Annex A.1a</title>
|
367
|
+
</clause>
|
368
|
+
</clause>
|
369
|
+
</annex>
|
370
|
+
<bibliography>
|
371
|
+
<references id='R' obligation='informative' normative='true'>
|
372
|
+
<title depth='1'>2.<tab/>Normative References</title>
|
373
|
+
</references>
|
374
|
+
<clause id='S' obligation='informative'>
|
375
|
+
<title depth="1">Bibliography</title>
|
376
|
+
<references id='T' obligation='informative' normative='false'>
|
377
|
+
<title depth="2">Bibliography Subsection</title>
|
378
|
+
</references>
|
379
|
+
</clause>
|
380
|
+
</bibliography>
|
381
|
+
</iso-standard>
|
273
382
|
OUTPUT
|
274
383
|
end
|
275
384
|
|
276
385
|
it "processes French" do
|
277
|
-
|
386
|
+
input = <<~"INPUT"
|
278
387
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
279
388
|
<bibdata>
|
280
389
|
<language>fr</language>
|
@@ -282,13 +391,13 @@ RSpec.describe IsoDoc do
|
|
282
391
|
<preface>
|
283
392
|
<foreword obligation="informative">
|
284
393
|
<title>Foreword</title>
|
285
|
-
<p id="A">
|
394
|
+
<p id="A">See <xref target="M"/></p>
|
286
395
|
</foreword>
|
287
396
|
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
288
397
|
<title>Introduction Subsection</title>
|
289
398
|
</clause>
|
290
399
|
</introduction></preface><sections>
|
291
|
-
<clause id="D" obligation="normative">
|
400
|
+
<clause id="D" obligation="normative" type="scope">
|
292
401
|
<title>Scope</title>
|
293
402
|
<p id="E">Text</p>
|
294
403
|
</clause>
|
@@ -330,7 +439,7 @@ RSpec.describe IsoDoc do
|
|
330
439
|
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
331
440
|
<title>Normative References</title>
|
332
441
|
</references><clause id="S" obligation="informative">
|
333
|
-
<title>
|
442
|
+
<title>Bibliographie</title>
|
334
443
|
<references id="T" obligation="informative" normative="false">
|
335
444
|
<title>Bibliography Subsection</title>
|
336
445
|
</references>
|
@@ -338,11 +447,102 @@ RSpec.describe IsoDoc do
|
|
338
447
|
</bibliography>
|
339
448
|
</iso-standard>
|
340
449
|
INPUT
|
450
|
+
|
451
|
+
presxml = <<~"PRESXML"
|
452
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
453
|
+
<bibdata>
|
454
|
+
<language>fr</language>
|
455
|
+
</bibdata>
|
456
|
+
<preface>
|
457
|
+
<foreword obligation='informative'>
|
458
|
+
<title>Foreword</title>
|
459
|
+
<p id='A'>See <xref target='M'>Article 5</xref></p>
|
460
|
+
</foreword>
|
461
|
+
<introduction id='B' obligation='informative'>
|
462
|
+
<title>Introduction</title>
|
463
|
+
<clause id='C' inline-header='false' obligation='informative'>
|
464
|
+
<title depth='2'>Introduction Subsection</title>
|
465
|
+
</clause>
|
466
|
+
</introduction>
|
467
|
+
</preface>
|
468
|
+
<sections>
|
469
|
+
<clause id='D' obligation='normative' type="scope">
|
470
|
+
<title depth='1'>1.<tab/>Scope</title>
|
471
|
+
<p id='E'>Text</p>
|
472
|
+
</clause>
|
473
|
+
<clause id='H' obligation='normative'>
|
474
|
+
<title depth='1'>3.<tab/>Terms, definitions, symbols and abbreviated terms</title>
|
475
|
+
<terms id='I' obligation='normative'>
|
476
|
+
<title depth='2'>3.1.<tab/>Normal Terms</title>
|
477
|
+
<term id='J'>
|
478
|
+
<name>3.1.1.</name>
|
479
|
+
<preferred>Term2</preferred>
|
480
|
+
</term>
|
481
|
+
</terms>
|
482
|
+
<definitions id='K'>
|
483
|
+
<title>3.2.</title>
|
484
|
+
<dl>
|
485
|
+
<dt>Symbol</dt>
|
486
|
+
<dd>Definition</dd>
|
487
|
+
</dl>
|
488
|
+
</definitions>
|
489
|
+
</clause>
|
490
|
+
<definitions id='L'>
|
491
|
+
<title>4.</title>
|
492
|
+
<dl>
|
493
|
+
<dt>Symbol</dt>
|
494
|
+
<dd>Definition</dd>
|
495
|
+
</dl>
|
496
|
+
</definitions>
|
497
|
+
<clause id='M' inline-header='false' obligation='normative'>
|
498
|
+
<title depth='1'>5.<tab/>Clause 4</title>
|
499
|
+
<clause id='N' inline-header='false' obligation='normative'>
|
500
|
+
<title depth='2'>5.1.<tab/>Introduction</title>
|
501
|
+
</clause>
|
502
|
+
<clause id='O' inline-header='false' obligation='normative'>
|
503
|
+
<title depth='2'>5.2.<tab/>Clause 4.2</title>
|
504
|
+
</clause>
|
505
|
+
</clause>
|
506
|
+
</sections>
|
507
|
+
<annex id='P' inline-header='false' obligation='normative'>
|
508
|
+
<title>
|
509
|
+
<strong>Annexe A</strong>
|
510
|
+
<br/>
|
511
|
+
(normative)
|
512
|
+
<br/>
|
513
|
+
<br/>
|
514
|
+
<strong>Annex</strong>
|
515
|
+
</title>
|
516
|
+
<clause id='Q' inline-header='false' obligation='normative'>
|
517
|
+
<title depth='2'>A.1.<tab/>Annex A.1</title>
|
518
|
+
<clause id='Q1' inline-header='false' obligation='normative'>
|
519
|
+
<title depth='3'>A.1.1.<tab/>Annex A.1a</title>
|
520
|
+
</clause>
|
521
|
+
</clause>
|
522
|
+
</annex>
|
523
|
+
<bibliography>
|
524
|
+
<references id='R' obligation='informative' normative='true'>
|
525
|
+
<title depth='1'>2.<tab/>Normative References</title>
|
526
|
+
</references>
|
527
|
+
<clause id='S' obligation='informative'>
|
528
|
+
<title depth="1">Bibliographie</title>
|
529
|
+
<references id='T' obligation='informative' normative='false'>
|
530
|
+
<title depth="2">Bibliography Subsection</title>
|
531
|
+
</references>
|
532
|
+
</clause>
|
533
|
+
</bibliography>
|
534
|
+
</iso-standard>
|
535
|
+
PRESXML
|
536
|
+
|
537
|
+
output = <<~"OUTPUT"
|
341
538
|
#{HTML_HDR.gsub(/ lang="en">/, ' lang="fr">')}
|
342
539
|
<br/>
|
343
540
|
<div>
|
344
|
-
<h1 class="ForewordTitle">
|
345
|
-
<p id=
|
541
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
542
|
+
<p id='A'>
|
543
|
+
See
|
544
|
+
<a href='#M'>Article 5</a>
|
545
|
+
</p>
|
346
546
|
</div>
|
347
547
|
<br/>
|
348
548
|
<div class="Section3" id="B">
|
@@ -353,23 +553,23 @@ RSpec.describe IsoDoc do
|
|
353
553
|
</div>
|
354
554
|
<p class="zzSTDTitle1"/>
|
355
555
|
<div id="D">
|
356
|
-
<h1>1. 
|
556
|
+
<h1>1.  Scope</h1>
|
357
557
|
<p id="E">Text</p>
|
358
558
|
</div>
|
359
559
|
<div>
|
360
|
-
<h1>2. 
|
560
|
+
<h1>2.  Normative References</h1>
|
361
561
|
</div>
|
362
|
-
<div id="H"><h1>3.  Terms,
|
562
|
+
<div id="H"><h1>3.  Terms, definitions, symbols and abbreviated terms</h1>
|
363
563
|
<div id="I">
|
364
564
|
<h2>3.1.  Normal Terms</h2>
|
365
565
|
<p class="TermNum" id="J">3.1.1.</p>
|
366
566
|
<p class="Terms" style="text-align:left;">Term2</p>
|
367
567
|
|
368
|
-
</div><div id="K"><h2>3.2
|
568
|
+
</div><div id="K"><h2>3.2.</h2>
|
369
569
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
370
570
|
</div></div>
|
371
571
|
<div id="L" class="Symbols">
|
372
|
-
<h1>4
|
572
|
+
<h1>4.</h1>
|
373
573
|
<dl>
|
374
574
|
<dt>
|
375
575
|
<p>Symbol</p>
|
@@ -407,10 +607,12 @@ RSpec.describe IsoDoc do
|
|
407
607
|
</body>
|
408
608
|
</html>
|
409
609
|
OUTPUT
|
610
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
611
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
410
612
|
end
|
411
613
|
|
412
614
|
it "processes Simplified Chinese" do
|
413
|
-
|
615
|
+
input = <<~"INPUT"
|
414
616
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
415
617
|
<bibdata>
|
416
618
|
<language>zh</language>
|
@@ -419,13 +621,13 @@ RSpec.describe IsoDoc do
|
|
419
621
|
<preface>
|
420
622
|
<foreword obligation="informative">
|
421
623
|
<title>Foreword</title>
|
422
|
-
<p id="A">
|
624
|
+
<p id="A">See <xref target="M"/></p>
|
423
625
|
</foreword>
|
424
626
|
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
425
627
|
<title>Introduction Subsection</title>
|
426
628
|
</clause>
|
427
629
|
</introduction></preface><sections>
|
428
|
-
<clause id="D" obligation="normative">
|
630
|
+
<clause id="D" obligation="normative" type="scope">
|
429
631
|
<title>Scope</title>
|
430
632
|
<p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
|
431
633
|
</clause>
|
@@ -485,41 +687,144 @@ RSpec.describe IsoDoc do
|
|
485
687
|
</bibliography>
|
486
688
|
</iso-standard>
|
487
689
|
INPUT
|
690
|
+
|
691
|
+
presxml = <<~"PRESXML"
|
692
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
693
|
+
<bibdata>
|
694
|
+
<language>zh</language>
|
695
|
+
<script>Hans</script>
|
696
|
+
</bibdata>
|
697
|
+
<preface>
|
698
|
+
<foreword obligation='informative'>
|
699
|
+
<title>Foreword</title>
|
700
|
+
<p id='A'>See <xref target='M'>条5</xref></p>
|
701
|
+
</foreword>
|
702
|
+
<introduction id='B' obligation='informative'>
|
703
|
+
<title>Introduction</title>
|
704
|
+
<clause id='C' inline-header='false' obligation='informative'>
|
705
|
+
<title depth='2'>Introduction Subsection</title>
|
706
|
+
</clause>
|
707
|
+
</introduction>
|
708
|
+
</preface>
|
709
|
+
<sections>
|
710
|
+
<clause id='D' obligation='normative' type="scope">
|
711
|
+
<title depth='1'>1.<tab/>Scope</title>
|
712
|
+
<p id='E'>
|
713
|
+
<eref type='inline' bibitemid='ISO712'><locality type='table'><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712、第1–1表</eref></p>
|
714
|
+
</clause>
|
715
|
+
<clause id='H' obligation='normative'>
|
716
|
+
<title depth='1'>3.<tab/>Terms, definitions, symbols and abbreviated terms</title>
|
717
|
+
<terms id='I' obligation='normative'>
|
718
|
+
<title depth='2'>3.1.<tab/>Normal Terms</title>
|
719
|
+
<term id='J'>
|
720
|
+
<name>3.1.1.</name>
|
721
|
+
<preferred>Term2</preferred>
|
722
|
+
</term>
|
723
|
+
</terms>
|
724
|
+
<definitions id='K'>
|
725
|
+
<title>3.2.</title>
|
726
|
+
<dl>
|
727
|
+
<dt>Symbol</dt>
|
728
|
+
<dd>Definition</dd>
|
729
|
+
</dl>
|
730
|
+
</definitions>
|
731
|
+
</clause>
|
732
|
+
<definitions id='L'>
|
733
|
+
<title>4.</title>
|
734
|
+
<dl>
|
735
|
+
<dt>Symbol</dt>
|
736
|
+
<dd>Definition</dd>
|
737
|
+
</dl>
|
738
|
+
</definitions>
|
739
|
+
<clause id='M' inline-header='false' obligation='normative'>
|
740
|
+
<title depth='1'>5.<tab/>Clause 4</title>
|
741
|
+
<clause id='N' inline-header='false' obligation='normative'>
|
742
|
+
<title depth='2'>5.1.<tab/>Introduction</title>
|
743
|
+
</clause>
|
744
|
+
<clause id='O' inline-header='false' obligation='normative'>
|
745
|
+
<title depth='2'>5.2.<tab/>Clause 4.2</title>
|
746
|
+
</clause>
|
747
|
+
</clause>
|
748
|
+
</sections>
|
749
|
+
<annex id='P' inline-header='false' obligation='normative'>
|
750
|
+
<title>
|
751
|
+
<strong>附件A</strong>
|
752
|
+
<br/>
|
753
|
+
(规范性附录)
|
754
|
+
<br/>
|
755
|
+
<br/>
|
756
|
+
<strong>Annex</strong>
|
757
|
+
</title>
|
758
|
+
<clause id='Q' inline-header='false' obligation='normative'>
|
759
|
+
<title depth='2'>A.1.<tab/>Annex A.1</title>
|
760
|
+
<clause id='Q1' inline-header='false' obligation='normative'>
|
761
|
+
<title depth='3'>A.1.1.<tab/>Annex A.1a</title>
|
762
|
+
</clause>
|
763
|
+
</clause>
|
764
|
+
</annex>
|
765
|
+
<bibliography>
|
766
|
+
<references id='R' obligation='informative' normative='true'>
|
767
|
+
<title depth='1'>2.<tab/>Normative References</title>
|
768
|
+
<bibitem id='ISO712' type='standard'>
|
769
|
+
<title format='text/plain'>Cereals and cereal products</title>
|
770
|
+
<docidentifier>ISO 712</docidentifier>
|
771
|
+
<contributor>
|
772
|
+
<role type='publisher'/>
|
773
|
+
<organization>
|
774
|
+
<abbreviation>ISO</abbreviation>
|
775
|
+
</organization>
|
776
|
+
</contributor>
|
777
|
+
</bibitem>
|
778
|
+
</references>
|
779
|
+
<clause id='S' obligation='informative'>
|
780
|
+
<title depth="1">Bibliography</title>
|
781
|
+
<references id='T' obligation='informative' normative='false'>
|
782
|
+
<title depth="2">Bibliography Subsection</title>
|
783
|
+
</references>
|
784
|
+
</clause>
|
785
|
+
</bibliography>
|
786
|
+
</iso-standard>
|
787
|
+
PRESXML
|
788
|
+
|
789
|
+
output = <<~"OUTPUT"
|
488
790
|
#{HTML_HDR.gsub(/ lang="en">/, ' lang="zh">')}
|
489
791
|
<br/>
|
490
792
|
<div>
|
491
|
-
<h1 class="ForewordTitle"
|
492
|
-
<p id=
|
793
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
794
|
+
<p id='A'>
|
795
|
+
See
|
796
|
+
<a href='#M'>条5</a>
|
797
|
+
</p>
|
493
798
|
</div>
|
494
799
|
<br/>
|
495
800
|
<div class="Section3" id="B">
|
496
|
-
<h1 class="IntroTitle"
|
801
|
+
<h1 class="IntroTitle">Introduction</h1>
|
497
802
|
<div id="C">
|
498
803
|
<h2>Introduction Subsection</h2>
|
499
804
|
</div>
|
500
805
|
</div>
|
501
806
|
<p class="zzSTDTitle1"/>
|
502
807
|
<div id="D">
|
503
|
-
<h1>1.&#
|
808
|
+
<h1>1. Scope</h1>
|
504
809
|
<p id="E">
|
505
|
-
|
810
|
+
<a href='#ISO712'>ISO 712、第1–1表</a>
|
506
811
|
</p>
|
507
812
|
</div>
|
508
813
|
<div>
|
509
|
-
<h1>2.&#
|
510
|
-
<p id="ISO712" class="NormRef">ISO 712, <i>
|
814
|
+
<h1>2. Normative References</h1>
|
815
|
+
<p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
|
511
816
|
</div>
|
512
|
-
<div id="H"><h1>3.&#
|
817
|
+
<div id="H"><h1>3. Terms, definitions, symbols and abbreviated terms</h1>
|
513
818
|
<div id="I">
|
514
|
-
<h2>3.1.&#
|
819
|
+
<h2>3.1. Normal Terms</h2>
|
515
820
|
<p class="TermNum" id="J">3.1.1.</p>
|
516
821
|
<p class="Terms" style="text-align:left;">Term2</p>
|
517
822
|
|
518
|
-
</div><div id="K"><h2>3.2
|
823
|
+
</div><div id="K"><h2>3.2.</h2>
|
519
824
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
520
825
|
</div></div>
|
521
826
|
<div id="L" class="Symbols">
|
522
|
-
<h1>4
|
827
|
+
<h1>4.</h1>
|
523
828
|
<dl>
|
524
829
|
<dt>
|
525
830
|
<p>Symbol</p>
|
@@ -528,27 +833,27 @@ RSpec.describe IsoDoc do
|
|
528
833
|
</dl>
|
529
834
|
</div>
|
530
835
|
<div id="M">
|
531
|
-
<h1>5.&#
|
836
|
+
<h1>5. Clause 4</h1>
|
532
837
|
<div id="N">
|
533
|
-
<h2>5.1.&#
|
838
|
+
<h2>5.1. Introduction</h2>
|
534
839
|
</div>
|
535
840
|
<div id="O">
|
536
|
-
<h2>5.2.&#
|
841
|
+
<h2>5.2. Clause 4.2</h2>
|
537
842
|
</div>
|
538
843
|
</div>
|
539
844
|
<br/>
|
540
845
|
<div id="P" class="Section3">
|
541
|
-
<h1 class="Annex">附件A
|
846
|
+
<h1 class="Annex"><b>附件A</b><br/>(规范性附录)<br/><br/><b>Annex</b></h1>
|
542
847
|
<div id="Q">
|
543
|
-
<h2>A.1.&#
|
848
|
+
<h2>A.1. Annex A.1</h2>
|
544
849
|
<div id="Q1">
|
545
|
-
<h3>A.1.1.&#
|
850
|
+
<h3>A.1.1. Annex A.1a</h3>
|
546
851
|
</div>
|
547
852
|
</div>
|
548
853
|
</div>
|
549
854
|
<br/>
|
550
855
|
<div>
|
551
|
-
<h1 class="Section3"
|
856
|
+
<h1 class="Section3">Bibliography</h1>
|
552
857
|
<div>
|
553
858
|
<h2 class="Section3">Bibliography Subsection</h2>
|
554
859
|
</div>
|
@@ -557,6 +862,270 @@ RSpec.describe IsoDoc do
|
|
557
862
|
</body>
|
558
863
|
</html>
|
559
864
|
OUTPUT
|
865
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
866
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
560
867
|
end
|
561
868
|
|
869
|
+
it "processes i18n file" do
|
870
|
+
input = <<~"INPUT"
|
871
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
872
|
+
<bibdata>
|
873
|
+
<language>eo</language>
|
874
|
+
<script>Latn</script>
|
875
|
+
</bibdata>
|
876
|
+
<preface>
|
877
|
+
<foreword obligation="informative">
|
878
|
+
<title>Foreword</title>
|
879
|
+
<p id="A">See <xref target="M"/></p>
|
880
|
+
</foreword>
|
881
|
+
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
882
|
+
<title>Introduction Subsection</title>
|
883
|
+
</clause>
|
884
|
+
</introduction></preface><sections>
|
885
|
+
<clause id="D" obligation="normative" type="scope">
|
886
|
+
<title>Scope</title>
|
887
|
+
<p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
|
888
|
+
</clause>
|
889
|
+
|
890
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
891
|
+
<title>Normal Terms</title>
|
892
|
+
<term id="J">
|
893
|
+
<preferred>Term2</preferred>
|
894
|
+
</term>
|
895
|
+
</terms>
|
896
|
+
<definitions id="K">
|
897
|
+
<dl>
|
898
|
+
<dt>Symbol</dt>
|
899
|
+
<dd>Definition</dd>
|
900
|
+
</dl>
|
901
|
+
</definitions>
|
902
|
+
</clause>
|
903
|
+
<definitions id="L">
|
904
|
+
<dl>
|
905
|
+
<dt>Symbol</dt>
|
906
|
+
<dd>Definition</dd>
|
907
|
+
</dl>
|
908
|
+
</definitions>
|
909
|
+
<clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
910
|
+
<title>Introduction</title>
|
911
|
+
</clause>
|
912
|
+
<clause id="O" inline-header="false" obligation="normative">
|
913
|
+
<title>Clause 4.2</title>
|
914
|
+
</clause></clause>
|
915
|
+
|
916
|
+
</sections><annex id="P" inline-header="false" obligation="normative">
|
917
|
+
<title>Annex</title>
|
918
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
919
|
+
<title>Annex A.1</title>
|
920
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
921
|
+
<title>Annex A.1a</title>
|
922
|
+
</clause>
|
923
|
+
</clause>
|
924
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
925
|
+
<title>Normative References</title>
|
926
|
+
<bibitem id="ISO712" type="standard">
|
927
|
+
<title format="text/plain">Cereals and cereal products</title>
|
928
|
+
<docidentifier>ISO 712</docidentifier>
|
929
|
+
<contributor>
|
930
|
+
<role type="publisher"/>
|
931
|
+
<organization>
|
932
|
+
<abbreviation>ISO</abbreviation>
|
933
|
+
</organization>
|
934
|
+
</contributor>
|
935
|
+
</bibitem>
|
936
|
+
</references><clause id="S" obligation="informative">
|
937
|
+
<title>Bibliography</title>
|
938
|
+
<references id="T" obligation="informative" normative="false">
|
939
|
+
<title>Bibliography Subsection</title>
|
940
|
+
</references>
|
941
|
+
</clause>
|
942
|
+
</bibliography>
|
943
|
+
</iso-standard>
|
944
|
+
INPUT
|
945
|
+
|
946
|
+
presxml = <<~OUTPUT
|
947
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
948
|
+
<bibdata>
|
949
|
+
<language>eo</language>
|
950
|
+
<script>Latn</script>
|
951
|
+
</bibdata>
|
952
|
+
<preface>
|
953
|
+
<foreword obligation="informative">
|
954
|
+
<title>Foreword</title>
|
955
|
+
<p id='A'>See <xref target='M'>klaŭzo 5</xref></p>
|
956
|
+
</foreword>
|
957
|
+
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
958
|
+
<title depth="2">Introduction Subsection</title>
|
959
|
+
</clause>
|
960
|
+
</introduction></preface><sections>
|
961
|
+
<clause id="D" obligation="normative" type="scope">
|
962
|
+
<title depth="1">1.<tab/>Scope</title>
|
963
|
+
<p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Tabelo 1–1</eref></p>
|
964
|
+
</clause>
|
965
|
+
|
966
|
+
<clause id="H" obligation="normative"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
967
|
+
<title depth="2">3.1.<tab/>Normal Terms</title>
|
968
|
+
<term id="J"><name>3.1.1.</name>
|
969
|
+
<preferred>Term2</preferred>
|
970
|
+
</term>
|
971
|
+
</terms>
|
972
|
+
<definitions id="K"><title>3.2.</title>
|
973
|
+
<dl>
|
974
|
+
<dt>Symbol</dt>
|
975
|
+
<dd>Definition</dd>
|
976
|
+
</dl>
|
977
|
+
</definitions>
|
978
|
+
</clause>
|
979
|
+
<definitions id="L"><title>4.</title>
|
980
|
+
<dl>
|
981
|
+
<dt>Symbol</dt>
|
982
|
+
<dd>Definition</dd>
|
983
|
+
</dl>
|
984
|
+
</definitions>
|
985
|
+
<clause id="M" inline-header="false" obligation="normative"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
986
|
+
<title depth="2">5.1.<tab/>Introduction</title>
|
987
|
+
</clause>
|
988
|
+
<clause id="O" inline-header="false" obligation="normative">
|
989
|
+
<title depth="2">5.2.<tab/>Clause 4.2</title>
|
990
|
+
</clause></clause>
|
991
|
+
|
992
|
+
</sections><annex id="P" inline-header="false" obligation="normative">
|
993
|
+
<title><strong>Aldono A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
994
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
995
|
+
<title depth="2">A.1.<tab/>Annex A.1</title>
|
996
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
997
|
+
<title depth="3">A.1.1.<tab/>Annex A.1a</title>
|
998
|
+
</clause>
|
999
|
+
</clause>
|
1000
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
1001
|
+
<title depth="1">2.<tab/>Normative References</title>
|
1002
|
+
<bibitem id="ISO712" type="standard">
|
1003
|
+
<title format="text/plain">Cereals and cereal products</title>
|
1004
|
+
<docidentifier>ISO 712</docidentifier>
|
1005
|
+
<contributor>
|
1006
|
+
<role type="publisher"/>
|
1007
|
+
<organization>
|
1008
|
+
<abbreviation>ISO</abbreviation>
|
1009
|
+
</organization>
|
1010
|
+
</contributor>
|
1011
|
+
</bibitem>
|
1012
|
+
</references><clause id="S" obligation="informative">
|
1013
|
+
<title depth="1">Bibliography</title>
|
1014
|
+
<references id="T" obligation="informative" normative="false">
|
1015
|
+
<title depth="2">Bibliography Subsection</title>
|
1016
|
+
</references>
|
1017
|
+
</clause>
|
1018
|
+
</bibliography>
|
1019
|
+
</iso-standard>
|
1020
|
+
OUTPUT
|
1021
|
+
|
1022
|
+
output = <<~OUTPUT
|
1023
|
+
<html lang='eo'>
|
1024
|
+
<head/>
|
1025
|
+
<body lang='eo'>
|
1026
|
+
<div class='title-section'>
|
1027
|
+
<p> </p>
|
1028
|
+
</div>
|
1029
|
+
<br/>
|
1030
|
+
<div class='prefatory-section'>
|
1031
|
+
<p> </p>
|
1032
|
+
</div>
|
1033
|
+
<br/>
|
1034
|
+
<div class='main-section'>
|
1035
|
+
<br/>
|
1036
|
+
<div>
|
1037
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
1038
|
+
<p id='A'>
|
1039
|
+
See
|
1040
|
+
<a href='#M'>klaŭzo 5</a>
|
1041
|
+
</p>
|
1042
|
+
</div>
|
1043
|
+
<br/>
|
1044
|
+
<div class='Section3' id='B'>
|
1045
|
+
<h1 class='IntroTitle'>Introduction</h1>
|
1046
|
+
<div id='C'>
|
1047
|
+
<h2>Introduction Subsection</h2>
|
1048
|
+
</div>
|
1049
|
+
</div>
|
1050
|
+
<p class='zzSTDTitle1'/>
|
1051
|
+
<div id='D'>
|
1052
|
+
<h1>1.  Scope</h1>
|
1053
|
+
<p id='E'>
|
1054
|
+
<a href='#ISO712'>ISO 712, Tabelo 1–1</a>
|
1055
|
+
</p>
|
1056
|
+
</div>
|
1057
|
+
<div>
|
1058
|
+
<h1>2.  Normative References</h1>
|
1059
|
+
<p id='ISO712' class='NormRef'>
|
1060
|
+
ISO 712,
|
1061
|
+
<i>Cereals and cereal products</i>
|
1062
|
+
</p>
|
1063
|
+
</div>
|
1064
|
+
<div id='H'>
|
1065
|
+
<h1>3.  Terms, definitions, symbols and abbreviated terms</h1>
|
1066
|
+
<div id='I'>
|
1067
|
+
<h2>3.1.  Normal Terms</h2>
|
1068
|
+
<p class='TermNum' id='J'>3.1.1.</p>
|
1069
|
+
<p class='Terms' style='text-align:left;'>Term2</p>
|
1070
|
+
</div>
|
1071
|
+
<div id='K'>
|
1072
|
+
<h2>3.2.</h2>
|
1073
|
+
<dl>
|
1074
|
+
<dt>
|
1075
|
+
<p>Symbol</p>
|
1076
|
+
</dt>
|
1077
|
+
<dd>Definition</dd>
|
1078
|
+
</dl>
|
1079
|
+
</div>
|
1080
|
+
</div>
|
1081
|
+
<div id='L' class='Symbols'>
|
1082
|
+
<h1>4.</h1>
|
1083
|
+
<dl>
|
1084
|
+
<dt>
|
1085
|
+
<p>Symbol</p>
|
1086
|
+
</dt>
|
1087
|
+
<dd>Definition</dd>
|
1088
|
+
</dl>
|
1089
|
+
</div>
|
1090
|
+
<div id='M'>
|
1091
|
+
<h1>5.  Clause 4</h1>
|
1092
|
+
<div id='N'>
|
1093
|
+
<h2>5.1.  Introduction</h2>
|
1094
|
+
</div>
|
1095
|
+
<div id='O'>
|
1096
|
+
<h2>5.2.  Clause 4.2</h2>
|
1097
|
+
</div>
|
1098
|
+
</div>
|
1099
|
+
<br/>
|
1100
|
+
<div id='P' class='Section3'>
|
1101
|
+
<h1 class='Annex'>
|
1102
|
+
<b>Aldono A</b>
|
1103
|
+
<br/>
|
1104
|
+
(normative)
|
1105
|
+
<br/>
|
1106
|
+
<br/>
|
1107
|
+
<b>Annex</b>
|
1108
|
+
</h1>
|
1109
|
+
<div id='Q'>
|
1110
|
+
<h2>A.1.  Annex A.1</h2>
|
1111
|
+
<div id='Q1'>
|
1112
|
+
<h3>A.1.1.  Annex A.1a</h3>
|
1113
|
+
</div>
|
1114
|
+
</div>
|
1115
|
+
</div>
|
1116
|
+
<br/>
|
1117
|
+
<div>
|
1118
|
+
<h1 class='Section3'>Bibliography</h1>
|
1119
|
+
<div>
|
1120
|
+
<h2 class='Section3'>Bibliography Subsection</h2>
|
1121
|
+
</div>
|
1122
|
+
</div>
|
1123
|
+
</div>
|
1124
|
+
</body>
|
1125
|
+
</html>
|
1126
|
+
OUTPUT
|
1127
|
+
|
1128
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
1129
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
1130
|
+
end
|
562
1131
|
end
|