isodoc 1.7.3 → 1.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +7 -4
- data/lib/isodoc/class_utils.rb +2 -2
- data/lib/isodoc/convert.rb +2 -0
- data/lib/isodoc/function/blocks_example_note.rb +85 -79
- data/lib/isodoc/function/cleanup.rb +181 -175
- data/lib/isodoc/function/inline.rb +110 -108
- data/lib/isodoc/function/inline_simple.rb +55 -55
- data/lib/isodoc/function/lists.rb +75 -71
- data/lib/isodoc/function/references.rb +165 -160
- data/lib/isodoc/function/section.rb +140 -190
- data/lib/isodoc/function/section_titles.rb +82 -0
- data/lib/isodoc/function/table.rb +90 -87
- data/lib/isodoc/function/terms.rb +58 -56
- data/lib/isodoc/function/to_word_html.rb +3 -1
- data/lib/isodoc/function/utils.rb +34 -14
- data/lib/isodoc/html_function/comments.rb +107 -111
- data/lib/isodoc/html_function/footnotes.rb +68 -67
- data/lib/isodoc/html_function/html.rb +113 -103
- data/lib/isodoc/html_function/mathvariant_to_plain.rb +5 -3
- data/lib/isodoc/presentation_function/block.rb +73 -78
- data/lib/isodoc/presentation_function/concept.rb +68 -0
- data/lib/isodoc/presentation_function/image.rb +112 -0
- data/lib/isodoc/presentation_function/inline.rb +6 -39
- data/lib/isodoc/presentation_function/math.rb +9 -0
- data/lib/isodoc/presentation_function/section.rb +12 -1
- data/lib/isodoc/presentation_xml_convert.rb +3 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +176 -174
- data/lib/isodoc/word_function/comments.rb +117 -112
- data/lib/isodoc/word_function/footnotes.rb +88 -86
- data/lib/isodoc/word_function/inline.rb +42 -67
- data/lib/isodoc/word_function/postprocess_cover.rb +121 -110
- data/lib/isodoc/xref/xref_gen.rb +153 -150
- data/lib/isodoc/xslfo_convert.rb +2 -2
- data/lib/isodoc.rb +1 -1
- data/spec/assets/odf.svg +1 -4
- data/spec/isodoc/blocks_spec.rb +187 -32
- data/spec/isodoc/inline_spec.rb +300 -116
- data/spec/isodoc/postproc_spec.rb +38 -0
- data/spec/isodoc/presentation_xml_spec.rb +144 -0
- data/spec/isodoc/section_spec.rb +764 -0
- data/spec/isodoc/terms_spec.rb +116 -0
- metadata +63 -18
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -209,8 +209,7 @@ RSpec.describe IsoDoc do
|
|
209
209
|
<renderterm>word</renderterm>
|
210
210
|
<termref base='IEV' target='135-13-13'>The IEV database</termref>
|
211
211
|
</concept></li>
|
212
|
-
<li><concept
|
213
|
-
<renderterm>word</renderterm>
|
212
|
+
<li><concept>
|
214
213
|
<strong>error!</strong>
|
215
214
|
</concept>
|
216
215
|
</li>
|
@@ -295,7 +294,7 @@ RSpec.describe IsoDoc do
|
|
295
294
|
<li>
|
296
295
|
<em>word</em> [<termref base="IEV" target="135-13-13">The IEV database</termref>]
|
297
296
|
</li>
|
298
|
-
<li> <
|
297
|
+
<li> <strong>error!</strong> </li>
|
299
298
|
</ul>
|
300
299
|
</p>
|
301
300
|
</foreword></preface>
|
@@ -380,7 +379,7 @@ RSpec.describe IsoDoc do
|
|
380
379
|
<i>word</i>
|
381
380
|
[The IEV database]
|
382
381
|
</li>
|
383
|
-
<li> <
|
382
|
+
<li> <b>error!</b> </li>
|
384
383
|
</ul>
|
385
384
|
</p>
|
386
385
|
</div>
|
@@ -414,107 +413,129 @@ RSpec.describe IsoDoc do
|
|
414
413
|
|
415
414
|
it "processes concept attributes" do
|
416
415
|
input = <<~INPUT
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
</
|
416
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
417
|
+
<preface><foreword>
|
418
|
+
<p>
|
419
|
+
<ul>
|
420
|
+
<li><concept ital="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
421
|
+
<li><concept ref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
422
|
+
<li><concept ital="true" ref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
423
|
+
<li><concept ital="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
424
|
+
<li><concept ref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
425
|
+
<li><concept ital="false" ref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
426
|
+
<li><concept ital="true" ref="true" linkmention="true" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
427
|
+
<li><concept ital="true" ref="true" linkmention="true" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
428
|
+
<li><concept ital="true" ref="true" linkmention="false" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
429
|
+
<li><concept ital="true" ref="true" linkmention="false" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
430
|
+
<li><concept ital="true" ref="true" linkmention="true" linkref="true"><strong>error!</strong></concept></li>
|
431
|
+
<li><concept ital="false" ref="false" linkmention="true">
|
432
|
+
<refterm>CV_DiscreteCoverage</refterm>
|
433
|
+
<renderterm>CV_DiscreteCoverage</renderterm>
|
434
|
+
<xref target="term-cv_discretecoverage"/>
|
435
|
+
</concept></li>
|
436
|
+
</ul></p>
|
437
|
+
</foreword></preface>
|
438
|
+
<sections>
|
439
|
+
<clause id="clause1"><title>Clause 1</title></clause>
|
440
|
+
</sections>
|
441
|
+
</iso-standard>
|
434
442
|
INPUT
|
435
443
|
presxml = <<~OUTPUT
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
<em>term</em>,
|
459
|
-
|
460
|
-
</li>
|
461
|
-
<li>
|
462
|
-
term,
|
463
|
-
|
464
|
-
</li>
|
465
|
-
</ul></p>
|
466
|
-
</foreword></preface>
|
467
|
-
<sections>
|
468
|
-
<clause id="clause1" displayorder="2"><title depth="1">1.<tab/>Clause 1</title></clause>
|
469
|
-
</sections>
|
470
|
-
</iso-standard>
|
444
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
445
|
+
<preface><foreword displayorder="1">
|
446
|
+
<p>
|
447
|
+
<ul>
|
448
|
+
<li><em>term</em> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
449
|
+
<li><em>term</em> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
450
|
+
<li><em>term</em> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
451
|
+
<li>term [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
452
|
+
<li><em>term</em>,</li>
|
453
|
+
<li>term,</li>
|
454
|
+
<li><xref target="clause1"><em>term</em></xref> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
455
|
+
<li><xref target="clause1"><em>term</em></xref> [term defined in Clause 1],</li>
|
456
|
+
<li><em>term</em> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
457
|
+
<li><em>term</em> [term defined in Clause 1],</li>
|
458
|
+
<li><strong>error!</strong></li>
|
459
|
+
<li><xref target='term-cv_discretecoverage'>CV_DiscreteCoverage</xref></li>
|
460
|
+
</ul></p>
|
461
|
+
</foreword></preface>
|
462
|
+
<sections>
|
463
|
+
<clause id="clause1" displayorder="2"><title depth="1">1.<tab/>Clause 1</title></clause>
|
464
|
+
</sections>
|
465
|
+
</iso-standard>
|
471
466
|
OUTPUT
|
472
467
|
output = <<~OUTPUT
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
468
|
+
#{HTML_HDR}
|
469
|
+
<br/>
|
470
|
+
<div>
|
471
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
472
|
+
<p>
|
473
|
+
<ul>
|
474
|
+
<li>
|
475
|
+
<i>term</i>
|
476
|
+
[term defined in
|
477
|
+
<a href='#clause1'>Clause 1</a>
|
478
|
+
],
|
479
|
+
</li>
|
480
|
+
<li>
|
481
|
+
<i>term</i>
|
482
|
+
[term defined in
|
483
|
+
<a href='#clause1'>Clause 1</a>
|
484
|
+
],
|
485
|
+
</li>
|
486
|
+
<li>
|
487
|
+
<i>term</i>
|
488
|
+
[term defined in
|
489
|
+
<a href='#clause1'>Clause 1</a>
|
490
|
+
],
|
491
|
+
</li>
|
492
|
+
<li>
|
493
|
+
term [term defined in
|
494
|
+
<a href='#clause1'>Clause 1</a>
|
495
|
+
],
|
496
|
+
</li>
|
497
|
+
<li>
|
498
|
+
<i>term</i>,
|
499
|
+
</li>
|
500
|
+
<li>term,</li>
|
501
|
+
<li>
|
502
|
+
<a href='#clause1'>
|
503
|
+
<i>term</i>
|
504
|
+
</a>
|
505
|
+
[term defined in
|
506
|
+
<a href='#clause1'>Clause 1</a>
|
507
|
+
],
|
508
|
+
</li>
|
509
|
+
<li>
|
510
|
+
<a href='#clause1'>
|
511
|
+
<i>term</i>
|
512
|
+
</a>
|
513
|
+
[term defined in Clause 1],
|
514
|
+
</li>
|
515
|
+
<li>
|
516
|
+
<i>term</i>
|
517
|
+
[term defined in
|
518
|
+
<a href='#clause1'>Clause 1</a>
|
519
|
+
],
|
520
|
+
</li>
|
521
|
+
<li>
|
522
|
+
<i>term</i>
|
523
|
+
[term defined in Clause 1],
|
524
|
+
</li>
|
525
|
+
<li> <b>error!</b> </li>
|
526
|
+
<li> <a href='#term-cv_discretecoverage'>CV_DiscreteCoverage</a> </li>
|
527
|
+
</ul>
|
528
|
+
</p>
|
529
|
+
</div>
|
530
|
+
<p class='zzSTDTitle1'/>
|
531
|
+
<div id='clause1'>
|
532
|
+
<h1>1.  Clause 1</h1>
|
533
|
+
</div>
|
534
|
+
</div>
|
535
|
+
</body>
|
536
|
+
</html>
|
516
537
|
OUTPUT
|
517
|
-
expect((IsoDoc::PresentationXMLConvert.new({})
|
538
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
518
539
|
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
519
540
|
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
520
541
|
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
@@ -837,6 +858,102 @@ RSpec.describe IsoDoc do
|
|
837
858
|
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
838
859
|
end
|
839
860
|
|
861
|
+
it "duplicates MathML with AsciiMath" do
|
862
|
+
input = <<~INPUT
|
863
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" xmlns:m='http://www.w3.org/1998/Math/MathML'>
|
864
|
+
<preface><foreword>
|
865
|
+
<p>
|
866
|
+
<stem type="MathML"><m:math>
|
867
|
+
<m:msup> <m:mrow> <m:mo>(</m:mo> <m:mrow> <m:mi>x</m:mi> <m:mo>+</m:mo> <m:mi>y</m:mi> </m:mrow> <m:mo>)</m:mo> </m:mrow> <m:mn>2</m:mn> </m:msup>
|
868
|
+
</m:math></stem>
|
869
|
+
</p>
|
870
|
+
</foreword></preface>
|
871
|
+
<sections>
|
872
|
+
</iso-standard>
|
873
|
+
INPUT
|
874
|
+
output = <<~OUTPUT
|
875
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' xmlns:m='http://www.w3.org/1998/Math/MathML' type='presentation'>
|
876
|
+
<preface>
|
877
|
+
<foreword displayorder='1'>
|
878
|
+
<p>
|
879
|
+
<stem type='MathML'>
|
880
|
+
<m:math>
|
881
|
+
<m:msup>
|
882
|
+
<m:mrow>
|
883
|
+
<m:mo>(</m:mo>
|
884
|
+
<m:mrow>
|
885
|
+
<m:mi>x</m:mi>
|
886
|
+
<m:mo>+</m:mo>
|
887
|
+
<m:mi>y</m:mi>
|
888
|
+
</m:mrow>
|
889
|
+
<m:mo>)</m:mo>
|
890
|
+
</m:mrow>
|
891
|
+
<m:mn>2</m:mn>
|
892
|
+
</m:msup>
|
893
|
+
</m:math>
|
894
|
+
<comment> ( x + y )^2 </comment>
|
895
|
+
</stem>
|
896
|
+
</p>
|
897
|
+
</foreword>
|
898
|
+
</preface>
|
899
|
+
<sections> </sections>
|
900
|
+
</iso-standard>
|
901
|
+
OUTPUT
|
902
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
903
|
+
.convert("test", input, true)
|
904
|
+
.gsub("<!--", "<comment>")
|
905
|
+
.gsub("-->", "</comment>")))
|
906
|
+
.to be_equivalent_to xmlpp(output)
|
907
|
+
end
|
908
|
+
|
909
|
+
it "overrides duplication of MathML with AsciiMath" do
|
910
|
+
input = <<~INPUT
|
911
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" xmlns:m='http://www.w3.org/1998/Math/MathML'>
|
912
|
+
<preface><foreword>
|
913
|
+
<p>
|
914
|
+
<stem type="MathML"><m:math>
|
915
|
+
<m:msup> <m:mrow> <m:mo>(</m:mo> <m:mrow> <m:mi>x</m:mi> <m:mo>+</m:mo> <m:mi>y</m:mi> </m:mrow> <m:mo>)</m:mo> </m:mrow> <m:mn>2</m:mn> </m:msup>
|
916
|
+
</m:math></stem>
|
917
|
+
</p>
|
918
|
+
</foreword></preface>
|
919
|
+
<sections>
|
920
|
+
</iso-standard>
|
921
|
+
INPUT
|
922
|
+
output = <<~OUTPUT
|
923
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' xmlns:m='http://www.w3.org/1998/Math/MathML' type='presentation'>
|
924
|
+
<preface>
|
925
|
+
<foreword displayorder='1'>
|
926
|
+
<p>
|
927
|
+
<stem type='MathML'>
|
928
|
+
<m:math>
|
929
|
+
<m:msup>
|
930
|
+
<m:mrow>
|
931
|
+
<m:mo>(</m:mo>
|
932
|
+
<m:mrow>
|
933
|
+
<m:mi>x</m:mi>
|
934
|
+
<m:mo>+</m:mo>
|
935
|
+
<m:mi>y</m:mi>
|
936
|
+
</m:mrow>
|
937
|
+
<m:mo>)</m:mo>
|
938
|
+
</m:mrow>
|
939
|
+
<m:mn>2</m:mn>
|
940
|
+
</m:msup>
|
941
|
+
</m:math>
|
942
|
+
</stem>
|
943
|
+
</p>
|
944
|
+
</foreword>
|
945
|
+
</preface>
|
946
|
+
<sections> </sections>
|
947
|
+
</iso-standard>
|
948
|
+
OUTPUT
|
949
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
950
|
+
.new({ suppressasciimathdup: "true" })
|
951
|
+
.convert("test", input, true)
|
952
|
+
.gsub("<!--", "<comment>")
|
953
|
+
.gsub("-->", "</comment>")))
|
954
|
+
.to be_equivalent_to xmlpp(output)
|
955
|
+
end
|
956
|
+
|
840
957
|
it "processes eref types" do
|
841
958
|
input = <<~INPUT
|
842
959
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
@@ -863,22 +980,27 @@ RSpec.describe IsoDoc do
|
|
863
980
|
INPUT
|
864
981
|
output = <<~OUTPUT
|
865
982
|
#{HTML_HDR}
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
</
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
983
|
+
<br/>
|
984
|
+
<div>
|
985
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
986
|
+
<p>
|
987
|
+
<sup>
|
988
|
+
<a href='#ISO712'>A</a>
|
989
|
+
</sup>
|
990
|
+
<a href='#ISO712'>A</a>
|
991
|
+
</p>
|
992
|
+
</div>
|
993
|
+
<p class='zzSTDTitle1'/>
|
994
|
+
<div>
|
995
|
+
<h1>Normative References</h1>
|
996
|
+
<p id='ISO712' class='NormRef'>
|
997
|
+
ISO 712,
|
998
|
+
<i>Cereals and cereal products</i>
|
999
|
+
</p>
|
1000
|
+
</div>
|
1001
|
+
</div>
|
1002
|
+
</body>
|
1003
|
+
</html>
|
882
1004
|
OUTPUT
|
883
1005
|
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
884
1006
|
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
@@ -901,6 +1023,7 @@ RSpec.describe IsoDoc do
|
|
901
1023
|
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
902
1024
|
<eref type="inline" bibitemid="ISO712"><locality type="whole"></locality></eref>
|
903
1025
|
<eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
|
1026
|
+
<eref type="inline" bibitemid="ISO712"><locality type="locality:URI"><referenceFrom>7</referenceFrom></locality></eref>
|
904
1027
|
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
|
905
1028
|
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality></eref>
|
906
1029
|
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
@@ -939,6 +1062,7 @@ RSpec.describe IsoDoc do
|
|
939
1062
|
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
940
1063
|
<eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
|
941
1064
|
<eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
|
1065
|
+
<eref type="inline" bibitemid="ISO712"><locality type="locality:URI"><referenceFrom>7</referenceFrom></locality>ISO 712, URI 7</eref>
|
942
1066
|
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
|
943
1067
|
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
|
944
1068
|
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
|
@@ -981,6 +1105,7 @@ RSpec.describe IsoDoc do
|
|
981
1105
|
<a href="#ISO712">A</a>
|
982
1106
|
<a href="#ISO712">ISO 712, Whole of text</a>
|
983
1107
|
<a href="#ISO712">ISO 712, Prelude 7</a>
|
1108
|
+
<a href="#ISO712">ISO 712, URI 7</a>
|
984
1109
|
<a href="#ISO712">A</a>
|
985
1110
|
<a href='#ISO712'>ISO 712</a>
|
986
1111
|
<a href='#ISO712'>ISO 712, Clause 1</a>
|
@@ -1263,6 +1388,65 @@ RSpec.describe IsoDoc do
|
|
1263
1388
|
.convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
|
1264
1389
|
end
|
1265
1390
|
|
1391
|
+
it "processes eref content with Unicode characters" do
|
1392
|
+
input = <<~INPUT
|
1393
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1394
|
+
<preface><foreword>
|
1395
|
+
<p>
|
1396
|
+
<eref type="inline" bibitemid="ISO712" citeas="BSI BS EN ISO 19011:2018 — TC"/>
|
1397
|
+
</foreword></preface>
|
1398
|
+
<bibliography>
|
1399
|
+
<references id='_normative_references' obligation='informative' normative='true' displayorder="2">
|
1400
|
+
<title>Normative References</title>
|
1401
|
+
<bibitem id='ISO712' type='standard'>
|
1402
|
+
<title format='text/plain'>Cereals and cereal products</title>
|
1403
|
+
<uri type='citation'>http://www.example.com</uri>
|
1404
|
+
<docidentifier>ISO 712</docidentifier>
|
1405
|
+
<contributor>
|
1406
|
+
<role type='publisher'/>
|
1407
|
+
<organization>
|
1408
|
+
<abbreviation>ISO</abbreviation>
|
1409
|
+
</organization>
|
1410
|
+
</contributor>
|
1411
|
+
</bibitem>
|
1412
|
+
</references></bibliography>
|
1413
|
+
</iso-standard>
|
1414
|
+
INPUT
|
1415
|
+
presxml = <<~OUTPUT
|
1416
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1417
|
+
<preface>
|
1418
|
+
<foreword displayorder='1'>
|
1419
|
+
<p>
|
1420
|
+
<eref type='inline' bibitemid='ISO712' citeas='BSI BS EN ISO 19011:2018 — TC'>BSI BS EN ISO 19011:2018 — TC</eref>
|
1421
|
+
</p>
|
1422
|
+
</foreword>
|
1423
|
+
<bibliography displayorder='2'>
|
1424
|
+
<references id='_normative_references' obligation='informative' normative='true' displayorder='3'>
|
1425
|
+
<title depth='1'>
|
1426
|
+
1.
|
1427
|
+
<tab/>
|
1428
|
+
Normative References
|
1429
|
+
</title>
|
1430
|
+
<bibitem id='ISO712' type='standard'>
|
1431
|
+
<title format='text/plain'>Cereals and cereal products</title>
|
1432
|
+
<uri type='citation'>http://www.example.com</uri>
|
1433
|
+
<docidentifier>ISO 712</docidentifier>
|
1434
|
+
<contributor>
|
1435
|
+
<role type='publisher'/>
|
1436
|
+
<organization>
|
1437
|
+
<abbreviation>ISO</abbreviation>
|
1438
|
+
</organization>
|
1439
|
+
</contributor>
|
1440
|
+
</bibitem>
|
1441
|
+
</references>
|
1442
|
+
</bibliography>
|
1443
|
+
</preface>
|
1444
|
+
</iso-standard>
|
1445
|
+
OUTPUT
|
1446
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1447
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
1448
|
+
end
|
1449
|
+
|
1266
1450
|
it "processes variant" do
|
1267
1451
|
input = <<~INPUT
|
1268
1452
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
@@ -807,6 +807,44 @@ RSpec.describe IsoDoc do
|
|
807
807
|
OUTPUT
|
808
808
|
end
|
809
809
|
|
810
|
+
it "moves images in HTML" do
|
811
|
+
FileUtils.rm_f "test.html"
|
812
|
+
FileUtils.rm_rf "test_htmlimages"
|
813
|
+
IsoDoc::HtmlConvert.new(
|
814
|
+
{ baseassetpath: "spec/assets",
|
815
|
+
wordstylesheet: "word.css",
|
816
|
+
htmlstylesheet: "html.scss" },
|
817
|
+
).convert("test", <<~"INPUT", false)
|
818
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
819
|
+
<preface><foreword>
|
820
|
+
<figure id="_">
|
821
|
+
<name>Split-it-right sample divider</name>
|
822
|
+
<image src="rice_image1.png" id="_" mimetype="image/png"/>
|
823
|
+
</figure>
|
824
|
+
</foreword></preface>
|
825
|
+
</iso-standard>
|
826
|
+
INPUT
|
827
|
+
html = File.read("test.html")
|
828
|
+
.sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
829
|
+
.sub(%r{</main>.*$}m, "</main>")
|
830
|
+
expect(`ls test_htmlimages`).to match(/\.png$/)
|
831
|
+
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")))
|
832
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
833
|
+
<main class='main-section'>
|
834
|
+
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
835
|
+
<br/>
|
836
|
+
<div>
|
837
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
838
|
+
<div id='_' class='figure'>
|
839
|
+
<img src='test_htmlimages/_.png' height='776' width='922'/>
|
840
|
+
<p class='FigureTitle' style='text-align:center;'>Split-it-right sample divider</p>
|
841
|
+
</div>
|
842
|
+
</div>
|
843
|
+
<p class='zzSTDTitle1'/>
|
844
|
+
</main>
|
845
|
+
OUTPUT
|
846
|
+
end
|
847
|
+
|
810
848
|
describe "mathvariant to plain" do
|
811
849
|
context "when `mathvariant` attr equal to `script`" do
|
812
850
|
it "converts mathvariant text chars into associated plain chars" do
|