metanorma-iec 1.1.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +0 -1
  3. data/.github/workflows/ubuntu.yml +10 -7
  4. data/.github/workflows/windows.yml +0 -1
  5. data/Rakefile +2 -0
  6. data/lib/asciidoctor/iec/converter.rb +6 -15
  7. data/lib/asciidoctor/iec/isodoc.rng +12 -6
  8. data/lib/isodoc/iec/base_convert.rb +9 -41
  9. data/lib/isodoc/iec/html/htmlstyle.css +962 -0
  10. data/lib/isodoc/iec/html/htmlstyle.scss +0 -3
  11. data/lib/isodoc/iec/html/isodoc.css +845 -0
  12. data/lib/isodoc/iec/html/isodoc.scss +0 -1
  13. data/lib/isodoc/iec/html/wordstyle.css +2013 -0
  14. data/lib/isodoc/iec/html/wordstyle.scss +0 -1
  15. data/lib/isodoc/iec/html_convert.rb +2 -0
  16. data/lib/isodoc/iec/i18n-en.yaml +13 -0
  17. data/lib/isodoc/iec/i18n-fr.yaml +13 -0
  18. data/lib/isodoc/iec/i18n-zh-Hans.yaml +11 -0
  19. data/lib/isodoc/iec/i18n.rb +19 -0
  20. data/lib/isodoc/iec/iec.international-standard.xsl +1302 -1227
  21. data/lib/isodoc/iec/init.rb +29 -0
  22. data/lib/isodoc/iec/presentation_xml_convert.rb +26 -1
  23. data/lib/isodoc/iec/word_convert.rb +5 -3
  24. data/lib/isodoc/iec/xref.rb +1 -1
  25. data/lib/metanorma/iec/processor.rb +0 -4
  26. data/lib/metanorma/iec/version.rb +1 -1
  27. data/metanorma-iec.gemspec +3 -2
  28. data/spec/asciidoctor-iec/blocks_spec.rb +1 -1
  29. data/spec/asciidoctor-iec/cleanup_spec.rb +2 -2
  30. data/spec/asciidoctor-iec/iev_spec.rb +74 -1
  31. data/spec/asciidoctor-iec/inline_spec.rb +1 -1
  32. data/spec/asciidoctor-iec/section_spec.rb +17 -15
  33. data/spec/isodoc/blocks_spec.rb +66 -1
  34. data/spec/isodoc/i18n_spec.rb +296 -244
  35. data/spec/isodoc/iev_spec.rb +221 -14
  36. data/spec/isodoc/inline_spec.rb +97 -73
  37. data/spec/isodoc/iso_spec.rb +6 -0
  38. data/spec/isodoc/postproc_spec.rb +15 -29
  39. data/spec/isodoc/ref_spec.rb +129 -2
  40. data/spec/isodoc/section_spec.rb +112 -102
  41. data/spec/isodoc/terms_spec.rb +67 -53
  42. data/spec/metanorma/processor_spec.rb +2 -1
  43. metadata +25 -9
  44. data/lib/asciidoctor/iec/i18n-en.yaml +0 -12
  45. data/lib/asciidoctor/iec/i18n-fr.yaml +0 -11
  46. data/lib/asciidoctor/iec/i18n-zh-Hans.yaml +0 -9
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
4
  it "processes English" do
5
- expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ input = <<~INPUT
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <bibdata>
8
8
  <docnumber>1</docnumber>
@@ -18,7 +18,7 @@ RSpec.describe IsoDoc do
18
18
  </clause>
19
19
  <p>This is patent boilerplate</p>
20
20
  </introduction></preface><sections>
21
- <clause id="D" obligation="normative">
21
+ <clause id="D" obligation="normative" type="scope">
22
22
  <title>Scope</title>
23
23
  <p id="E">Text</p>
24
24
  </clause>
@@ -71,6 +71,78 @@ RSpec.describe IsoDoc do
71
71
  </bibliography>
72
72
  </iso-standard>
73
73
  INPUT
74
+
75
+ presxml = <<~OUTPUT
76
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
77
+ <bibdata>
78
+ <docnumber>1</docnumber>
79
+ <language>en</language>
80
+ </bibdata>
81
+ <preface>
82
+ <foreword obligation="informative">
83
+ <title>Foreword</title>
84
+ <p id="A">This is a preamble</p>
85
+ </foreword>
86
+ <introduction id="B" obligation="informative"><title depth="1">0<tab/>Introduction</title><clause id="C" inline-header="false" obligation="informative">
87
+ <title depth="2">0.1<tab/>Introduction Subsection</title>
88
+ </clause>
89
+ <p>This is patent boilerplate</p>
90
+ </introduction></preface><sections>
91
+ <clause id="D" obligation="normative" type="scope">
92
+ <title depth="1">1<tab/>Scope</title>
93
+ <p id="E">Text</p>
94
+ </clause>
95
+
96
+ <clause id="H" obligation="normative"><title depth="1">3<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
97
+ <title depth="2">3.1<tab/>Normal Terms</title>
98
+ <term id="J"><name>3.1.1</name>
99
+ <preferred>Term2</preferred>
100
+ </term>
101
+ </terms>
102
+ <definitions id="K"><title>3.2</title>
103
+ <dl>
104
+ <dt>Symbol</dt>
105
+ <dd>Definition</dd>
106
+ </dl>
107
+ </definitions>
108
+ </clause>
109
+ <definitions id="L"><title>4</title>
110
+ <dl>
111
+ <dt>Symbol</dt>
112
+ <dd>Definition</dd>
113
+ </dl>
114
+ </definitions>
115
+ <clause id="M" inline-header="false" obligation="normative"><title depth="1">5<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
116
+ <title depth="2">5.1<tab/>Introduction</title>
117
+ </clause>
118
+ <clause id="O" inline-header="false" obligation="normative">
119
+ <title depth="2">5.2<tab/>Clause 4.2</title>
120
+ </clause></clause>
121
+
122
+ </sections><annex id="P" inline-header="false" obligation="normative">
123
+ <title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
124
+ <clause id="Q" inline-header="false" obligation="normative">
125
+ <title depth="2">A.1<tab/>Annex A.1</title>
126
+ <clause id="Q1" inline-header="false" obligation="normative">
127
+ <title depth="3">A.1.1<tab/>Annex A.1a</title>
128
+ </clause>
129
+ </clause>
130
+ <appendix id="Q2" inline-header="false" obligation="normative">
131
+ <title depth="2">Appendix 1<tab/>An Appendix</title>
132
+ </appendix>
133
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
134
+ <title depth="1">2<tab/>Normative References</title>
135
+ </references><clause id="S" obligation="informative">
136
+ <title depth="1">Bibliography</title>
137
+ <references id="T" obligation="informative" normative="false">
138
+ <title depth="2">Bibliography Subsection</title>
139
+ </references>
140
+ </clause>
141
+ </bibliography>
142
+ </iso-standard>
143
+ OUTPUT
144
+
145
+ html = <<~OUTPUT
74
146
  #{HTML_HDR}
75
147
  <div>
76
148
  <h1 class="ForewordTitle">FOREWORD</h1>
@@ -79,7 +151,7 @@ RSpec.describe IsoDoc do
79
151
  </div>
80
152
  <br/>
81
153
  <div class="Section3" id="B">
82
- <h1 class="IntroTitle">0&#160; INTRODUCTION</h1>
154
+ <h1 class="IntroTitle">0&#160; Introduction</h1>
83
155
  <div id="C"><h2>0.1&#160; Introduction Subsection</h2>
84
156
 
85
157
  </div>
@@ -91,7 +163,7 @@ RSpec.describe IsoDoc do
91
163
  <p id="E">Text</p>
92
164
  </div>
93
165
  <div>
94
- <h1>2&#160; Normative references</h1>
166
+ <h1>2&#160; Normative References</h1>
95
167
  </div>
96
168
  <div id="H"><h1>3&#160; Terms, definitions, symbols and abbreviated terms</h1>
97
169
  <div id="I"><h2>3.1&#160; Normal Terms</h2>
@@ -99,11 +171,11 @@ RSpec.describe IsoDoc do
99
171
  <p class="TermNum" id="J">3.1.1</p>
100
172
  <p class="Terms" style="text-align:left;">Term2</p>
101
173
 
102
- </div><div id="K"><h2>3.2&#160; Symbols and abbreviated terms</h2>
174
+ </div><div id="K"><h2>3.2</h2>
103
175
  <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
104
176
  </div></div>
105
177
  <div id="L" class="Symbols">
106
- <h1>4&#160; Symbols and abbreviated terms</h1>
178
+ <h1>4</h1>
107
179
  <dl>
108
180
  <dt>
109
181
  <p>Symbol</p>
@@ -122,7 +194,7 @@ RSpec.describe IsoDoc do
122
194
  </div>
123
195
  <br/>
124
196
  <div id="P" class="Section3">
125
- <h1 class="Annex"><b>Annex A</b><br/><br/>(normative)<br/><br/><b>Annex</b></h1>
197
+ <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
126
198
  <div id="Q"><h2>A.1&#160; Annex A.1</h2>
127
199
 
128
200
  <div id="Q1"><h3>A.1.1&#160; Annex A.1a</h3>
@@ -144,10 +216,12 @@ RSpec.describe IsoDoc do
144
216
  </body>
145
217
  </html>
146
218
  OUTPUT
219
+ expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
220
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
147
221
  end
148
222
 
149
223
  it "defaults to English" do
150
- expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
224
+ expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
151
225
  <iso-standard xmlns="http://riboseinc.com/isoxml">
152
226
  <bibdata>
153
227
  <language>tlh</language>
@@ -162,7 +236,7 @@ RSpec.describe IsoDoc do
162
236
  </clause>
163
237
  <p>This is patent boilerplate</p>
164
238
  </introduction></preface><sections>
165
- <clause id="D" obligation="normative">
239
+ <clause id="D" obligation="normative" type="scope">
166
240
  <title>Scope</title>
167
241
  <p id="E">Text</p>
168
242
  </clause>
@@ -215,83 +289,146 @@ RSpec.describe IsoDoc do
215
289
  </bibliography>
216
290
  </iso-standard>
217
291
  INPUT
218
- #{HTML_HDR.gsub(/"en"/, '"tlh"')}
219
- <div>
220
- <h1 class="ForewordTitle">FOREWORD</h1>
221
- <div class="boilerplate_legal"/>
222
- <p id="A">This is a preamble</p>
223
- </div>
224
- <br/>
225
- <div class="Section3" id="B">
226
- <h1 class="IntroTitle">0&#160; INTRODUCTION</h1>
227
- <div id="C"><h2>0.1&#160; Introduction Subsection</h2>
228
-
229
- </div>
230
- <p>This is patent boilerplate</p>
231
- </div>
232
- #{IEC_TITLE1}
233
- <div id="D">
234
- <h1>1&#160; Scope</h1>
235
- <p id="E">Text</p>
236
- </div>
237
- <div>
238
- <h1>2&#160; Normative references</h1>
239
- </div>
240
- <div id="H"><h1>3&#160; Terms, definitions, symbols and abbreviated terms</h1>
241
- <div id="I"><h2>3.1&#160; Normal Terms</h2>
242
-
243
- <p class="TermNum" id="J">3.1.1</p>
244
- <p class="Terms" style="text-align:left;">Term2</p>
245
-
246
- </div><div id="K"><h2>3.2&#160; Symbols and abbreviated terms</h2>
247
- <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
248
- </div></div>
249
- <div id="L" class="Symbols">
250
- <h1>4&#160; Symbols and abbreviated terms</h1>
292
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
293
+ <bibdata>
294
+ <language>tlh</language>
295
+ </bibdata>
296
+ <preface>
297
+ <foreword obligation='informative'>
298
+ <title>Foreword</title>
299
+ <p id='A'>This is a preamble</p>
300
+ </foreword>
301
+ <introduction id='B' obligation='informative'>
302
+ <title depth='1'>
303
+ 0
304
+ <tab/>
305
+ Introduction
306
+ </title>
307
+ <clause id='C' inline-header='false' obligation='informative'>
308
+ <title depth='2'>
309
+ 0.1
310
+ <tab/>
311
+ Introduction Subsection
312
+ </title>
313
+ </clause>
314
+ <p>This is patent boilerplate</p>
315
+ </introduction>
316
+ </preface>
317
+ <sections>
318
+ <clause id='D' obligation='normative' type="scope">
319
+ <title depth='1'>
320
+ 1
321
+ <tab/>
322
+ Scope
323
+ </title>
324
+ <p id='E'>Text</p>
325
+ </clause>
326
+ <clause id='H' obligation='normative'>
327
+ <title depth='1'>
328
+ 3
329
+ <tab/>
330
+ Terms, definitions, symbols and abbreviated terms
331
+ </title>
332
+ <terms id='I' obligation='normative'>
333
+ <title depth='2'>
334
+ 3.1
335
+ <tab/>
336
+ Normal Terms
337
+ </title>
338
+ <term id='J'>
339
+ <name>3.1.1</name>
340
+ <preferred>Term2</preferred>
341
+ </term>
342
+ </terms>
343
+ <definitions id='K'>
344
+ <title>3.2</title>
251
345
  <dl>
252
- <dt>
253
- <p>Symbol</p>
254
- </dt>
346
+ <dt>Symbol</dt>
255
347
  <dd>Definition</dd>
256
348
  </dl>
257
- </div>
258
- <div id="M">
259
- <h1>5&#160; Clause 4</h1>
260
- <div id="N"><h2>5.1&#160; Introduction</h2>
261
-
262
- </div>
263
- <div id="O"><h2>5.2&#160; Clause 4.2</h2>
264
-
265
- </div>
266
- </div>
349
+ </definitions>
350
+ </clause>
351
+ <definitions id='L'>
352
+ <title>4</title>
353
+ <dl>
354
+ <dt>Symbol</dt>
355
+ <dd>Definition</dd>
356
+ </dl>
357
+ </definitions>
358
+ <clause id='M' inline-header='false' obligation='normative'>
359
+ <title depth='1'>
360
+ 5
361
+ <tab/>
362
+ Clause 4
363
+ </title>
364
+ <clause id='N' inline-header='false' obligation='normative'>
365
+ <title depth='2'>
366
+ 5.1
367
+ <tab/>
368
+ Introduction
369
+ </title>
370
+ </clause>
371
+ <clause id='O' inline-header='false' obligation='normative'>
372
+ <title depth='2'>
373
+ 5.2
374
+ <tab/>
375
+ Clause 4.2
376
+ </title>
377
+ </clause>
378
+ </clause>
379
+ </sections>
380
+ <annex id='P' inline-header='false' obligation='normative'>
381
+ <title>
382
+ <strong>Annex A</strong>
267
383
  <br/>
268
- <div id="P" class="Section3">
269
- <h1 class="Annex"><b>Annex A</b><br/><br/>(normative)<br/><br/><b>Annex</b></h1>
270
- <div id="Q"><h2>A.1&#160; Annex A.1</h2>
271
-
272
- <div id="Q1"><h3>A.1.1&#160; Annex A.1a</h3>
273
-
274
- </div>
275
- </div>
276
- <div id="Q2"><h2>Appendix 1&#160; An Appendix</h2>
277
-
278
- </div>
279
- </div>
384
+ (normative)
280
385
  <br/>
281
- <div>
282
- <h1 class="Section3">Bibliography</h1>
283
- <div>
284
- <h2 class="Section3">Bibliography Subsection</h2>
285
- </div>
286
- </div>
287
- </div>
288
- </body>
289
- </html>
386
+ <br/>
387
+ <strong>Annex</strong>
388
+ </title>
389
+ <clause id='Q' inline-header='false' obligation='normative'>
390
+ <title depth='2'>
391
+ A.1
392
+ <tab/>
393
+ Annex A.1
394
+ </title>
395
+ <clause id='Q1' inline-header='false' obligation='normative'>
396
+ <title depth='3'>
397
+ A.1.1
398
+ <tab/>
399
+ Annex A.1a
400
+ </title>
401
+ </clause>
402
+ </clause>
403
+ <appendix id='Q2' inline-header='false' obligation='normative'>
404
+ <title depth='2'>
405
+ Appendix 1
406
+ <tab/>
407
+ An Appendix
408
+ </title>
409
+ </appendix>
410
+ </annex>
411
+ <bibliography>
412
+ <references id='R' obligation='informative' normative='true'>
413
+ <title depth='1'>
414
+ 2
415
+ <tab/>
416
+ Normative References
417
+ </title>
418
+ </references>
419
+ <clause id='S' obligation='informative'>
420
+ <title depth='1'>Bibliography</title>
421
+ <references id='T' obligation='informative' normative='false'>
422
+ <title depth='2'>Bibliography Subsection</title>
423
+ </references>
424
+ </clause>
425
+ </bibliography>
426
+ </iso-standard>
290
427
  OUTPUT
291
428
  end
292
429
 
293
430
  it "processes French" do
294
- expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
431
+ input = <<~INPUT
295
432
  <iso-standard xmlns="http://riboseinc.com/isoxml">
296
433
  <bibdata>
297
434
  <language>fr</language>
@@ -306,7 +443,7 @@ RSpec.describe IsoDoc do
306
443
  </clause>
307
444
  <p>This is patent boilerplate</p>
308
445
  </introduction></preface><sections>
309
- <clause id="D" obligation="normative">
446
+ <clause id="D" obligation="normative" type="scope">
310
447
  <title>Scope</title>
311
448
  <p id="E">Text</p>
312
449
  </clause>
@@ -359,6 +496,77 @@ RSpec.describe IsoDoc do
359
496
  </bibliography>
360
497
  </iso-standard>
361
498
  INPUT
499
+
500
+ presxml = <<~OUTPUT
501
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
502
+ <bibdata>
503
+ <language>fr</language>
504
+ </bibdata>
505
+ <preface>
506
+ <foreword obligation="informative">
507
+ <title>Foreword</title>
508
+ <p id="A">This is a preamble</p>
509
+ </foreword>
510
+ <introduction id="B" obligation="informative"><title depth="1">0<tab/>Introduction</title><clause id="C" inline-header="false" obligation="informative">
511
+ <title depth="2">0.1<tab/>Introduction Subsection</title>
512
+ </clause>
513
+ <p>This is patent boilerplate</p>
514
+ </introduction></preface><sections>
515
+ <clause id="D" obligation="normative" type="scope">
516
+ <title depth="1">1<tab/>Scope</title>
517
+ <p id="E">Text</p>
518
+ </clause>
519
+
520
+ <clause id="H" obligation="normative"><title depth="1">3<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
521
+ <title depth="2">3.1<tab/>Normal Terms</title>
522
+ <term id="J"><name>3.1.1</name>
523
+ <preferred>Term2</preferred>
524
+ </term>
525
+ </terms>
526
+ <definitions id="K"><title>3.2</title>
527
+ <dl>
528
+ <dt>Symbol</dt>
529
+ <dd>Definition</dd>
530
+ </dl>
531
+ </definitions>
532
+ </clause>
533
+ <definitions id="L"><title>4</title>
534
+ <dl>
535
+ <dt>Symbol</dt>
536
+ <dd>Definition</dd>
537
+ </dl>
538
+ </definitions>
539
+ <clause id="M" inline-header="false" obligation="normative"><title depth="1">5<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
540
+ <title depth="2">5.1<tab/>Introduction</title>
541
+ </clause>
542
+ <clause id="O" inline-header="false" obligation="normative">
543
+ <title depth="2">5.2<tab/>Clause 4.2</title>
544
+ </clause></clause>
545
+
546
+ </sections><annex id="P" inline-header="false" obligation="normative">
547
+ <title><strong>Annexe A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
548
+ <clause id="Q" inline-header="false" obligation="normative">
549
+ <title depth="2">A.1<tab/>Annex A.1</title>
550
+ <clause id="Q1" inline-header="false" obligation="normative">
551
+ <title depth="3">A.1.1<tab/>Annex A.1a</title>
552
+ </clause>
553
+ </clause>
554
+ <appendix id="Q2" inline-header="false" obligation="normative">
555
+ <title depth="2">Appendice 1<tab/>An Appendix</title>
556
+ </appendix>
557
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
558
+ <title depth="1">2<tab/>Normative References</title>
559
+ </references><clause id="S" obligation="informative">
560
+ <title depth="1">Bibliography</title>
561
+ <references id="T" obligation="informative" normative="false">
562
+ <title depth="2">Bibliography Subsection</title>
563
+ </references>
564
+ </clause>
565
+ </bibliography>
566
+ </iso-standard>
567
+ OUTPUT
568
+
569
+ html = <<~OUTPUT
362
570
  #{HTML_HDR.sub(/INTERNATIONAL ELECTROTECHNICAL COMMISSION/, "COMMISSION ELECTROTECHNIQUE INTERNATIONALE").
363
571
  gsub(/"en"/, '"fr"')}
364
572
  <div>
@@ -368,7 +576,7 @@ RSpec.describe IsoDoc do
368
576
  </div>
369
577
  <br/>
370
578
  <div class="Section3" id="B">
371
- <h1 class="IntroTitle">0&#160; INTRODUCTION</h1>
579
+ <h1 class="IntroTitle">0&#160; Introduction</h1>
372
580
  <div id="C"><h2>0.1&#160; Introduction Subsection</h2>
373
581
 
374
582
  </div>
@@ -376,23 +584,23 @@ RSpec.describe IsoDoc do
376
584
  </div>
377
585
  #{IEC_TITLE1}
378
586
  <div id="D">
379
- <h1>1&#160; Domaine d'application</h1>
587
+ <h1>1&#160; Scope</h1>
380
588
  <p id="E">Text</p>
381
589
  </div>
382
590
  <div>
383
- <h1>2&#160; R&#233;f&#233;rences normatives</h1>
591
+ <h1>2&#160; Normative References</h1>
384
592
  </div>
385
- <div id="H"><h1>3&#160; Terms, d&#233;finitions, symboles et termes abr&#233;g&#233;s</h1>
593
+ <div id="H"><h1>3&#160; Terms, definitions, symbols and abbreviated terms</h1>
386
594
  <div id="I"><h2>3.1&#160; Normal Terms</h2>
387
595
 
388
596
  <p class="TermNum" id="J">3.1.1</p>
389
597
  <p class="Terms" style="text-align:left;">Term2</p>
390
598
 
391
- </div><div id="K"><h2>3.2&#160; Symboles et termes abr&#233;g&#233;s</h2>
599
+ </div><div id="K"><h2>3.2</h2>
392
600
  <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
393
601
  </div></div>
394
602
  <div id="L" class="Symbols">
395
- <h1>4&#160; Symboles et termes abr&#233;g&#233;s</h1>
603
+ <h1>4</h1>
396
604
  <dl>
397
605
  <dt>
398
606
  <p>Symbol</p>
@@ -411,7 +619,7 @@ RSpec.describe IsoDoc do
411
619
  </div>
412
620
  <br/>
413
621
  <div id="P" class="Section3">
414
- <h1 class="Annex"><b>Annexe A</b><br/><br/>(normative)<br/><br/><b>Annex</b></h1>
622
+ <h1 class="Annex"><b>Annexe A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
415
623
  <div id="Q"><h2>A.1&#160; Annex A.1</h2>
416
624
 
417
625
  <div id="Q1"><h3>A.1.1&#160; Annex A.1a</h3>
@@ -424,165 +632,7 @@ RSpec.describe IsoDoc do
424
632
  </div>
425
633
  <br/>
426
634
  <div>
427
- <h1 class="Section3">Bibliographie</h1>
428
- <div>
429
- <h2 class="Section3">Bibliography Subsection</h2>
430
- </div>
431
- </div>
432
- </div>
433
- </body>
434
- </html>
435
- OUTPUT
436
- end
437
-
438
- it "processes Simplified Chinese" do
439
- expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
440
- <iso-standard xmlns="http://riboseinc.com/isoxml">
441
- <bibdata>
442
- <language>zh</language>
443
- <script>Hans</script>
444
- </bibdata>
445
- <preface>
446
- <foreword obligation="informative">
447
- <title>Foreword</title>
448
- <p id="A">This is a preamble</p>
449
- </foreword>
450
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
451
- <title>Introduction Subsection</title>
452
- </clause>
453
- <p>This is patent boilerplate</p>
454
- </introduction></preface><sections>
455
- <clause id="D" obligation="normative">
456
- <title>Scope</title>
457
- <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
458
- </clause>
459
-
460
- <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
461
- <title>Normal Terms</title>
462
- <term id="J">
463
- <preferred>Term2</preferred>
464
- </term>
465
- </terms>
466
- <definitions id="K">
467
- <dl>
468
- <dt>Symbol</dt>
469
- <dd>Definition</dd>
470
- </dl>
471
- </definitions>
472
- </clause>
473
- <definitions id="L">
474
- <dl>
475
- <dt>Symbol</dt>
476
- <dd>Definition</dd>
477
- </dl>
478
- </definitions>
479
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
480
- <title>Introduction</title>
481
- </clause>
482
- <clause id="O" inline-header="false" obligation="normative">
483
- <title>Clause 4.2</title>
484
- </clause></clause>
485
-
486
- </sections><annex id="P" inline-header="false" obligation="normative">
487
- <title>Annex</title>
488
- <clause id="Q" inline-header="false" obligation="normative">
489
- <title>Annex A.1</title>
490
- <clause id="Q1" inline-header="false" obligation="normative">
491
- <title>Annex A.1a</title>
492
- </clause>
493
- </clause>
494
- <appendix id="Q2" inline-header="false" obligation="normative">
495
- <title>An Appendix</title>
496
- </appendix>
497
- </annex><bibliography><references id="R" obligation="informative" normative="true">
498
- <title>Normative References</title>
499
- <bibitem id="ISO712" type="standard">
500
- <title format="text/plain">Cereals and cereal products</title>
501
- <docidentifier>ISO 712</docidentifier>
502
- <contributor>
503
- <role type="publisher"/>
504
- <organization>
505
- <abbreviation>ISO</abbreviation>
506
- </organization>
507
- </contributor>
508
- </bibitem>
509
- </references><clause id="S" obligation="informative">
510
- <title>Bibliography</title>
511
- <references id="T" obligation="informative" normative="false">
512
- <title>Bibliography Subsection</title>
513
- </references>
514
- </clause>
515
- </bibliography>
516
- </iso-standard>
517
- INPUT
518
- #{HTML_HDR.gsub(/"en"/, '"zh"').sub(/INTERNATIONAL ELECTROTECHNICAL COMMISSION/, "&#22269;&#38469;&#30005;&#24037;&#22996;&#21592;&#20250;")}
519
- <div>
520
- <h1 class="ForewordTitle">&#21069;&#35328;</h1>
521
- <div class="boilerplate_legal"/>
522
- <p id="A">This is a preamble</p>
523
- </div>
524
- <br/>
525
- <div class="Section3" id="B">
526
- <h1 class="IntroTitle">0&#160; &#24341;&#35328;</h1>
527
- <div id="C"><h2>0.1&#160; Introduction Subsection</h2>
528
-
529
- </div>
530
- <p>This is patent boilerplate</p>
531
- </div>
532
- #{IEC_TITLE1}
533
- <div id="D">
534
- <h1>1&#160; &#33539;&#22260;</h1>
535
- <p id="E">
536
- <a href="#ISO712">ISO 712&#12289;&#31532;1&#8211;<referenceto>1</referenceto>&#34920;</a>
537
- </p>
538
- </div>
539
- <div>
540
- <h1>2&#160; &#35268;&#33539;&#24615;&#24341;&#29992;&#25991;&#20214;</h1>
541
- <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
542
- </div>
543
- <div id="H"><h1>3&#160; &#26415;&#35821;&#12289;&#23450;&#20041;&#12289;&#31526;&#21495;&#12289;&#20195;&#21495;&#21644;&#32553;&#30053;&#35821;</h1>
544
- <div id="I"><h2>3.1&#160; Normal Terms</h2>
545
-
546
- <p class="TermNum" id="J">3.1.1</p>
547
- <p class="Terms" style="text-align:left;">Term2</p>
548
-
549
- </div><div id="K"><h2>3.2&#160; &#31526;&#21495;&#12289;&#20195;&#21495;&#21644;&#32553;&#30053;&#35821;</h2>
550
- <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
551
- </div></div>
552
- <div id="L" class="Symbols">
553
- <h1>4&#160; &#31526;&#21495;&#12289;&#20195;&#21495;&#21644;&#32553;&#30053;&#35821;</h1>
554
- <dl>
555
- <dt>
556
- <p>Symbol</p>
557
- </dt>
558
- <dd>Definition</dd>
559
- </dl>
560
- </div>
561
- <div id="M">
562
- <h1>5&#160; Clause 4</h1>
563
- <div id="N"><h2>5.1&#160; Introduction</h2>
564
-
565
- </div>
566
- <div id="O"><h2>5.2&#160; Clause 4.2</h2>
567
-
568
- </div>
569
- </div>
570
- <br/>
571
- <div id="P" class="Section3">
572
- <h1 class="Annex">&#38468;&#20214;A<br/><br/>&#65288;&#35268;&#33539;&#24615;&#38468;&#24405;&#65289;<br/><br/><b>Annex</b></h1>
573
- <div id="Q"><h2>A.1&#160; Annex A.1</h2>
574
-
575
- <div id="Q1"><h3>A.1.1&#160; Annex A.1a</h3>
576
-
577
- </div>
578
- </div>
579
- <div id="Q2"><h2>&#38468;&#24405;1&#160; An Appendix</h2>
580
-
581
- </div>
582
- </div>
583
- <br/>
584
- <div>
585
- <h1 class="Section3">&#21442;&#32771;&#25991;&#29486;</h1>
635
+ <h1 class="Section3">Bibliography</h1>
586
636
  <div>
587
637
  <h2 class="Section3">Bibliography Subsection</h2>
588
638
  </div>
@@ -591,6 +641,8 @@ RSpec.describe IsoDoc do
591
641
  </body>
592
642
  </html>
593
643
  OUTPUT
644
+ expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
645
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
594
646
  end
595
647
 
596
648
  end