metanorma-iso 1.8.1 → 1.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -13
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -8
- data/lib/asciidoctor/iso/base.rb +1 -0
- data/lib/asciidoctor/iso/biblio.rng +1 -0
- data/lib/asciidoctor/iso/cleanup.rb +17 -5
- data/lib/asciidoctor/iso/front.rb +3 -1
- data/lib/asciidoctor/iso/front_id.rb +66 -50
- data/lib/asciidoctor/iso/isodoc.rng +209 -4
- data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
- data/lib/asciidoctor/iso/isostandard.rng +12 -0
- data/lib/asciidoctor/iso/section.rb +2 -1
- data/lib/asciidoctor/iso/validate_section.rb +16 -9
- data/lib/isodoc/iso/base_convert.rb +13 -13
- data/lib/isodoc/iso/html/isodoc.css +475 -20
- data/lib/isodoc/iso/html/isodoc.scss +456 -23
- data/lib/isodoc/iso/html/wordstyle.css +202 -31
- data/lib/isodoc/iso/html/wordstyle.scss +194 -32
- data/lib/isodoc/iso/iso.amendment.xsl +679 -473
- data/lib/isodoc/iso/iso.international-standard.xsl +679 -473
- data/lib/isodoc/iso/metadata.rb +3 -2
- data/lib/isodoc/iso/presentation_xml_convert.rb +18 -9
- data/lib/isodoc/iso/sts_convert.rb +10 -13
- data/lib/isodoc/iso/word_convert.rb +153 -39
- data/lib/isodoc/iso/xref.rb +42 -27
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -4
- data/spec/asciidoctor/base_spec.rb +426 -334
- data/spec/asciidoctor/blocks_spec.rb +96 -34
- data/spec/asciidoctor/cleanup_spec.rb +383 -25
- data/spec/asciidoctor/section_spec.rb +0 -14
- data/spec/asciidoctor/validate_spec.rb +119 -39
- data/spec/isodoc/amd_spec.rb +193 -201
- data/spec/isodoc/blocks_spec.rb +100 -88
- data/spec/isodoc/i18n_spec.rb +36 -36
- data/spec/isodoc/inline_spec.rb +282 -2
- data/spec/isodoc/iso_spec.rb +86 -138
- data/spec/isodoc/postproc_spec.rb +492 -442
- data/spec/isodoc/ref_spec.rb +6 -6
- data/spec/isodoc/section_spec.rb +301 -306
- data/spec/isodoc/table_spec.rb +166 -231
- data/spec/isodoc/terms_spec.rb +11 -8
- data/spec/isodoc/xref_spec.rb +147 -118
- data/spec/spec_helper.rb +16 -15
- metadata +9 -9
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -318,7 +318,7 @@ RSpec.describe IsoDoc do
|
|
318
318
|
<?xml version='1.0'?>
|
319
319
|
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
320
320
|
<preface>
|
321
|
-
<foreword>
|
321
|
+
<foreword displayorder="1">
|
322
322
|
<p>
|
323
323
|
<eref bibitemid="IEV" citeas="IEV" type="inline">
|
324
324
|
<locality type="clause">
|
@@ -372,7 +372,7 @@ RSpec.describe IsoDoc do
|
|
372
372
|
</foreword>
|
373
373
|
</preface>
|
374
374
|
<bibliography>
|
375
|
-
<references id="_normative_references" normative="true" obligation="informative">
|
375
|
+
<references id="_normative_references" normative="true" obligation="informative" displayorder="2">
|
376
376
|
<title depth="1">1<tab/>
|
377
377
|
Normative References</title>
|
378
378
|
<bibitem id="ISO712" type="standard">
|
@@ -390,4 +390,284 @@ RSpec.describe IsoDoc do
|
|
390
390
|
</iso-standard>
|
391
391
|
OUTPUT
|
392
392
|
end
|
393
|
+
|
394
|
+
it "processes concept markup" do
|
395
|
+
input = <<~INPUT
|
396
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
397
|
+
<preface><foreword>
|
398
|
+
<p>
|
399
|
+
<ul>
|
400
|
+
<li><concept><refterm>term</refterm>
|
401
|
+
<xref target='clause1'/>
|
402
|
+
</concept></li>
|
403
|
+
<li><concept><refterm>term</refterm>
|
404
|
+
<renderterm>term</renderterm>
|
405
|
+
<xref target='clause1'/>
|
406
|
+
</concept></li>
|
407
|
+
<li><concept><refterm>term</refterm>
|
408
|
+
<renderterm>w[o]rd</renderterm>
|
409
|
+
<xref target='clause1'>Clause #1</xref>
|
410
|
+
</concept></li>
|
411
|
+
<li><concept><refterm>term</refterm>
|
412
|
+
<renderterm>term</renderterm>
|
413
|
+
<eref bibitemid="ISO712" type="inline" citeas="ISO 712"/>
|
414
|
+
</concept></li>
|
415
|
+
<li><concept><refterm>term</refterm>
|
416
|
+
<renderterm>word</renderterm>
|
417
|
+
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">The Aforementioned Citation</eref>
|
418
|
+
</concept></li>
|
419
|
+
<li><concept><refterm>term</refterm>
|
420
|
+
<renderterm>word</renderterm>
|
421
|
+
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
422
|
+
<locality type='clause'>
|
423
|
+
<referenceFrom>3.1</referenceFrom>
|
424
|
+
</locality>
|
425
|
+
<locality type='figure'>
|
426
|
+
<referenceFrom>a</referenceFrom>
|
427
|
+
</locality>
|
428
|
+
</eref>
|
429
|
+
</concept></li>
|
430
|
+
<li><concept><refterm>term</refterm>
|
431
|
+
<renderterm>word</renderterm>
|
432
|
+
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
433
|
+
<localityStack>
|
434
|
+
<locality type='clause'>
|
435
|
+
<referenceFrom>3.1</referenceFrom>
|
436
|
+
</locality>
|
437
|
+
</localityStack>
|
438
|
+
<localityStack>
|
439
|
+
<locality type='figure'>
|
440
|
+
<referenceFrom>b</referenceFrom>
|
441
|
+
</locality>
|
442
|
+
</localityStack>
|
443
|
+
</eref>
|
444
|
+
</concept></li>
|
445
|
+
<li><concept><refterm>term</refterm>
|
446
|
+
<renderterm>word</renderterm>
|
447
|
+
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
448
|
+
<localityStack>
|
449
|
+
<locality type='clause'>
|
450
|
+
<referenceFrom>3.1</referenceFrom>
|
451
|
+
</locality>
|
452
|
+
</localityStack>
|
453
|
+
<localityStack>
|
454
|
+
<locality type='figure'>
|
455
|
+
<referenceFrom>b</referenceFrom>
|
456
|
+
</locality>
|
457
|
+
</localityStack>
|
458
|
+
The Aforementioned Citation
|
459
|
+
</eref>
|
460
|
+
</concept></li>
|
461
|
+
<li><concept><refterm>term</refterm>
|
462
|
+
<renderterm>word</renderterm>
|
463
|
+
<termref base='IEV' target='135-13-13'/>
|
464
|
+
</concept></li>
|
465
|
+
<li><concept><refterm>term</refterm>
|
466
|
+
<renderterm>word</renderterm>
|
467
|
+
<termref base='IEV' target='135-13-13'>The IEV database</termref>
|
468
|
+
</concept></li>
|
469
|
+
</ul>
|
470
|
+
</p>
|
471
|
+
</foreword></preface>
|
472
|
+
<sections>
|
473
|
+
<clause id="clause1"><title>Clause 1</title></clause>
|
474
|
+
</sections>
|
475
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
476
|
+
<p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
477
|
+
<bibitem id="ISO712" type="standard">
|
478
|
+
<title format="text/plain">Cereals or cereal products</title>
|
479
|
+
<title type="main" format="text/plain">Cereals and cereal products</title>
|
480
|
+
<docidentifier type="ISO">ISO 712</docidentifier>
|
481
|
+
<contributor>
|
482
|
+
<role type="publisher"/>
|
483
|
+
<organization>
|
484
|
+
<name>International Organization for Standardization</name>
|
485
|
+
</organization>
|
486
|
+
</contributor>
|
487
|
+
</bibitem>
|
488
|
+
</references></bibliography>
|
489
|
+
</iso-standard>
|
490
|
+
INPUT
|
491
|
+
presxml = <<~OUTPUT
|
492
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
493
|
+
<preface><foreword displayorder="1">
|
494
|
+
<p>
|
495
|
+
<ul>
|
496
|
+
<li>
|
497
|
+
(<xref target="clause1">Clause 2</xref>)
|
498
|
+
</li>
|
499
|
+
<li>
|
500
|
+
<em>term</em>
|
501
|
+
(<xref target="clause1">Clause 2</xref>)
|
502
|
+
</li>
|
503
|
+
<li>
|
504
|
+
<em>w[o]rd</em>
|
505
|
+
(<xref target="clause1">Clause #1</xref>)
|
506
|
+
</li>
|
507
|
+
<li>
|
508
|
+
<em>term</em>
|
509
|
+
(<eref bibitemid="ISO712" type="inline" citeas="ISO 712">ISO 712</eref>)
|
510
|
+
</li>
|
511
|
+
<li>
|
512
|
+
<em>word</em>
|
513
|
+
(<eref bibitemid="ISO712" type="inline" citeas="ISO 712">The Aforementioned Citation</eref>)
|
514
|
+
</li>
|
515
|
+
<li>
|
516
|
+
<em>word</em>
|
517
|
+
(<eref bibitemid="ISO712" type="inline" citeas="ISO 712"><locality type="clause">
|
518
|
+
<referenceFrom>3.1</referenceFrom>
|
519
|
+
</locality><locality type="figure">
|
520
|
+
<referenceFrom>a</referenceFrom>
|
521
|
+
</locality>ISO 712, 3.1, Figure a</eref>)
|
522
|
+
</li>
|
523
|
+
<li>
|
524
|
+
<em>word</em>
|
525
|
+
(<eref bibitemid="ISO712" type="inline" citeas="ISO 712"><localityStack>
|
526
|
+
<locality type="clause">
|
527
|
+
<referenceFrom>3.1</referenceFrom>
|
528
|
+
</locality>
|
529
|
+
</localityStack><localityStack>
|
530
|
+
<locality type="figure">
|
531
|
+
<referenceFrom>b</referenceFrom>
|
532
|
+
</locality>
|
533
|
+
</localityStack>ISO 712, 3.1; Figure b</eref>)
|
534
|
+
</li>
|
535
|
+
<li>
|
536
|
+
<em>word</em>
|
537
|
+
(<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
538
|
+
<localityStack>
|
539
|
+
<locality type="clause">
|
540
|
+
<referenceFrom>3.1</referenceFrom>
|
541
|
+
</locality>
|
542
|
+
</localityStack>
|
543
|
+
<localityStack>
|
544
|
+
<locality type="figure">
|
545
|
+
<referenceFrom>b</referenceFrom>
|
546
|
+
</locality>
|
547
|
+
</localityStack>
|
548
|
+
The Aforementioned Citation
|
549
|
+
</eref>)
|
550
|
+
</li>
|
551
|
+
<li>
|
552
|
+
<em>word</em>
|
553
|
+
[term defined in <termref base="IEV" target="135-13-13"/>]
|
554
|
+
</li>
|
555
|
+
<li>
|
556
|
+
<em>word</em>
|
557
|
+
[term defined in <termref base="IEV" target="135-13-13">The IEV database</termref>]
|
558
|
+
</li>
|
559
|
+
</ul>
|
560
|
+
</p>
|
561
|
+
</foreword></preface>
|
562
|
+
<sections>
|
563
|
+
<clause id="clause1" displayorder="3"><title depth="1">2<tab/>Clause 1</title></clause>
|
564
|
+
</sections>
|
565
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder="2"><title depth="1">1<tab/>Normative References</title>
|
566
|
+
<p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
567
|
+
<bibitem id="ISO712" type="standard">
|
568
|
+
<title format="text/plain">Cereals or cereal products</title>
|
569
|
+
<title type="main" format="text/plain">Cereals and cereal products</title>
|
570
|
+
<docidentifier type="ISO">ISO 712</docidentifier>
|
571
|
+
<contributor>
|
572
|
+
<role type="publisher"/>
|
573
|
+
<organization>
|
574
|
+
<name>International Organization for Standardization</name>
|
575
|
+
</organization>
|
576
|
+
</contributor>
|
577
|
+
</bibitem>
|
578
|
+
</references></bibliography>
|
579
|
+
</iso-standard>
|
580
|
+
OUTPUT
|
581
|
+
output = <<~OUTPUT
|
582
|
+
#{HTML_HDR}
|
583
|
+
<br/>
|
584
|
+
<div>
|
585
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
586
|
+
<p>
|
587
|
+
<ul>
|
588
|
+
<li>
|
589
|
+
(
|
590
|
+
<a href='#clause1'>Clause 2</a>
|
591
|
+
)
|
592
|
+
</li>
|
593
|
+
<li>
|
594
|
+
<i>term</i>
|
595
|
+
(
|
596
|
+
<a href='#clause1'>Clause 2</a>
|
597
|
+
)
|
598
|
+
</li>
|
599
|
+
<li>
|
600
|
+
<i>w[o]rd</i>
|
601
|
+
(
|
602
|
+
<a href='#clause1'>Clause #1</a>
|
603
|
+
)
|
604
|
+
</li>
|
605
|
+
<li>
|
606
|
+
<i>term</i>
|
607
|
+
(
|
608
|
+
<a href='#ISO712'>ISO 712</a>
|
609
|
+
)
|
610
|
+
</li>
|
611
|
+
<li>
|
612
|
+
<i>word</i>
|
613
|
+
(
|
614
|
+
<a href='#ISO712'>The Aforementioned Citation</a>
|
615
|
+
)
|
616
|
+
</li>
|
617
|
+
<li>
|
618
|
+
<i>word</i>
|
619
|
+
(
|
620
|
+
<a href='#ISO712'>ISO 712, 3.1, Figure a</a>
|
621
|
+
)
|
622
|
+
</li>
|
623
|
+
<li>
|
624
|
+
<i>word</i>
|
625
|
+
(
|
626
|
+
<a href='#ISO712'>ISO 712, 3.1; Figure b</a>
|
627
|
+
)
|
628
|
+
</li>
|
629
|
+
<li>
|
630
|
+
<i>word</i>
|
631
|
+
(
|
632
|
+
<a href='#ISO712'> The Aforementioned Citation </a>
|
633
|
+
)
|
634
|
+
</li>
|
635
|
+
<li>
|
636
|
+
<i>word</i>
|
637
|
+
[term defined in Termbase IEV, term ID 135-13-13]
|
638
|
+
</li>
|
639
|
+
<li>
|
640
|
+
<i>word</i>
|
641
|
+
[term defined in Termbase IEV, term ID 135-13-13]
|
642
|
+
</li>
|
643
|
+
</ul>
|
644
|
+
</p>
|
645
|
+
</div>
|
646
|
+
<p class='zzSTDTitle1'/>
|
647
|
+
<div>
|
648
|
+
<h1>1  Normative References</h1>
|
649
|
+
<p>
|
650
|
+
The following documents are referred to in the text in such a way that
|
651
|
+
some or all of their content constitutes requirements of this
|
652
|
+
document. For dated references, only the edition cited applies. For
|
653
|
+
undated references, the latest edition of the referenced document
|
654
|
+
(including any amendments) applies.
|
655
|
+
</p>
|
656
|
+
<p id='ISO712' class='NormRef'>
|
657
|
+
ISO 712,
|
658
|
+
<i>Cereals and cereal products</i>
|
659
|
+
</p>
|
660
|
+
</div>
|
661
|
+
<div id='clause1'>
|
662
|
+
<h1>2  Clause 1</h1>
|
663
|
+
</div>
|
664
|
+
</div>
|
665
|
+
</body>
|
666
|
+
</html>
|
667
|
+
OUTPUT
|
668
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
669
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
670
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
|
671
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
672
|
+
end
|
393
673
|
end
|
data/spec/isodoc/iso_spec.rb
CHANGED
@@ -177,8 +177,8 @@ RSpec.describe IsoDoc::Iso do
|
|
177
177
|
OUTPUT
|
178
178
|
end
|
179
179
|
|
180
|
-
it "processes examples
|
181
|
-
|
180
|
+
it "processes examples" do
|
181
|
+
input = <<~INPUT
|
182
182
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
183
183
|
<preface>
|
184
184
|
<foreword>
|
@@ -190,11 +190,11 @@ RSpec.describe IsoDoc::Iso do
|
|
190
190
|
</preface>
|
191
191
|
</iso-standard>
|
192
192
|
INPUT
|
193
|
-
|
193
|
+
presxml = <<~OUTPUT
|
194
194
|
<?xml version='1.0'?>
|
195
195
|
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
196
196
|
<preface>
|
197
|
-
<foreword>
|
197
|
+
<foreword displayorder="1">
|
198
198
|
<example id="samplecode">
|
199
199
|
<name>EXAMPLE — Title</name>
|
200
200
|
<p>Hello</p>
|
@@ -203,22 +203,8 @@ RSpec.describe IsoDoc::Iso do
|
|
203
203
|
</preface>
|
204
204
|
</iso-standard>
|
205
205
|
OUTPUT
|
206
|
-
end
|
207
206
|
|
208
|
-
|
209
|
-
output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
|
210
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
211
|
-
<preface>
|
212
|
-
<foreword>
|
213
|
-
<example id="samplecode">
|
214
|
-
<name>EXAMPLE — Title</name>
|
215
|
-
<p>Hello</p>
|
216
|
-
</example>
|
217
|
-
</foreword>
|
218
|
-
</preface>
|
219
|
-
</iso-standard>
|
220
|
-
INPUT
|
221
|
-
expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
207
|
+
html = <<~OUTPUT
|
222
208
|
#{HTML_HDR}
|
223
209
|
<br/>
|
224
210
|
<div>
|
@@ -232,10 +218,49 @@ RSpec.describe IsoDoc::Iso do
|
|
232
218
|
</body>
|
233
219
|
</html>
|
234
220
|
OUTPUT
|
221
|
+
|
222
|
+
word = <<~OUTPUT
|
223
|
+
<body lang="EN-US" link="blue" vlink="#954F72">
|
224
|
+
<div class="WordSection1">
|
225
|
+
<p> </p>
|
226
|
+
</div>
|
227
|
+
<p>
|
228
|
+
<br clear="all" class="section"/>
|
229
|
+
</p>
|
230
|
+
<div class="WordSection2">
|
231
|
+
<p>
|
232
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
233
|
+
</p>
|
234
|
+
<div>
|
235
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
236
|
+
<div id="samplecode" class="example">
|
237
|
+
<p><span class="example_label">EXAMPLE — Title</span><span style="mso-tab-count:1">  </span>Hello</p>
|
238
|
+
</div>
|
239
|
+
</div>
|
240
|
+
<p> </p>
|
241
|
+
</div>
|
242
|
+
<p>
|
243
|
+
<br clear="all" class="section"/>
|
244
|
+
</p>
|
245
|
+
<div class="WordSection3">
|
246
|
+
<p class="zzSTDTitle1"/>
|
247
|
+
</div>
|
248
|
+
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
249
|
+
<div class="colophon"/>
|
250
|
+
</body>
|
251
|
+
OUTPUT
|
252
|
+
expect(IsoDoc::Iso::PresentationXMLConvert.new({})
|
253
|
+
.convert("test", input, true)).to be_equivalent_to xmlpp(presxml)
|
254
|
+
expect(IsoDoc::Iso::HtmlConvert.new({})
|
255
|
+
.convert("test", presxml, true)).to be_equivalent_to xmlpp(html)
|
256
|
+
output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
|
257
|
+
expect(xmlpp(output
|
258
|
+
.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
|
259
|
+
.to be_equivalent_to xmlpp(word)
|
235
260
|
end
|
236
261
|
|
237
|
-
it "processes sequences of examples
|
238
|
-
|
262
|
+
it "processes sequences of examples" do
|
263
|
+
input = <<~INPUT
|
239
264
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
240
265
|
<preface>
|
241
266
|
<foreword>
|
@@ -250,11 +275,11 @@ RSpec.describe IsoDoc::Iso do
|
|
250
275
|
</preface>
|
251
276
|
</iso-standard>
|
252
277
|
INPUT
|
253
|
-
|
278
|
+
presxml = <<~OUTPUT
|
254
279
|
<?xml version='1.0'?>
|
255
280
|
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
256
281
|
<preface>
|
257
|
-
<foreword>
|
282
|
+
<foreword displayorder="1">
|
258
283
|
<example id="samplecode">
|
259
284
|
<name>EXAMPLE 1</name>
|
260
285
|
<quote>Hello</quote>
|
@@ -267,26 +292,7 @@ RSpec.describe IsoDoc::Iso do
|
|
267
292
|
</preface>
|
268
293
|
</iso-standard>
|
269
294
|
OUTPUT
|
270
|
-
|
271
|
-
|
272
|
-
it "processes sequences of examples (HTML)" do
|
273
|
-
output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
|
274
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
275
|
-
<preface>
|
276
|
-
<foreword>
|
277
|
-
<example id="samplecode">
|
278
|
-
<name>EXAMPLE 1</name>
|
279
|
-
<quote>Hello</quote>
|
280
|
-
</example>
|
281
|
-
<example id="samplecode2">
|
282
|
-
<name>EXAMPLE 2 — Title</name>
|
283
|
-
<p>Hello</p>
|
284
|
-
</example>
|
285
|
-
</foreword>
|
286
|
-
</preface>
|
287
|
-
</iso-standard>
|
288
|
-
INPUT
|
289
|
-
expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
295
|
+
html = <<~OUTPUT
|
290
296
|
#{HTML_HDR}
|
291
297
|
<br/>
|
292
298
|
<div>
|
@@ -304,105 +310,47 @@ RSpec.describe IsoDoc::Iso do
|
|
304
310
|
</body>
|
305
311
|
</html>
|
306
312
|
OUTPUT
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
<
|
313
|
-
<
|
314
|
-
|
315
|
-
|
316
|
-
<p>Hello</p>
|
317
|
-
</example>
|
318
|
-
</foreword>
|
319
|
-
</preface>
|
320
|
-
</iso-standard>
|
321
|
-
INPUT
|
322
|
-
expect(xmlpp(output.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
|
323
|
-
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
324
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
325
|
-
<div class="WordSection1">
|
326
|
-
<p> </p>
|
327
|
-
</div>
|
313
|
+
word = <<~OUTPUT
|
314
|
+
<body lang="EN-US" link="blue" vlink="#954F72">
|
315
|
+
<div class="WordSection1">
|
316
|
+
<p> </p>
|
317
|
+
</div>
|
318
|
+
<p>
|
319
|
+
<br clear="all" class="section"/>
|
320
|
+
</p>
|
321
|
+
<div class="WordSection2">
|
328
322
|
<p>
|
329
|
-
<br clear="all"
|
323
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
330
324
|
</p>
|
331
|
-
<div
|
332
|
-
<
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
337
|
-
<div id="samplecode" class="example">
|
338
|
-
<p><span class="example_label">EXAMPLE — Title</span><span style="mso-tab-count:1">  </span>Hello</p>
|
339
|
-
</div>
|
325
|
+
<div>
|
326
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
327
|
+
<div id="samplecode" class="example">
|
328
|
+
<p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">  </span></p>
|
329
|
+
<div class="Quote">Hello</div>
|
340
330
|
</div>
|
341
|
-
<
|
342
|
-
|
343
|
-
<p>
|
344
|
-
<br clear="all" class="section"/>
|
345
|
-
</p>
|
346
|
-
<div class="WordSection3">
|
347
|
-
<p class="zzSTDTitle1"/>
|
348
|
-
</div>
|
349
|
-
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
350
|
-
<div class="colophon"/>
|
351
|
-
</body>
|
352
|
-
OUTPUT
|
353
|
-
end
|
354
|
-
|
355
|
-
it "processes sequences of examples (Word)" do
|
356
|
-
output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true)
|
357
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
358
|
-
<preface>
|
359
|
-
<foreword>
|
360
|
-
<example id="samplecode">
|
361
|
-
<name>EXAMPLE 1</name>
|
362
|
-
<quote>Hello</quote>
|
363
|
-
</example>
|
364
|
-
<example id="samplecode2">
|
365
|
-
<name>EXAMPLE 2 — Title</name>
|
366
|
-
<p>Hello</p>
|
367
|
-
</example>
|
368
|
-
</foreword>
|
369
|
-
</preface>
|
370
|
-
</iso-standard>
|
371
|
-
INPUT
|
372
|
-
expect(xmlpp(output.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
|
373
|
-
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
374
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
375
|
-
<div class="WordSection1">
|
376
|
-
<p> </p>
|
377
|
-
</div>
|
378
|
-
<p>
|
379
|
-
<br clear="all" class="section"/>
|
380
|
-
</p>
|
381
|
-
<div class="WordSection2">
|
382
|
-
<p>
|
383
|
-
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
384
|
-
</p>
|
385
|
-
<div>
|
386
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
387
|
-
<div id="samplecode" class="example">
|
388
|
-
<p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">  </span></p>
|
389
|
-
<div class="Quote">Hello</div>
|
390
|
-
</div>
|
391
|
-
<div id="samplecode2" class="example">
|
392
|
-
<p><span class="example_label">EXAMPLE 2 — Title</span><span style="mso-tab-count:1">  </span>Hello</p>
|
393
|
-
</div>
|
331
|
+
<div id="samplecode2" class="example">
|
332
|
+
<p><span class="example_label">EXAMPLE 2 — Title</span><span style="mso-tab-count:1">  </span>Hello</p>
|
394
333
|
</div>
|
395
|
-
<p> </p>
|
396
334
|
</div>
|
397
|
-
<p>
|
398
|
-
|
399
|
-
|
400
|
-
<
|
401
|
-
|
402
|
-
|
403
|
-
<
|
404
|
-
|
405
|
-
|
406
|
-
|
335
|
+
<p> </p>
|
336
|
+
</div>
|
337
|
+
<p>
|
338
|
+
<br clear="all" class="section"/>
|
339
|
+
</p>
|
340
|
+
<div class="WordSection3">
|
341
|
+
<p class="zzSTDTitle1"/>
|
342
|
+
</div>
|
343
|
+
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
344
|
+
<div class="colophon"/>
|
345
|
+
</body>
|
346
|
+
OUTPUT
|
347
|
+
expect(IsoDoc::Iso::PresentationXMLConvert.new({})
|
348
|
+
.convert("test", input, true)).to be_equivalent_to xmlpp(presxml)
|
349
|
+
expect(IsoDoc::Iso::HtmlConvert.new({})
|
350
|
+
.convert("test", presxml, true)).to be_equivalent_to xmlpp(html)
|
351
|
+
output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
|
352
|
+
expect(xmlpp(output
|
353
|
+
.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
|
354
|
+
.to be_equivalent_to xmlpp(word)
|
407
355
|
end
|
408
356
|
end
|