isodoc 2.1.0.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +6 -3
  3. data/lib/isodoc/base_style/blocks.scss +7 -0
  4. data/lib/isodoc/class_utils.rb +1 -1
  5. data/lib/isodoc/function/blocks.rb +1 -1
  6. data/lib/isodoc/function/cleanup.rb +1 -1
  7. data/lib/isodoc/function/inline.rb +4 -2
  8. data/lib/isodoc/function/lists.rb +24 -9
  9. data/lib/isodoc/function/table.rb +1 -1
  10. data/lib/isodoc/function/to_word_html.rb +3 -2
  11. data/lib/isodoc/function/utils.rb +18 -8
  12. data/lib/isodoc/gem_tasks.rb +19 -10
  13. data/lib/isodoc/html_function/html.rb +2 -2
  14. data/lib/isodoc/i18n.rb +19 -0
  15. data/lib/isodoc/metadata.rb +2 -2
  16. data/lib/isodoc/presentation_function/block.rb +3 -3
  17. data/lib/isodoc/presentation_function/image.rb +1 -1
  18. data/lib/isodoc/presentation_function/inline.rb +13 -6
  19. data/lib/isodoc/presentation_function/section.rb +3 -1
  20. data/lib/isodoc/presentation_function/xrefs.rb +22 -6
  21. data/lib/isodoc/presentation_xml_convert.rb +1 -0
  22. data/lib/isodoc/version.rb +1 -1
  23. data/lib/isodoc/word_function/body.rb +9 -6
  24. data/lib/isodoc/word_function/postprocess.rb +1 -1
  25. data/lib/isodoc/word_function/postprocess_cover.rb +5 -5
  26. data/lib/isodoc/xref/xref_gen.rb +4 -4
  27. metadata +5 -66
  28. data/.github/workflows/rake.yml +0 -15
  29. data/.github/workflows/release.yml +0 -24
  30. data/.hound.yml +0 -5
  31. data/.oss-guides.rubocop.yml +0 -1077
  32. data/.rubocop.yml +0 -10
  33. data/Rakefile +0 -8
  34. data/bin/rspec +0 -17
  35. data/spec/assets/header.html +0 -7
  36. data/spec/assets/html.scss +0 -20
  37. data/spec/assets/html_override.css +0 -1
  38. data/spec/assets/htmlcover.html +0 -4
  39. data/spec/assets/htmlintro.html +0 -5
  40. data/spec/assets/i18n.yaml +0 -41
  41. data/spec/assets/iso.xml +0 -8
  42. data/spec/assets/odf.emf +0 -0
  43. data/spec/assets/odf.svg +0 -1
  44. data/spec/assets/odf1.svg +0 -4
  45. data/spec/assets/outputtest/a.xml +0 -66
  46. data/spec/assets/outputtest/iso.international-standard.xsl +0 -3011
  47. data/spec/assets/rice_image1 +0 -0
  48. data/spec/assets/rice_image1.png +0 -0
  49. data/spec/assets/scripts.html +0 -3
  50. data/spec/assets/scripts_override.html +0 -3
  51. data/spec/assets/std.css +0 -2
  52. data/spec/assets/word.css +0 -2
  53. data/spec/assets/word_override.css +0 -1
  54. data/spec/assets/wordcover.html +0 -3
  55. data/spec/assets/wordintro.html +0 -4
  56. data/spec/isodoc/blocks_spec.rb +0 -2934
  57. data/spec/isodoc/cleanup_spec.rb +0 -1056
  58. data/spec/isodoc/footnotes_spec.rb +0 -264
  59. data/spec/isodoc/form_spec.rb +0 -160
  60. data/spec/isodoc/i18n_spec.rb +0 -1201
  61. data/spec/isodoc/inline_spec.rb +0 -2301
  62. data/spec/isodoc/lists_spec.rb +0 -469
  63. data/spec/isodoc/metadata_spec.rb +0 -401
  64. data/spec/isodoc/postproc_spec.rb +0 -2941
  65. data/spec/isodoc/presentation_xml_spec.rb +0 -1476
  66. data/spec/isodoc/ref_spec.rb +0 -955
  67. data/spec/isodoc/section_spec.rb +0 -2123
  68. data/spec/isodoc/table_spec.rb +0 -588
  69. data/spec/isodoc/terms_spec.rb +0 -712
  70. data/spec/isodoc/utils_spec.rb +0 -57
  71. data/spec/isodoc/xref_numbering_spec.rb +0 -378
  72. data/spec/isodoc/xref_spec.rb +0 -1837
  73. data/spec/isodoc/xslfo_convert_spec.rb +0 -103
  74. data/spec/spec_helper.rb +0 -81
@@ -1,1201 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe IsoDoc do
4
- it "processes English" do
5
- input = <<~"INPUT"
6
- <iso-standard xmlns="http://riboseinc.com/isoxml">
7
- <bibdata>
8
- <language>en</language>
9
- <status>
10
- <stage>published</stage>
11
- <substage>withdrawn</substage>
12
- </status>
13
- <edition>2</edition>
14
- <ext>
15
- <doctype>brochure</doctype>
16
- </ext>
17
- </bibdata>
18
- <preface>
19
- <foreword obligation="informative">
20
- <title>Foreword</title>
21
- <p id="A">See <xref target="M"/></p>
22
- </foreword>
23
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
24
- <title>Introduction Subsection</title>
25
- </clause>
26
- </introduction></preface><sections>
27
- <clause id="D" obligation="normative" type="scope">
28
- <title>Scope</title>
29
- <p id="E">Text</p>
30
- </clause>
31
-
32
- <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
33
- <title>Normal Terms</title>
34
- <term id="J">
35
- <preferred><expression><name>Term2</name></expression></preferred>
36
- </term>
37
- </terms>
38
- <definitions id="K">
39
- <dl>
40
- <dt>Symbol</dt>
41
- <dd>Definition</dd>
42
- </dl>
43
- </definitions>
44
- </clause>
45
- <definitions id="L">
46
- <dl>
47
- <dt>Symbol</dt>
48
- <dd>Definition</dd>
49
- </dl>
50
- </definitions>
51
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
52
- <title>Introduction</title>
53
- </clause>
54
- <clause id="O" inline-header="false" obligation="normative">
55
- <title>Clause 4.2</title>
56
- </clause></clause>
57
-
58
- </sections><annex id="P" inline-header="false" obligation="normative">
59
- <title>Annex</title>
60
- <clause id="Q" inline-header="false" obligation="normative">
61
- <title>Annex A.1</title>
62
- <clause id="Q1" inline-header="false" obligation="normative">
63
- <title>Annex A.1a</title>
64
- </clause>
65
- </clause>
66
- </annex><bibliography><references id="R" obligation="informative" normative="true">
67
- <title>Normative References</title>
68
- </references><clause id="S" obligation="informative">
69
- <title>Bibliography</title>
70
- <references id="T" obligation="informative" normative="false">
71
- <title>Bibliography Subsection</title>
72
- </references>
73
- </clause>
74
- </bibliography>
75
- </iso-standard>
76
- INPUT
77
-
78
- presxml = <<~"PRESXML"
79
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
80
- <bibdata>
81
- <language current="true">en</language>
82
- <status>
83
- <stage>published</stage>
84
- <substage>withdrawn</substage>
85
- </status>
86
- <edition language=''>2</edition>
87
- <edition language='en'>second edition</edition>
88
- <ext>
89
- <doctype>brochure</doctype>
90
- </ext>
91
- </bibdata>
92
- <preface>
93
- <foreword obligation="informative" displayorder="1">
94
- <title>Foreword</title>
95
- <p id="A">See <xref target="M">Clause 5</xref></p>
96
- </foreword>
97
- <introduction id="B" obligation="informative" displayorder="2"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
98
- <title depth="2">Introduction Subsection</title>
99
- </clause>
100
- </introduction></preface><sections>
101
- <clause id="D" obligation="normative" type="scope" displayorder="3">
102
- <title depth="1">1.<tab/>Scope</title>
103
- <p id="E">Text</p>
104
- </clause>
105
- <clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
106
- <title depth="2">3.1.<tab/>Normal Terms</title>
107
- <term id="J"><name>3.1.1.</name>
108
- <preferred><strong>Term2</strong></preferred>
109
- </term>
110
- </terms>
111
- <definitions id="K"><title>3.2.</title>
112
- <dl>
113
- <dt>Symbol</dt>
114
- <dd>Definition</dd>
115
- </dl>
116
- </definitions>
117
- </clause>
118
- <definitions id="L" displayorder="6"><title>4.</title>
119
- <dl>
120
- <dt>Symbol</dt>
121
- <dd>Definition</dd>
122
- </dl>
123
- </definitions>
124
- <clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
125
- <title depth="2">5.1.<tab/>Introduction</title>
126
- </clause>
127
- <clause id="O" inline-header="false" obligation="normative">
128
- <title depth="2">5.2.<tab/>Clause 4.2</title>
129
- </clause></clause>
130
- </sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
131
- <title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
132
- <clause id="Q" inline-header="false" obligation="normative">
133
- <title depth="2">A.1.<tab/>Annex A.1</title>
134
- <clause id="Q1" inline-header="false" obligation="normative">
135
- <title depth="3">A.1.1.<tab/>Annex A.1a</title>
136
- </clause>
137
- </clause>
138
- </annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
139
- <title depth="1">2.<tab/>Normative References</title>
140
- </references><clause id="S" obligation="informative" displayorder="9">
141
- <title depth="1">Bibliography</title>
142
- <references id="T" obligation="informative" normative="false">
143
- <title depth="2">Bibliography Subsection</title>
144
- </references>
145
- </clause>
146
- </bibliography>
147
- </iso-standard>
148
- PRESXML
149
-
150
- output = <<~"OUTPUT"
151
- #{HTML_HDR}
152
- <br/>
153
- <div>
154
- <h1 class="ForewordTitle">Foreword</h1>
155
- <p id='A'>
156
- See
157
- <a href='#M'>Clause 5</a>
158
- </p>
159
- </div>
160
- <br/>
161
- <div class="Section3" id="B">
162
- <h1 class="IntroTitle">Introduction</h1>
163
- <div id="C">
164
- <h2>Introduction Subsection</h2>
165
- </div>
166
- </div>
167
- <p class="zzSTDTitle1"/>
168
- <div id="D">
169
- <h1>1.&#160; Scope</h1>
170
- <p id="E">Text</p>
171
- </div>
172
- <div>
173
- <h1>2.&#160; Normative References</h1>
174
- </div>
175
- <div id="H"><h1>3.&#160; Terms, definitions, symbols and abbreviated terms</h1>
176
- <div id="I">
177
- <h2>3.1.&#160; Normal Terms</h2>
178
- <p class="TermNum" id="J">3.1.1.</p>
179
- <p class="Terms" style="text-align:left;"><b>Term2</b></p>
180
- </div><div id="K"><h2>3.2.</h2>
181
- <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
182
- </div></div>
183
- <div id="L" class="Symbols">
184
- <h1>4.</h1>
185
- <dl>
186
- <dt>
187
- <p>Symbol</p>
188
- </dt>
189
- <dd>Definition</dd>
190
- </dl>
191
- </div>
192
- <div id="M">
193
- <h1>5.&#160; Clause 4</h1>
194
- <div id="N">
195
- <h2>5.1.&#160; Introduction</h2>
196
- </div>
197
- <div id="O">
198
- <h2>5.2.&#160; Clause 4.2</h2>
199
- </div>
200
- </div>
201
- <br/>
202
- <div id="P" class="Section3">
203
- <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
204
- <div id="Q">
205
- <h2>A.1.&#160; Annex A.1</h2>
206
- <div id="Q1">
207
- <h3>A.1.1.&#160; Annex A.1a</h3>
208
- </div>
209
- </div>
210
- </div>
211
- <br/>
212
- <div>
213
- <h1 class="Section3">Bibliography</h1>
214
- <div>
215
- <h2 class="Section3">Bibliography Subsection</h2>
216
- </div>
217
- </div>
218
- </div>
219
- </body>
220
- </html>
221
- OUTPUT
222
- expect(xmlpp(IsoDoc::PresentationXMLConvert
223
- .new({}).convert("test", input, true)
224
- .sub(%r{<localized-strings>.*</localized-strings>}m, "")))
225
- .to be_equivalent_to xmlpp(presxml)
226
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
227
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
228
- end
229
-
230
- it "defaults to English" do
231
- input = <<~INPUT
232
- <iso-standard xmlns="http://riboseinc.com/isoxml">
233
- <bibdata>
234
- <language>tlh</language>
235
- <status>
236
- <stage>published</stage>
237
- <substage>withdrawn</substage>
238
- </status>
239
- <edition>2</edition>
240
- <ext>
241
- <doctype>brochure</doctype>
242
- </ext>
243
- </bibdata>
244
- <preface>
245
- <foreword obligation="informative">
246
- <title>Foreword</title>
247
- <p id="A">See <xref target="M"/></p>
248
- </foreword>
249
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
250
- <title>Introduction Subsection</title>
251
- </clause>
252
- </introduction></preface><sections>
253
- <clause id="D" obligation="normative" type="scope">
254
- <title>Scope</title>
255
- <p id="E">Text</p>
256
- </clause>
257
-
258
- <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
259
- <title>Normal Terms</title>
260
- <term id="J">
261
- <preferred><expression><name>Term2</name></expression></preferred>
262
- </term>
263
- </terms>
264
- <definitions id="K">
265
- <dl>
266
- <dt>Symbol</dt>
267
- <dd>Definition</dd>
268
- </dl>
269
- </definitions>
270
- </clause>
271
- <definitions id="L">
272
- <dl>
273
- <dt>Symbol</dt>
274
- <dd>Definition</dd>
275
- </dl>
276
- </definitions>
277
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
278
- <title>Introduction</title>
279
- </clause>
280
- <clause id="O" inline-header="false" obligation="normative">
281
- <title>Clause 4.2</title>
282
- </clause></clause>
283
-
284
- </sections><annex id="P" inline-header="false" obligation="normative">
285
- <title>Annex</title>
286
- <clause id="Q" inline-header="false" obligation="normative">
287
- <title>Annex A.1</title>
288
- <clause id="Q1" inline-header="false" obligation="normative">
289
- <title>Annex A.1a</title>
290
- </clause>
291
- </clause>
292
- </annex><bibliography><references id="R" obligation="informative" normative="true">
293
- <title>Normative References</title>
294
- </references><clause id="S" obligation="informative">
295
- <title>Bibliography</title>
296
- <references id="T" obligation="informative" normative="false">
297
- <title>Bibliography Subsection</title>
298
- </references>
299
- </clause>
300
- </bibliography>
301
- </iso-standard>
302
- INPUT
303
- output = <<~OUTPUT
304
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
305
- <bibdata>
306
- <language current="true">tlh</language>
307
- <status>
308
- <stage>published</stage>
309
- <substage>withdrawn</substage>
310
- </status>
311
- <edition language=''>2</edition>
312
- <edition language='tlh'>second edition</edition>
313
- <ext>
314
- <doctype>brochure</doctype>
315
- </ext>
316
- </bibdata>
317
- <preface>
318
- <foreword obligation="informative" displayorder="1">
319
- <title>Foreword</title>
320
- <p id="A">See <xref target="M">Clause 5</xref></p>
321
- </foreword>
322
- <introduction id="B" obligation="informative" displayorder="2"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
323
- <title depth="2">Introduction Subsection</title>
324
- </clause>
325
- </introduction></preface><sections>
326
- <clause id="D" obligation="normative" type="scope" displayorder="3">
327
- <title depth="1">1.<tab/>Scope</title>
328
- <p id="E">Text</p>
329
- </clause>
330
- <clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
331
- <title depth="2">3.1.<tab/>Normal Terms</title>
332
- <term id="J"><name>3.1.1.</name>
333
- <preferred><strong>Term2</strong></preferred>
334
- </term>
335
- </terms>
336
- <definitions id="K"><title>3.2.</title>
337
- <dl>
338
- <dt>Symbol</dt>
339
- <dd>Definition</dd>
340
- </dl>
341
- </definitions>
342
- </clause>
343
- <definitions id="L" displayorder="6"><title>4.</title>
344
- <dl>
345
- <dt>Symbol</dt>
346
- <dd>Definition</dd>
347
- </dl>
348
- </definitions>
349
- <clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
350
- <title depth="2">5.1.<tab/>Introduction</title>
351
- </clause>
352
- <clause id="O" inline-header="false" obligation="normative">
353
- <title depth="2">5.2.<tab/>Clause 4.2</title>
354
- </clause></clause>
355
- </sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
356
- <title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
357
- <clause id="Q" inline-header="false" obligation="normative">
358
- <title depth="2">A.1.<tab/>Annex A.1</title>
359
- <clause id="Q1" inline-header="false" obligation="normative">
360
- <title depth="3">A.1.1.<tab/>Annex A.1a</title>
361
- </clause>
362
- </clause>
363
- </annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
364
- <title depth="1">2.<tab/>Normative References</title>
365
- </references><clause id="S" obligation="informative" displayorder="9">
366
- <title depth="1">Bibliography</title>
367
- <references id="T" obligation="informative" normative="false">
368
- <title depth="2">Bibliography Subsection</title>
369
- </references>
370
- </clause>
371
- </bibliography>
372
- </iso-standard>
373
- OUTPUT
374
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
375
- .convert("test", input, true)
376
- .sub(%r{<localized-strings>.*</localized-strings>}m, "")))
377
- .to be_equivalent_to xmlpp(output)
378
- end
379
-
380
- it "processes French" do
381
- input = <<~"INPUT"
382
- <iso-standard xmlns="http://riboseinc.com/isoxml">
383
- <bibdata>
384
- <language>fr</language>
385
- <status>
386
- <stage>published</stage>
387
- <substage>withdrawn</substage>
388
- </status>
389
- <edition>2</edition>
390
- <ext>
391
- <doctype>brochure</doctype>
392
- </ext>
393
- </bibdata>
394
- <preface>
395
- <foreword obligation="informative">
396
- <title>Foreword</title>
397
- <p id="A">See <xref target="M"/></p>
398
- </foreword>
399
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
400
- <title>Introduction Subsection</title>
401
- </clause>
402
- </introduction></preface><sections>
403
- <clause id="D" obligation="normative" type="scope">
404
- <title>Scope</title>
405
- <p id="E">Text</p>
406
- </clause>
407
-
408
- <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
409
- <title>Normal Terms</title>
410
- <term id="J">
411
- <preferred><expression><name>Term2</name></expression></preferred>
412
- </term>
413
- </terms>
414
- <definitions id="K">
415
- <dl>
416
- <dt>Symbol</dt>
417
- <dd>Definition</dd>
418
- </dl>
419
- </definitions>
420
- </clause>
421
- <definitions id="L">
422
- <dl>
423
- <dt>Symbol</dt>
424
- <dd>Definition</dd>
425
- </dl>
426
- </definitions>
427
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
428
- <title>Introduction</title>
429
- </clause>
430
- <clause id="O" inline-header="false" obligation="normative">
431
- <title>Clause 4.2</title>
432
- </clause></clause>
433
-
434
- </sections><annex id="P" inline-header="false" obligation="normative">
435
- <title>Annex</title>
436
- <clause id="Q" inline-header="false" obligation="normative">
437
- <title>Annex A.1</title>
438
- <clause id="Q1" inline-header="false" obligation="normative">
439
- <title>Annex A.1a</title>
440
- </clause>
441
- </clause>
442
- </annex><bibliography><references id="R" obligation="informative" normative="true">
443
- <title>Normative References</title>
444
- </references><clause id="S" obligation="informative">
445
- <title>Bibliographie</title>
446
- <references id="T" obligation="informative" normative="false">
447
- <title>Bibliography Subsection</title>
448
- </references>
449
- </clause>
450
- </bibliography>
451
- </iso-standard>
452
- INPUT
453
-
454
- presxml = <<~"PRESXML"
455
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
456
- <bibdata>
457
- <language current="true">fr</language>
458
- <status>
459
- <stage>published</stage>
460
- <substage>withdrawn</substage>
461
- </status>
462
- <edition language=''>2</edition>
463
- <edition language='fr'>deuxi&#xE8;me &#xE9;dition</edition>
464
- <ext>
465
- <doctype>brochure</doctype>
466
- </ext>
467
- </bibdata>
468
- <preface>
469
- <foreword obligation="informative" displayorder="1">
470
- <title>Foreword</title>
471
- <p id="A">See <xref target="M">Article 5</xref></p>
472
- </foreword>
473
- <introduction id="B" obligation="informative" displayorder="2"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
474
- <title depth="2">Introduction Subsection</title>
475
- </clause>
476
- </introduction></preface><sections>
477
- <clause id="D" obligation="normative" type="scope" displayorder="3">
478
- <title depth="1">1.<tab/>Scope</title>
479
- <p id="E">Text</p>
480
- </clause>
481
- <clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
482
- <title depth="2">3.1.<tab/>Normal Terms</title>
483
- <term id="J"><name>3.1.1.</name>
484
- <preferred><strong>Term2</strong></preferred>
485
- </term>
486
- </terms>
487
- <definitions id="K"><title>3.2.</title>
488
- <dl>
489
- <dt>Symbol</dt>
490
- <dd>Definition</dd>
491
- </dl>
492
- </definitions>
493
- </clause>
494
- <definitions id="L" displayorder="6"><title>4.</title>
495
- <dl>
496
- <dt>Symbol</dt>
497
- <dd>Definition</dd>
498
- </dl>
499
- </definitions>
500
- <clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
501
- <title depth="2">5.1.<tab/>Introduction</title>
502
- </clause>
503
- <clause id="O" inline-header="false" obligation="normative">
504
- <title depth="2">5.2.<tab/>Clause 4.2</title>
505
- </clause></clause>
506
- </sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
507
- <title><strong>Annexe A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
508
- <clause id="Q" inline-header="false" obligation="normative">
509
- <title depth="2">A.1.<tab/>Annex A.1</title>
510
- <clause id="Q1" inline-header="false" obligation="normative">
511
- <title depth="3">A.1.1.<tab/>Annex A.1a</title>
512
- </clause>
513
- </clause>
514
- </annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
515
- <title depth="1">2.<tab/>Normative References</title>
516
- </references><clause id="S" obligation="informative" displayorder="9">
517
- <title depth="1">Bibliographie</title>
518
- <references id="T" obligation="informative" normative="false">
519
- <title depth="2">Bibliography Subsection</title>
520
- </references>
521
- </clause>
522
- </bibliography>
523
- </iso-standard>
524
- PRESXML
525
-
526
- output = <<~"OUTPUT"
527
- #{HTML_HDR.gsub(/ lang="en">/, ' lang="fr">')}
528
- <br/>
529
- <div>
530
- <h1 class="ForewordTitle">Foreword</h1>
531
- <p id='A'>
532
- See
533
- <a href='#M'>Article 5</a>
534
- </p>
535
- </div>
536
- <br/>
537
- <div class="Section3" id="B">
538
- <h1 class="IntroTitle">Introduction</h1>
539
- <div id="C">
540
- <h2>Introduction Subsection</h2>
541
- </div>
542
- </div>
543
- <p class="zzSTDTitle1"/>
544
- <div id="D">
545
- <h1>1.&#160; Scope</h1>
546
- <p id="E">Text</p>
547
- </div>
548
- <div>
549
- <h1>2.&#160; Normative References</h1>
550
- </div>
551
- <div id="H"><h1>3.&#160; Terms, definitions, symbols and abbreviated terms</h1>
552
- <div id="I">
553
- <h2>3.1.&#160; Normal Terms</h2>
554
- <p class="TermNum" id="J">3.1.1.</p>
555
- <p class="Terms" style="text-align:left;"><b>Term2</b></p>
556
- </div><div id="K"><h2>3.2.</h2>
557
- <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
558
- </div></div>
559
- <div id="L" class="Symbols">
560
- <h1>4.</h1>
561
- <dl>
562
- <dt>
563
- <p>Symbol</p>
564
- </dt>
565
- <dd>Definition</dd>
566
- </dl>
567
- </div>
568
- <div id="M">
569
- <h1>5.&#160; Clause 4</h1>
570
- <div id="N">
571
- <h2>5.1.&#160; Introduction</h2>
572
- </div>
573
- <div id="O">
574
- <h2>5.2.&#160; Clause 4.2</h2>
575
- </div>
576
- </div>
577
- <br/>
578
- <div id="P" class="Section3">
579
- <h1 class="Annex"><b>Annexe A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
580
- <div id="Q">
581
- <h2>A.1.&#160; Annex A.1</h2>
582
- <div id="Q1">
583
- <h3>A.1.1.&#160; Annex A.1a</h3>
584
- </div>
585
- </div>
586
- </div>
587
- <br/>
588
- <div>
589
- <h1 class="Section3">Bibliographie</h1>
590
- <div>
591
- <h2 class="Section3">Bibliography Subsection</h2>
592
- </div>
593
- </div>
594
- </div>
595
- </body>
596
- </html>
597
- OUTPUT
598
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
599
- .convert("test", input, true)
600
- .sub(%r{<localized-strings>.*</localized-strings>}m, "")))
601
- .to be_equivalent_to xmlpp(presxml)
602
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
603
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
604
- end
605
-
606
- it "processes Simplified Chinese" do
607
- input = <<~"INPUT"
608
- <iso-standard xmlns="http://riboseinc.com/isoxml">
609
- <bibdata>
610
- <language>zh</language>
611
- <script>Hans</script>
612
- <status>
613
- <stage>published</stage>
614
- <substage>withdrawn</substage>
615
- </status>
616
- <edition>2</edition>
617
- <ext>
618
- <doctype>brochure</doctype>
619
- </ext>
620
- </bibdata>
621
- <preface>
622
- <foreword obligation="informative">
623
- <title>Foreword</title>
624
- <p id="A">See <xref target="M"/></p>
625
- </foreword>
626
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
627
- <title>Introduction Subsection</title>
628
- </clause>
629
- </introduction></preface><sections>
630
- <clause id="D" obligation="normative" type="scope">
631
- <title>Scope</title>
632
- <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
633
- </clause>
634
- <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
635
- <title>Normal Terms</title>
636
- <term id="J">
637
- <preferred><expression><name>Term2</name></expression></preferred>
638
- </term>
639
- </terms>
640
- <definitions id="K">
641
- <dl>
642
- <dt>Symbol</dt>
643
- <dd>Definition</dd>
644
- </dl>
645
- </definitions>
646
- </clause>
647
- <definitions id="L">
648
- <dl>
649
- <dt>Symbol</dt>
650
- <dd>Definition</dd>
651
- </dl>
652
- </definitions>
653
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
654
- <title>Introduction</title>
655
- </clause>
656
- <clause id="O" inline-header="false" obligation="normative">
657
- <title>Clause 4.2</title>
658
- </clause></clause>
659
- </sections><annex id="P" inline-header="false" obligation="normative">
660
- <title>Annex</title>
661
- <clause id="Q" inline-header="false" obligation="normative">
662
- <title>Annex A.1</title>
663
- <clause id="Q1" inline-header="false" obligation="normative">
664
- <title>Annex A.1a</title>
665
- </clause>
666
- </clause>
667
- </annex><bibliography><references id="R" obligation="informative" normative="true">
668
- <title>Normative References</title>
669
- <bibitem id="ISO712" type="standard">
670
- <title format="text/plain">Cereals and cereal products</title>
671
- <docidentifier>ISO 712</docidentifier>
672
- <contributor>
673
- <role type="publisher"/>
674
- <organization>
675
- <abbreviation>ISO</abbreviation>
676
- </organization>
677
- </contributor>
678
- </bibitem>
679
- </references><clause id="S" obligation="informative">
680
- <title>Bibliography</title>
681
- <references id="T" obligation="informative" normative="false">
682
- <title>Bibliography Subsection</title>
683
- </references>
684
- </clause>
685
- </bibliography>
686
- </iso-standard>
687
- INPUT
688
-
689
- presxml = <<~"PRESXML"
690
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
691
- <bibdata>
692
- <language current="true">zh</language>
693
- <script current="true">Hans</script>
694
- <status>
695
- <stage>published</stage>
696
- <substage>withdrawn</substage>
697
- </status>
698
- <edition language=''>2</edition>
699
- <edition language='zh'>&#x7B2C;&#x7B2C;&#x4E8C;&#x7248;</edition>
700
- <ext>
701
- <doctype>brochure</doctype>
702
- </ext>
703
- </bibdata>
704
- <preface>
705
- <foreword obligation="informative" displayorder="1">
706
- <title>Foreword</title>
707
- <p id="A">See <xref target="M">&#x6761;5</xref></p>
708
- </foreword>
709
- <introduction id="B" obligation="informative" displayorder="2"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
710
- <title depth="2">Introduction Subsection</title>
711
- </clause>
712
- </introduction></preface><sections>
713
- <clause id="D" obligation="normative" type="scope" displayorder="3">
714
- <title depth="1">1.<tab/>Scope</title>
715
- <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, &#x7B2C;1&#x2013;1 &#x8868;</eref></p>
716
- </clause>
717
- <clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
718
- <title depth="2">3.1.<tab/>Normal Terms</title>
719
- <term id="J"><name>3.1.1.</name>
720
- <preferred><strong>Term2</strong></preferred>
721
- </term>
722
- </terms>
723
- <definitions id="K"><title>3.2.</title>
724
- <dl>
725
- <dt>Symbol</dt>
726
- <dd>Definition</dd>
727
- </dl>
728
- </definitions>
729
- </clause>
730
- <definitions id="L" displayorder="6"><title>4.</title>
731
- <dl>
732
- <dt>Symbol</dt>
733
- <dd>Definition</dd>
734
- </dl>
735
- </definitions>
736
- <clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
737
- <title depth="2">5.1.<tab/>Introduction</title>
738
- </clause>
739
- <clause id="O" inline-header="false" obligation="normative">
740
- <title depth="2">5.2.<tab/>Clause 4.2</title>
741
- </clause></clause>
742
- </sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
743
- <title><strong>&#x9644;&#x4EF6;A</strong><br/>&#xFF08;&#x89C4;&#x8303;&#x6027;&#x9644;&#x5F55;&#xFF09;<br/><br/><strong>Annex</strong></title>
744
- <clause id="Q" inline-header="false" obligation="normative">
745
- <title depth="2">A.1.<tab/>Annex A.1</title>
746
- <clause id="Q1" inline-header="false" obligation="normative">
747
- <title depth="3">A.1.1.<tab/>Annex A.1a</title>
748
- </clause>
749
- </clause>
750
- </annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
751
- <title depth="1">2.<tab/>Normative References</title>
752
- <bibitem id="ISO712" type="standard">
753
- <formattedref><em>Cereals and cereal products</em>.</formattedref>
754
- <docidentifier>ISO 712</docidentifier>
755
- </bibitem>
756
- </references><clause id="S" obligation="informative" displayorder="9">
757
- <title depth="1">Bibliography</title>
758
- <references id="T" obligation="informative" normative="false">
759
- <title depth="2">Bibliography Subsection</title>
760
- </references>
761
- </clause>
762
- </bibliography>
763
- </iso-standard>
764
- PRESXML
765
-
766
- output = <<~"OUTPUT"
767
- #{HTML_HDR.gsub(/ lang="en">/, ' lang="zh">')}
768
- <br/>
769
- <div>
770
- <h1 class="ForewordTitle">Foreword</h1>
771
- <p id='A'>
772
- See
773
- <a href='#M'>&#26465;5</a>
774
- </p>
775
- </div>
776
- <br/>
777
- <div class="Section3" id="B">
778
- <h1 class="IntroTitle">Introduction</h1>
779
- <div id="C">
780
- <h2>Introduction Subsection</h2>
781
- </div>
782
- </div>
783
- <p class="zzSTDTitle1"/>
784
- <div id="D">
785
- <h1>1.&#12288;Scope</h1>
786
- <p id="E">
787
- <a href='#ISO712'>ISO 712, &#31532;1&#8211;1 &#34920;</a>
788
- </p>
789
- </div>
790
- <div>
791
- <h1>2.&#12288;Normative References</h1>
792
- <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i>.</p>
793
- </div>
794
- <div id="H"><h1>3.&#12288;Terms, definitions, symbols and abbreviated terms</h1>
795
- <div id="I">
796
- <h2>3.1.&#12288;Normal Terms</h2>
797
- <p class="TermNum" id="J">3.1.1.</p>
798
- <p class="Terms" style="text-align:left;"><b>Term2</b></p>
799
- </div><div id="K"><h2>3.2.</h2>
800
- <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
801
- </div></div>
802
- <div id="L" class="Symbols">
803
- <h1>4.</h1>
804
- <dl>
805
- <dt>
806
- <p>Symbol</p>
807
- </dt>
808
- <dd>Definition</dd>
809
- </dl>
810
- </div>
811
- <div id="M">
812
- <h1>5.&#12288;Clause 4</h1>
813
- <div id="N">
814
- <h2>5.1.&#12288;Introduction</h2>
815
- </div>
816
- <div id="O">
817
- <h2>5.2.&#12288;Clause 4.2</h2>
818
- </div>
819
- </div>
820
- <br/>
821
- <div id="P" class="Section3">
822
- <h1 class="Annex"><b>&#38468;&#20214;A</b><br/>&#65288;&#35268;&#33539;&#24615;&#38468;&#24405;&#65289;<br/><br/><b>Annex</b></h1>
823
- <div id="Q">
824
- <h2>A.1.&#12288;Annex A.1</h2>
825
- <div id="Q1">
826
- <h3>A.1.1.&#12288;Annex A.1a</h3>
827
- </div>
828
- </div>
829
- </div>
830
- <br/>
831
- <div>
832
- <h1 class="Section3">Bibliography</h1>
833
- <div>
834
- <h2 class="Section3">Bibliography Subsection</h2>
835
- </div>
836
- </div>
837
- </div>
838
- </body>
839
- </html>
840
- OUTPUT
841
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
842
- .convert("test", input, true)
843
- .sub(%r{<localized-strings>.*</localized-strings>}m, "")))
844
- .to be_equivalent_to xmlpp(presxml)
845
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
846
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
847
- end
848
-
849
- it "processes i18n file" do
850
- mock_i18n
851
- input = <<~"INPUT"
852
- <iso-standard xmlns="http://riboseinc.com/isoxml">
853
- <bibdata>
854
- <language>eo</language>
855
- <script>Latn</script>
856
- <status>
857
- <stage>published</stage>
858
- <substage>withdrawn</substage>
859
- </status>
860
- <edition>2</edition>
861
- <ext>
862
- <doctype>brochure</doctype>
863
- </ext>
864
- </bibdata>
865
- <preface>
866
- <foreword obligation="informative">
867
- <title>Foreword</title>
868
- <p id="A">See <xref target="M"/></p>
869
- <p id="A">See <xref target="tab"/></p>
870
- <table id="tab"/>
871
- </foreword>
872
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
873
- <title>Introduction Subsection</title>
874
- </clause>
875
- </introduction></preface><sections>
876
- <clause id="D" obligation="normative" type="scope">
877
- <title>Scope</title>
878
- <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
879
- </clause>
880
- <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
881
- <title>Normal Terms</title>
882
- <term id="J">
883
- <preferred><expression><name>Term2</name></expression></preferred>
884
- </term>
885
- </terms>
886
- <definitions id="K">
887
- <dl>
888
- <dt>Symbol</dt>
889
- <dd>Definition</dd>
890
- </dl>
891
- </definitions>
892
- </clause>
893
- <definitions id="L">
894
- <dl>
895
- <dt>Symbol</dt>
896
- <dd>Definition</dd>
897
- </dl>
898
- </definitions>
899
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
900
- <title>Introduction</title>
901
- <note id="M-n1"/>
902
- </clause>
903
- <clause id="O" inline-header="false" obligation="normative">
904
- <title>Clause 4.2</title>
905
- </clause></clause>
906
- </sections><annex id="P" inline-header="false" obligation="normative">
907
- <title>Annex</title>
908
- <clause id="Q" inline-header="false" obligation="normative">
909
- <title>Annex A.1</title>
910
- <clause id="Q1" inline-header="false" obligation="normative">
911
- <title>Annex A.1a</title>
912
- </clause>
913
- </clause>
914
- </annex><bibliography><references id="R" obligation="informative" normative="true">
915
- <title>Normative References</title>
916
- <bibitem id="ISO712" type="standard">
917
- <title format="text/plain">Cereals and cereal products</title>
918
- <docidentifier>ISO 712</docidentifier>
919
- <contributor>
920
- <role type="publisher"/>
921
- <organization>
922
- <abbreviation>ISO</abbreviation>
923
- </organization>
924
- </contributor>
925
- </bibitem>
926
- </references><clause id="S" obligation="informative">
927
- <title>Bibliography</title>
928
- <references id="T" obligation="informative" normative="false">
929
- <title>Bibliography Subsection</title>
930
- </references>
931
- </clause>
932
- </bibliography>
933
- </iso-standard>
934
- INPUT
935
-
936
- presxml = <<~OUTPUT
937
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
938
- <bibdata>
939
- <language current="true">eo</language>
940
- <script current="true">Latn</script>
941
- <status>
942
- <stage language="">published</stage><stage language="eo">publikigita</stage>
943
- <substage language="">withdrawn</substage><substage language="eo">fortirita</substage>
944
- </status>
945
- <edition language=''>2</edition>
946
- <edition language='eo'>eldono dua</edition>
947
- <ext>
948
- <doctype language="">brochure</doctype><doctype language="eo">bro&#x15D;uro</doctype>
949
- </ext>
950
- </bibdata><localized-strings><localized-string key="foreword" language="eo">Anta&#x16D;parolo</localized-string><localized-string key="introduction" language="eo">Enkonduko</localized-string><localized-string key="clause" language="eo">kla&#x16D;zo</localized-string><localized-string key="table" language="eo">tabelo</localized-string><localized-string key="source" language="eo">SOURCE</localized-string><localized-string key="modified" language="eo">modified</localized-string><localized-string key="scope" language="eo">Amplekso</localized-string><localized-string key="symbols" language="eo">Simboloj kai mallongigitaj terminoj</localized-string><localized-string key="annex" language="eo"><strong>aldono</strong></localized-string><localized-string key="normref" language="eo">Normaj cita&#x135;oj</localized-string><localized-string key="bibliography" language="eo">Bibliografio</localized-string><localized-string key="inform_annex" language="eo">informa</localized-string><localized-string key="all_parts" language="eo">&#x109;iuj partoj</localized-string><localized-string key="norm_annex" language="eo">normative</localized-string><localized-string key='figure' language='eo'>figur-etikedo duvorta</localized-string><localized-string key='example' language='eo'>Ekzempl-etikedo Duvorta</localized-string><localized-string key="note" language="eo">NOTO</localized-string><localized-string key="locality.table" language="eo">Tabelo</localized-string><localized-string key="doctype_dict.brochure" language="eo">bro&#x15D;uro</localized-string><localized-string key="doctype_dict.conference_proceedings" language="eo">konferencaktoj</localized-string><localized-string key="stage_dict.published" language="eo">publikigita</localized-string><localized-string key="substage_dict.withdrawn" language="eo">fortirita</localized-string><localized-string key="array.0" language="eo">elem1</localized-string><localized-string key="array.1" language="eo">elem2</localized-string><localized-string key="array.2.elem3" language="eo">elem4</localized-string><localized-string key="array.2.elem5" language="eo">elem6</localized-string>
951
- <localized-string key='ordinal_keys.0' language='eo'>number</localized-string>
952
- <localized-string key='SpelloutRules.sg' language='eo'>spellout-ordinal</localized-string>
953
- <localized-string key='SpelloutRules.pl' language='eo'>spellout-ordinal</localized-string>
954
- <localized-string key='edition_ordinal' language='eo'>eldono %Spellout</localized-string>
955
- <localized-string key='edition' language='eo'>eldono</localized-string>
956
- <localized-string key="language" language="eo">eo</localized-string><localized-string key="script" language="eo">Latn</localized-string></localized-strings>
957
- <preface>
958
- <foreword obligation="informative" displayorder="1">
959
- <title>Foreword</title>
960
- <p id="A">See <xref target="M">kla&#x16D;zo 5</xref></p>
961
- <p id="A">See <xref target="tab">tabelo 1</xref></p>
962
- <table id="tab"><name>Tabelo 1</name></table>
963
- </foreword>
964
- <introduction id="B" obligation="informative" displayorder="2"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
965
- <title depth="2">Introduction Subsection</title>
966
- </clause>
967
- </introduction></preface><sections>
968
- <clause id="D" obligation="normative" type="scope" displayorder="3">
969
- <title depth="1">1.<tab/>Scope</title>
970
- <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Tabelo 1&#x2013;1</eref></p>
971
- </clause>
972
- <clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
973
- <title depth="2">3.1.<tab/>Normal Terms</title>
974
- <term id="J"><name>3.1.1.</name>
975
- <preferred><strong>Term2</strong></preferred>
976
- </term>
977
- </terms>
978
- <definitions id="K"><title>3.2.</title>
979
- <dl>
980
- <dt>Symbol</dt>
981
- <dd>Definition</dd>
982
- </dl>
983
- </definitions>
984
- </clause>
985
- <definitions id="L" displayorder="6"><title>4.</title>
986
- <dl>
987
- <dt>Symbol</dt>
988
- <dd>Definition</dd>
989
- </dl>
990
- </definitions>
991
- <clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
992
- <title depth="2">5.1.<tab/>Introduction</title>
993
- <note id="M-n1"><name>NOTO </name></note>
994
- </clause>
995
- <clause id="O" inline-header="false" obligation="normative">
996
- <title depth="2">5.2.<tab/>Clause 4.2</title>
997
- </clause></clause>
998
- </sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
999
- <title><strong><strong>Aldono</strong> A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
1000
- <clause id="Q" inline-header="false" obligation="normative">
1001
- <title depth="2">A.1.<tab/>Annex A.1</title>
1002
- <clause id="Q1" inline-header="false" obligation="normative">
1003
- <title depth="3">A.1.1.<tab/>Annex A.1a</title>
1004
- </clause>
1005
- </clause>
1006
- </annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
1007
- <title depth="1">2.<tab/>Normative References</title>
1008
- <bibitem id="ISO712" type="standard">
1009
- <formattedref><em>Cereals and cereal products</em>.</formattedref>
1010
- <docidentifier>ISO 712</docidentifier>
1011
- </bibitem>
1012
- </references><clause id="S" obligation="informative" displayorder="9">
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>&#160;</p>
1028
- </div>
1029
- <br/>
1030
- <div class='prefatory-section'>
1031
- <p>&#160;</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&#365;zo 5</a>
1041
- </p>
1042
- <p id='A'>
1043
- See
1044
- <a href='#tab'>tabelo 1</a>
1045
- </p>
1046
- <p class='TableTitle' style='text-align:center;'>Tabelo 1</p>
1047
- <table id='tab' class='MsoISOTable' style='border-width:1px;border-spacing:0;'/>
1048
- </div>
1049
- <br/>
1050
- <div class='Section3' id='B'>
1051
- <h1 class='IntroTitle'>Introduction</h1>
1052
- <div id='C'>
1053
- <h2>Introduction Subsection</h2>
1054
- </div>
1055
- </div>
1056
- <p class='zzSTDTitle1'/>
1057
- <div id='D'>
1058
- <h1>1.&#160; Scope</h1>
1059
- <p id='E'>
1060
- <a href='#ISO712'>ISO 712, Tabelo 1&#8211;1</a>
1061
- </p>
1062
- </div>
1063
- <div>
1064
- <h1>2.&#160; Normative References</h1>
1065
- <p id='ISO712' class='NormRef'>
1066
- ISO 712,
1067
- <i>Cereals and cereal products</i>.
1068
- </p>
1069
- </div>
1070
- <div id='H'>
1071
- <h1>3.&#160; Terms, definitions, symbols and abbreviated terms</h1>
1072
- <div id='I'>
1073
- <h2>3.1.&#160; Normal Terms</h2>
1074
- <p class='TermNum' id='J'>3.1.1.</p>
1075
- <p class='Terms' style='text-align:left;'><b>Term2</b></p>
1076
- </div>
1077
- <div id='K'>
1078
- <h2>3.2.</h2>
1079
- <dl>
1080
- <dt>
1081
- <p>Symbol</p>
1082
- </dt>
1083
- <dd>Definition</dd>
1084
- </dl>
1085
- </div>
1086
- </div>
1087
- <div id='L' class='Symbols'>
1088
- <h1>4.</h1>
1089
- <dl>
1090
- <dt>
1091
- <p>Symbol</p>
1092
- </dt>
1093
- <dd>Definition</dd>
1094
- </dl>
1095
- </div>
1096
- <div id='M'>
1097
- <h1>5.&#160; Clause 4</h1>
1098
- <div id='N'>
1099
- <h2>5.1.&#160; Introduction</h2>
1100
- <div id='M-n1' class='Note'>
1101
- <p>
1102
- <span class='note_label'>NOTO </span>
1103
- &#160;
1104
- </p>
1105
- </div>
1106
- </div>
1107
- <div id='O'>
1108
- <h2>5.2.&#160; Clause 4.2</h2>
1109
- </div>
1110
- </div>
1111
- <br/>
1112
- <div id='P' class='Section3'>
1113
- <h1 class='Annex'>
1114
- <b><b>Aldono</b> A</b>
1115
- <br/>
1116
- (normative)
1117
- <br/>
1118
- <br/>
1119
- <b>Annex</b>
1120
- </h1>
1121
- <div id='Q'>
1122
- <h2>A.1.&#160; Annex A.1</h2>
1123
- <div id='Q1'>
1124
- <h3>A.1.1.&#160; Annex A.1a</h3>
1125
- </div>
1126
- </div>
1127
- </div>
1128
- <br/>
1129
- <div>
1130
- <h1 class='Section3'>Bibliography</h1>
1131
- <div>
1132
- <h2 class='Section3'>Bibliography Subsection</h2>
1133
- </div>
1134
- </div>
1135
- </div>
1136
- </body>
1137
- </html>
1138
- OUTPUT
1139
-
1140
- expect(xmlpp(IsoDoc::PresentationXMLConvert
1141
- .new({ i18nyaml: "spec/assets/i18n.yaml" })
1142
- .convert("test", input, true)))
1143
- .to be_equivalent_to xmlpp(presxml)
1144
- expect(xmlpp(IsoDoc::HtmlConvert
1145
- .new({ i18nyaml: "spec/assets/i18n.yaml" })
1146
- .convert("test", presxml, true)))
1147
- .to be_equivalent_to xmlpp(output)
1148
- end
1149
-
1150
- it "processes LTR within RTL" do
1151
- c = IsoDoc::Convert.new({})
1152
- c.convert_init(<<~"INPUT", "test", false)
1153
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1154
- <bibdata type="standard">
1155
- <language>fa</language>
1156
- <script>Arab</script>
1157
- </bibdata>
1158
- </iso-standard>
1159
- INPUT
1160
- expect(c.i18n.l10n("hello!", "en", "Latn")).to eq "&#x200e;hello!&#x200e;"
1161
- end
1162
-
1163
- it "processes Hebrew RTL within LTR" do
1164
- c = IsoDoc::Convert.new({})
1165
- c.convert_init(<<~"INPUT", "test", false)
1166
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1167
- <bibdata type="standard">
1168
- <language>en</language>
1169
- </bibdata>
1170
- </iso-standard>
1171
- INPUT
1172
- expect(c.i18n.l10n("hello!", "he", "Hebr")).to eq "&#x200f;hello!&#x200f;"
1173
- end
1174
-
1175
- it "processes Arabic RTL within LTR" do
1176
- c = IsoDoc::Convert.new({})
1177
- c.convert_init(<<~"INPUT", "test", false)
1178
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1179
- <bibdata type="standard">
1180
- <language>en</language>
1181
- </bibdata>
1182
- </iso-standard>
1183
- INPUT
1184
- expect(c.i18n.l10n("hello!", "fa", "Arab")).to eq "&#x61c;hello!&#x61c;"
1185
- end
1186
-
1187
- private
1188
-
1189
- def mock_i18n
1190
- allow_any_instance_of(::IsoDoc::I18n)
1191
- .to receive(:load_yaml)
1192
- .with("eo", "Latn", nil, nil)
1193
- .and_return(IsoDoc::I18n.new("eo", "Latn")
1194
- .normalise_hash(YAML.load_file("spec/assets/i18n.yaml")))
1195
- allow_any_instance_of(::IsoDoc::I18n)
1196
- .to receive(:load_yaml)
1197
- .with("eo", "Latn", "spec/assets/i18n.yaml", nil)
1198
- .and_return(IsoDoc::I18n.new("eo", "Latn")
1199
- .normalise_hash(YAML.load_file("spec/assets/i18n.yaml")))
1200
- end
1201
- end