metanorma-standoc 1.6.2 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +20 -16
  3. data/README.adoc +1 -3
  4. data/lib/asciidoctor/standoc/cleanup.rb +52 -4
  5. data/lib/asciidoctor/standoc/cleanup_block.rb +41 -4
  6. data/lib/asciidoctor/standoc/cleanup_inline.rb +6 -2
  7. data/lib/asciidoctor/standoc/converter.rb +2 -0
  8. data/lib/asciidoctor/standoc/isodoc.rng +13 -0
  9. data/lib/asciidoctor/standoc/lists.rb +4 -2
  10. data/lib/asciidoctor/standoc/macros.rb +15 -0
  11. data/lib/asciidoctor/standoc/ref.rb +2 -2
  12. data/lib/metanorma/standoc/version.rb +1 -1
  13. data/metanorma-standoc.gemspec +1 -0
  14. data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1498 -0
  15. data/spec/asciidoctor-standoc/cleanup_spec.rb +341 -1543
  16. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +7 -7
  17. data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
  18. data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
  19. data/spec/asciidoctor-standoc/macros_spec.rb +34 -0
  20. data/spec/asciidoctor-standoc/refs_spec.rb +12 -12
  21. data/spec/fixtures/test.exp +121 -0
  22. data/spec/spec_helper.rb +29 -1
  23. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +43 -43
  24. data/spec/vcr_cassettes/isobib_get_123.yml +11 -11
  25. data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -23
  26. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +29 -29
  27. data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -11
  28. data/spec/vcr_cassettes/isobib_get_124.yml +11 -11
  29. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  30. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +52 -40
  31. metadata +19 -2
@@ -268,33 +268,6 @@ RSpec.describe Asciidoctor::Standoc do
268
268
  OUTPUT
269
269
  end
270
270
 
271
- it "strips any initial boilerplate from terms and definitions" do
272
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
273
- #{ASCIIDOC_BLANK_HDR}
274
- == Terms and Definitions
275
-
276
- I am boilerplate
277
-
278
- * So am I
279
-
280
- === Time
281
-
282
- This paragraph is extraneous
283
- INPUT
284
- #{BLANK_HDR}
285
- <sections>
286
- <terms id="_" obligation="normative"><title>Terms and definitions</title>
287
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
288
-
289
- <term id="_">
290
- <preferred>Time</preferred>
291
- <definition><p id="_">This paragraph is extraneous</p></definition>
292
- </term></terms>
293
- </sections>
294
- </standard-document>
295
- OUTPUT
296
- end
297
-
298
271
  it "moves notes inside preceding blocks, if they are not at clause end, and the blocks are not delimited" do
299
272
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
300
273
  #{ASCIIDOC_BLANK_HDR}
@@ -415,6 +388,9 @@ RSpec.describe Asciidoctor::Standoc do
415
388
  #{ASCIIDOC_BLANK_HDR}
416
389
  <<iso216,whole,clause=3,example=9-11,locality:prelude="33 a",locality:entirety:the reference,xyz>>
417
390
  <<iso216,whole,clause=3,example=9-11,locality:prelude=33,locality:entirety="the reference";whole,clause=3,example=9-11,locality:prelude=33,locality:entirety:the reference,xyz>>
391
+ <<iso216,_whole_>>
392
+ <<iso216,a _whole_ flagon>>
393
+ <<iso216,whole,clause=3,a _whole_ flagon>>
418
394
 
419
395
  [bibliography]
420
396
  == Normative References
@@ -462,7 +438,25 @@ RSpec.describe Asciidoctor::Standoc do
462
438
  </localityStack>
463
439
  the reference,xyz
464
440
  </eref>
465
-
441
+ <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
442
+ <em>whole</em>
443
+ </eref>
444
+ <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
445
+ a
446
+ <em>whole</em>
447
+ flagon
448
+ </eref>
449
+ <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
450
+ <localityStack>
451
+ <locality type='whole'/>
452
+ <locality type='clause'>
453
+ <referenceFrom>3</referenceFrom>
454
+ </locality>
455
+ </localityStack>
456
+ a
457
+ <em>whole</em>
458
+ flagon
459
+ </eref>
466
460
  </p>
467
461
  </foreword></preface><sections>
468
462
  </sections><bibliography><references id="_" obligation="informative" normative="true">
@@ -552,114 +546,6 @@ RSpec.describe Asciidoctor::Standoc do
552
546
  OUTPUT
553
547
  end
554
548
 
555
- it "removes initial extraneous material from Normative References" do
556
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
557
- #{ASCIIDOC_BLANK_HDR}
558
- [bibliography]
559
- == Normative References
560
-
561
- This is extraneous information
562
-
563
- * [[[iso216,ISO 216]]], _Reference_
564
-
565
- This is also extraneous information
566
- INPUT
567
- #{BLANK_HDR}
568
- <sections></sections>
569
- <bibliography><references id="_" obligation="informative" normative="true"><title>Normative references</title>
570
- #{NORM_REF_BOILERPLATE}
571
- <bibitem id="iso216" type="standard">
572
- <title format="text/plain">Reference</title>
573
- <docidentifier>ISO 216</docidentifier>
574
- <docnumber>216</docnumber>
575
- <contributor>
576
- <role type="publisher"/>
577
- <organization>
578
- <name>ISO</name>
579
- </organization>
580
- </contributor>
581
- </bibitem>
582
- <p id='_'>This is also extraneous information</p>
583
- </references>
584
- </bibliography>
585
- </standard-document>
586
- OUTPUT
587
- end
588
-
589
- it "sorts references with their notes in Bibliography" do
590
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
591
- #{ASCIIDOC_BLANK_HDR}
592
- [bibliography]
593
- == Bibliography
594
-
595
- This is extraneous information
596
-
597
- * [[[iso216,ISO 216]]], _Reference_
598
-
599
- NOTE: ABC
600
-
601
- NOTE: DEF
602
-
603
- This is further extraneous information
604
-
605
- NOTE: GHI
606
-
607
- * [[[iso216,ISO 215]]], _Reference_
608
-
609
- NOTE: JKL
610
-
611
- This is also extraneous information
612
- INPUT
613
- #{BLANK_HDR}
614
- <sections> </sections>
615
- <bibliography>
616
- <references id='_' obligation='informative' normative="false">
617
- <title>Bibliography</title>
618
- <p id='_'>This is extraneous information</p>
619
- <bibitem id='iso216' type='standard'>
620
- <title format='text/plain'>Reference</title>
621
- <docidentifier>ISO 216</docidentifier>
622
- <docnumber>216</docnumber>
623
- <contributor>
624
- <role type='publisher'/>
625
- <organization>
626
- <name>ISO</name>
627
- </organization>
628
- </contributor>
629
- </bibitem>
630
- <note id='_'>
631
- <p id='_'>ABC</p>
632
- </note>
633
- <note id='_'>
634
- <p id='_'>DEF</p>
635
- </note>
636
- <bibitem id='iso216' type='standard'>
637
- <title format='text/plain'>Reference</title>
638
- <docidentifier>ISO 215</docidentifier>
639
- <docnumber>215</docnumber>
640
- <contributor>
641
- <role type='publisher'/>
642
- <organization>
643
- <name>ISO</name>
644
- </organization>
645
- </contributor>
646
- </bibitem>
647
- <note id='_'>
648
- <p id='_'>JKL</p>
649
- </note>
650
- <p id='_'>
651
- This is further extraneous information
652
- <note id='_'>
653
- <p id='_'>GHI</p>
654
- </note>
655
- </p>
656
- <p id='_'>This is also extraneous information</p>
657
- </references>
658
- </bibliography>
659
- </standard-document>
660
- OUTPUT
661
- end
662
-
663
549
  it "inserts IDs into paragraphs" do
664
550
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
665
551
  #{ASCIIDOC_BLANK_HDR}
@@ -703,24 +589,68 @@ end
703
589
  Key
704
590
 
705
591
  a:: b
592
+
593
+ |===
594
+ |a |b |c
595
+ |===
596
+
597
+ [%key]
598
+ a:: b
599
+
600
+ |===
601
+ |a |b |c
602
+ |===
603
+
604
+ a:: b
706
605
  INPUT
707
606
  #{BLANK_HDR}
708
- <sections><table id="_">
709
- <tbody>
710
- <tr>
711
- <td valign="top" align="left">a</td>
712
- <td valign="top" align="left">b</td>
713
- <td valign="top" align="left">c</td>
714
- </tr>
715
- </tbody>
716
- <dl id="_">
717
- <dt>a</dt>
718
- <dd>
719
- <p id="_">b</p>
720
- </dd>
721
- </dl></table>
722
-
723
- </sections>
607
+ <sections>
608
+ <table id='_'>
609
+ <tbody>
610
+ <tr>
611
+ <td valign='top' align='left'>a</td>
612
+ <td valign='top' align='left'>b</td>
613
+ <td valign='top' align='left'>c</td>
614
+ </tr>
615
+ </tbody>
616
+ <dl id='_' key='true'>
617
+ <dt>a</dt>
618
+ <dd>
619
+ <p id='_'>b</p>
620
+ </dd>
621
+ </dl>
622
+ </table>
623
+ <table id='_'>
624
+ <tbody>
625
+ <tr>
626
+ <td valign='top' align='left'>a</td>
627
+ <td valign='top' align='left'>b</td>
628
+ <td valign='top' align='left'>c</td>
629
+ </tr>
630
+ </tbody>
631
+ <dl id='_' key='true'>
632
+ <dt>a</dt>
633
+ <dd>
634
+ <p id='_'>b</p>
635
+ </dd>
636
+ </dl>
637
+ </table>
638
+ <table id='_'>
639
+ <tbody>
640
+ <tr>
641
+ <td valign='top' align='left'>a</td>
642
+ <td valign='top' align='left'>b</td>
643
+ <td valign='top' align='left'>c</td>
644
+ </tr>
645
+ </tbody>
646
+ </table>
647
+ <dl id='_'>
648
+ <dt>a</dt>
649
+ <dd>
650
+ <p id='_'>b</p>
651
+ </dd>
652
+ </dl>
653
+ </sections>
724
654
  </standard-document>
725
655
  OUTPUT
726
656
  end
@@ -851,18 +781,76 @@ end
851
781
  Where,
852
782
 
853
783
  a:: b
784
+
785
+ [stem]
786
+ ++++
787
+ Formula
788
+ ++++
789
+
790
+ [%key]
791
+ a:: b
792
+
793
+ [stem]
794
+ ++++
795
+ Formula
796
+ ++++
797
+
798
+ a:: b
854
799
  INPUT
855
800
  #{BLANK_HDR}
856
- <sections><formula id="_">
857
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>F</mi><mi>or</mi><mi>μ</mi><mi>l</mi><mi>a</mi></math></stem>
858
- <dl id="_">
859
- <dt>a</dt>
860
- <dd>
861
- <p id="_">b</p>
862
- </dd>
863
- </dl></formula>
864
-
865
- </sections>
801
+ <sections>
802
+ <formula id='_'>
803
+ <stem type='MathML'>
804
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
805
+ <mi>F</mi>
806
+ <mi>or</mi>
807
+ <mi>μ</mi>
808
+ <mi>l</mi>
809
+ <mi>a</mi>
810
+ </math>
811
+ </stem>
812
+ <dl id='_' key='true'>
813
+ <dt>a</dt>
814
+ <dd>
815
+ <p id='_'>b</p>
816
+ </dd>
817
+ </dl>
818
+ </formula>
819
+ <formula id='_'>
820
+ <stem type='MathML'>
821
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
822
+ <mi>F</mi>
823
+ <mi>or</mi>
824
+ <mi>μ</mi>
825
+ <mi>l</mi>
826
+ <mi>a</mi>
827
+ </math>
828
+ </stem>
829
+ <dl id='_' key='true'>
830
+ <dt>a</dt>
831
+ <dd>
832
+ <p id='_'>b</p>
833
+ </dd>
834
+ </dl>
835
+ </formula>
836
+ <formula id='_'>
837
+ <stem type='MathML'>
838
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
839
+ <mi>F</mi>
840
+ <mi>or</mi>
841
+ <mi>μ</mi>
842
+ <mi>l</mi>
843
+ <mi>a</mi>
844
+ </math>
845
+ </stem>
846
+ </formula>
847
+ <dl id='_'>
848
+ <dt>a</dt>
849
+ <dd>
850
+ <p id='_'>b</p>
851
+ </dd>
852
+ </dl>
853
+ </sections>
866
854
  </standard-document>
867
855
  OUTPUT
868
856
  end
@@ -914,19 +902,46 @@ end
914
902
  key:
915
903
 
916
904
  a:: b
917
- INPUT
918
- #{BLANK_HDR}
919
- <sections><figure id="_">
920
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
921
- <dl id="_">
922
- <dt>a</dt>
923
- <dd>
924
- <p id="_">b</p>
925
- </dd>
926
- </dl></figure>
927
905
 
928
- </sections>
906
+ image::spec/examples/rice_images/rice_image1.png[]
907
+
908
+ [%key]
909
+ a:: b
910
+
911
+ image::spec/examples/rice_images/rice_image1.png[]
929
912
 
913
+ a:: b
914
+ INPUT
915
+ #{BLANK_HDR}
916
+ <sections>
917
+ <figure id='_'>
918
+ <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
919
+ <dl id='_' key='true'>
920
+ <dt>a</dt>
921
+ <dd>
922
+ <p id='_'>b</p>
923
+ </dd>
924
+ </dl>
925
+ </figure>
926
+ <figure id='_'>
927
+ <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
928
+ <dl id='_' key='true'>
929
+ <dt>a</dt>
930
+ <dd>
931
+ <p id='_'>b</p>
932
+ </dd>
933
+ </dl>
934
+ </figure>
935
+ <figure id='_'>
936
+ <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
937
+ </figure>
938
+ <dl id='_'>
939
+ <dt>a</dt>
940
+ <dd>
941
+ <p id='_'>b</p>
942
+ </dd>
943
+ </dl>
944
+ </sections>
930
945
  </standard-document>
931
946
  OUTPUT
932
947
  end
@@ -1010,7 +1025,7 @@ end
1010
1025
  <name>ISO</name>
1011
1026
  </organization>
1012
1027
  </contributor>
1013
- <note format="text/plain" type="ISO DATE">The standard is in press</note>
1028
+ <note format="text/plain" type="Unpublished-Status">The standard is in press</note>
1014
1029
  </bibitem>
1015
1030
  </references>
1016
1031
  </bibliography>
@@ -1018,31 +1033,6 @@ end
1018
1033
  OUTPUT
1019
1034
  end
1020
1035
 
1021
- it "defaults section obligations" do
1022
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1023
- #{ASCIIDOC_BLANK_HDR}
1024
-
1025
- == Clause
1026
- Text
1027
-
1028
- [appendix]
1029
- == Clause
1030
-
1031
- Text
1032
- INPUT
1033
- #{BLANK_HDR}
1034
- <sections><clause id="_" inline-header="false" obligation="normative">
1035
- <title>Clause</title>
1036
- <p id="_">Text</p>
1037
- </clause>
1038
- </sections><annex id="_" inline-header="false" obligation="normative">
1039
- <title>Clause</title>
1040
- <p id="_">Text</p>
1041
- </annex>
1042
- </standard-document>
1043
- OUTPUT
1044
- end
1045
-
1046
1036
  it "rearranges term note, term example, term source" do
1047
1037
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1048
1038
  #{ASCIIDOC_BLANK_HDR}
@@ -1094,69 +1084,6 @@ end
1094
1084
  OUTPUT
1095
1085
  end
1096
1086
 
1097
- it "extends clause levels past 5" do
1098
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1099
- #{ASCIIDOC_BLANK_HDR}
1100
-
1101
- == Clause1
1102
-
1103
- === Clause2
1104
-
1105
- ==== Clause3
1106
-
1107
- ===== Clause4
1108
-
1109
- ====== Clause 5
1110
-
1111
- [level=6]
1112
- ====== Clause 6
1113
-
1114
- [level=7]
1115
- ====== Clause 7A
1116
-
1117
- [level=7]
1118
- ====== Clause 7B
1119
-
1120
- [level=6]
1121
- ====== Clause 6B
1122
-
1123
- ====== Clause 5B
1124
-
1125
- INPUT
1126
- #{BLANK_HDR}
1127
- <sections>
1128
- <clause id="_" inline-header="false" obligation="normative">
1129
- <title>Clause1</title>
1130
- <clause id="_" inline-header="false" obligation="normative">
1131
- <title>Clause2</title>
1132
- <clause id="_" inline-header="false" obligation="normative">
1133
- <title>Clause3</title>
1134
- <clause id="_" inline-header="false" obligation="normative"><title>Clause4</title><clause id="_" inline-header="false" obligation="normative">
1135
- <title>Clause 5</title>
1136
- <clause id="_" inline-header="false" obligation="normative">
1137
- <title>Clause 6</title>
1138
- <clause id="_" inline-header="false" obligation="normative">
1139
- <title>Clause 7A</title>
1140
- </clause><clause id="_" inline-header="false" obligation="normative">
1141
- <title>Clause 7B</title>
1142
- </clause></clause><clause id="_" inline-header="false" obligation="normative">
1143
- <title>Clause 6B</title>
1144
- </clause></clause>
1145
-
1146
-
1147
-
1148
-
1149
- <clause id="_" inline-header="false" obligation="normative">
1150
- <title>Clause 5B</title>
1151
- </clause></clause>
1152
- </clause>
1153
- </clause>
1154
- </clause>
1155
- </sections>
1156
- </standard-document>
1157
- OUTPUT
1158
- end
1159
-
1160
1087
  it "separates IEV citations by top-level clause" do
1161
1088
  FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
1162
1089
  FileUtils.mv File.expand_path("~/.relaton/cache"), File.expand_path("~/.relaton-bib.pstore1"), force: true
@@ -1167,7 +1094,7 @@ end
1167
1094
  # mock_iecbib_get_iec60050_102_01
1168
1095
  # mock_iecbib_get_iec60050_103_01
1169
1096
  # mock_iev
1170
- VCR.use_cassette "separates_iev_citations_by_top_level_clause", :re_record_interval => 25200 do
1097
+ VCR.use_cassette "separates_iev_citations_by_top_level_clause" do
1171
1098
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1172
1099
  #{CACHED_ISOBIB_BLANK_HDR}
1173
1100
 
@@ -1540,72 +1467,6 @@ OUTPUT
1540
1467
  OUTPUT
1541
1468
  end
1542
1469
 
1543
- it "inserts boilerplate before empty Normative References" do
1544
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1545
- #{ASCIIDOC_BLANK_HDR}
1546
-
1547
- [bibliography]
1548
- == Normative References
1549
-
1550
- INPUT
1551
- #{BLANK_HDR}
1552
- <sections>
1553
-
1554
- </sections><bibliography><references id="_" obligation="informative" normative="true">
1555
- <title>Normative references</title><p id="_">There are no normative references in this document.</p>
1556
- </references></bibliography>
1557
- </standard-document>
1558
- OUTPUT
1559
- end
1560
-
1561
- it "inserts boilerplate before non-empty Normative References" do
1562
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1563
- #{ASCIIDOC_BLANK_HDR}
1564
-
1565
- [bibliography]
1566
- == Normative References
1567
- * [[[a,b]]] A
1568
-
1569
- INPUT
1570
- #{BLANK_HDR}
1571
- <sections>
1572
-
1573
- </sections><bibliography><references id="_" obligation="informative" normative="true">
1574
- <title>Normative references</title><p id="_">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>
1575
- <bibitem id="a">
1576
- <formattedref format="application/x-isodoc+xml">A</formattedref>
1577
- <docidentifier>b</docidentifier>
1578
- </bibitem>
1579
- </references></bibliography>
1580
- </standard-document>
1581
-
1582
- OUTPUT
1583
- end
1584
-
1585
- it "inserts boilerplate before empty Normative References in French" do
1586
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1587
- = Document title
1588
- Author
1589
- :docfile: test.adoc
1590
- :nodoc:
1591
- :novalid:
1592
- :no-isobib:
1593
- :language: fr
1594
-
1595
- [bibliography]
1596
- == Normative References
1597
-
1598
- INPUT
1599
- #{BLANK_HDR.sub(/<language>en/, "<language>fr")}
1600
- <sections>
1601
-
1602
- </sections><bibliography><references id="_" obligation="informative" normative="true">
1603
- <title>Références normatives</title><p id="_">Le présent document ne contient aucune référence normative.</p>
1604
- </references></bibliography>
1605
- </standard-document>
1606
- OUTPUT
1607
- end
1608
-
1609
1470
  it "removes bibdata bibitem IDs" do
1610
1471
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1611
1472
  = Document title
@@ -1960,1221 +1821,18 @@ OUTPUT
1960
1821
  end
1961
1822
 
1962
1823
 
1963
- it "processes section names, with footnotes" do
1964
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1965
- #{ASCIIDOC_BLANK_HDR}
1966
- .Foreword.footnote:[A]
1967
-
1968
- Text
1969
-
1970
- [abstract]
1971
- == Abstract.footnote:[A]
1972
-
1973
- Text
1974
-
1975
- [heading=introduction]
1976
- == Introduction.footnote:[A]
1977
-
1978
- === Introduction Subsection
1979
-
1980
- [heading=acknowledgements]
1981
- == Acknowledgements.footnote:[A]
1982
-
1983
- [.preface]
1984
- == Dedication
1985
-
1986
- [heading=scope]
1987
- == Scope.footnote:[A]
1988
-
1989
- Text
1990
-
1991
- [bibliography,heading=normative references]
1992
- == Normative References.footnote:[A]
1993
-
1994
- [bibliography,normative=true]
1995
- == Normative References 2.footnote:[A]
1996
-
1997
- [heading=terms and definitions]
1998
- == Terms and Definitions.footnote:[A]
1999
-
2000
- === Term1
2001
-
2002
- [heading="terms and definitions"]
2003
- == Terms, Definitions, Symbols and Abbreviated Terms.footnote:[A]
2004
-
2005
- [.nonterm]
2006
- === Introduction
2007
-
2008
- ==== Intro 1
2009
-
2010
- === Intro 2
2011
-
2012
- [.nonterm]
2013
- ==== Intro 3
2014
-
2015
- === Intro 4
2016
-
2017
- ==== Intro 5
2018
-
2019
- ===== Term1
2020
-
2021
- === Normal Terms
2022
-
2023
- ==== Term2
2024
-
2025
- [heading=symbols and abbreviated terms]
2026
- === Symbols and Abbreviated Terms.footnote:[A]
2027
-
2028
- [.nonterm]
2029
- ==== General
2030
-
2031
- [heading=symbols]
2032
- ==== Symbols 1.footnote:[A]
2033
-
2034
- [heading=abbreviated terms]
2035
- == Abbreviated Terms.footnote:[A]
2036
-
2037
- == Clause 4
1824
+ it "fixes illegal anchors" do
1825
+ input = <<~INPUT
1826
+ #{ASCIIDOC_BLANK_HDR}
2038
1827
 
2039
- === Introduction
2040
-
2041
- === Clause 4.2
2042
-
2043
- == Terms and Definitions
2044
-
2045
- [appendix]
2046
- == Annex.footnote:[A]
2047
-
2048
- === Annex A.1
2049
-
2050
- [bibliography,heading=bibliography]
2051
- == Bibliography.footnote:[A]
2052
-
2053
- [bibliography,normative=false]
2054
- == Bibliography 2.footnote:[A]
2055
-
2056
- === Bibliography Subsection
2057
-
2058
- INPUT
2059
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
2060
- <bibdata type='standard'>
2061
- <title language='en' format='text/plain'>Document title</title>
2062
- <language>en</language>
2063
- <script>Latn</script>
2064
- <abstract>
2065
- <p>Text</p>
2066
- </abstract>
2067
- <status>
2068
- <stage>published</stage>
2069
- </status>
2070
- <copyright>
2071
- <from>2020</from>
2072
- </copyright>
2073
- <ext>
2074
- <doctype>article</doctype>
2075
- </ext>
2076
- </bibdata>
2077
- <preface>
2078
- <abstract id='_'>
2079
- <title>Abstract</title>
2080
- <p id='_'>Text</p>
2081
- </abstract>
2082
- <foreword id='_' obligation='informative'>
2083
- <title>
2084
- Foreword
2085
- <fn reference='1'>
2086
- <p id='_'>A</p>
2087
- </fn>
2088
- </title>
2089
- <p id='_'>Text</p>
2090
- </foreword>
2091
- <introduction id='_' obligation='informative'>
2092
- <title>Introduction</title>
2093
- <clause id='_' inline-header='false' obligation='informative'>
2094
- <title>Introduction Subsection</title>
2095
- </clause>
2096
- </introduction>
2097
- <clause id='_' inline-header='false' obligation='informative'>
2098
- <title>Dedication</title>
2099
- </clause>
2100
- <acknowledgements id='_' obligation='informative'>
2101
- <title>
2102
- Acknowledgements
2103
- <fn reference='1'>
2104
- <p id='_'>A</p>
2105
- </fn>
2106
- </title>
2107
- </acknowledgements>
2108
- </preface>
2109
- <sections>
2110
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
2111
- <title>
2112
- Scope
2113
- <fn reference='1'>
2114
- <p id='_'>A</p>
2115
- </fn>
2116
- </title>
2117
- <p id='_'>Text</p>
2118
- </clause>
2119
- <terms id='_' obligation='normative'>
2120
- <title>
2121
- Terms and definitions
2122
- <fn reference='1'>
2123
- <p id='_'>A</p>
2124
- </fn>
2125
- </title>
2126
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
2127
- <term id='_'>
2128
- <preferred>Term1</preferred>
2129
- </term>
2130
- </terms>
2131
- <clause id='_' inline-header='false' obligation='normative'>
2132
- <title>
2133
- Terms, Definitions, Symbols and Abbreviated Terms.
2134
- <fn reference='1'>
2135
- <p id='_'>A</p>
2136
- </fn>
2137
- </title>
2138
- <clause id='_' inline-header='false' obligation='normative'>
2139
- <title>Introduction</title>
2140
- <clause id='_' inline-header='false' obligation='normative'>
2141
- <title>Intro 1</title>
2142
- </clause>
2143
- </clause>
2144
- <clause id='_' inline-header='false' obligation='normative'>
2145
- <title>Intro 2</title>
2146
- <clause id='_' inline-header='false' obligation='normative'>
2147
- <title>Intro 3</title>
2148
- </clause>
2149
- </clause>
2150
- <clause id='_' inline-header='false' obligation='normative'>
2151
- <title>Intro 4</title>
2152
- <clause id='_' inline-header='false' obligation='normative'>
2153
- <title>Intro 5</title>
2154
- <clause id='_' inline-header='false' obligation='normative'>
2155
- <title>Term1</title>
2156
- </clause>
2157
- </clause>
2158
- </clause>
2159
- <clause id='_' inline-header='false' obligation='normative'>
2160
- <title>Normal Terms</title>
2161
- <clause id='_' inline-header='false' obligation='normative'>
2162
- <title>Term2</title>
2163
- </clause>
2164
- </clause>
2165
- <definitions id='_' obligation='normative'>
2166
- <title>
2167
- Symbols and abbreviated terms
2168
- <fn reference='1'>
2169
- <p id='_'>A</p>
2170
- </fn>
2171
- </title>
2172
- <clause id='_' inline-header='false' obligation='normative'>
2173
- <title>General</title>
2174
- </clause>
2175
- <definitions id='_' type='symbols' obligation='normative'>
2176
- <title>
2177
- Symbols
2178
- <fn reference='1'>
2179
- <p id='_'>A</p>
2180
- </fn>
2181
- </title>
2182
- </definitions>
2183
- </definitions>
2184
- </clause>
2185
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
2186
- <title>
2187
- Abbreviated terms
2188
- <fn reference='1'>
2189
- <p id='_'>A</p>
2190
- </fn>
2191
- </title>
2192
- </definitions>
2193
- <clause id='_' inline-header='false' obligation='normative'>
2194
- <title>Clause 4</title>
2195
- <clause id='_' inline-header='false' obligation='normative'>
2196
- <title>Introduction</title>
2197
- </clause>
2198
- <clause id='_' inline-header='false' obligation='normative'>
2199
- <title>Clause 4.2</title>
2200
- </clause>
2201
- </clause>
2202
- <clause id='_' inline-header='false' obligation='normative'>
2203
- <title>Terms and Definitions</title>
2204
- </clause>
2205
- </sections>
2206
- <annex id='_' inline-header='false' obligation='normative'>
2207
- <title>
2208
- Annex.
2209
- <fn reference='1'>
2210
- <p id='_'>A</p>
2211
- </fn>
2212
- </title>
2213
- <clause id='_' inline-header='false' obligation='normative'>
2214
- <title>Annex A.1</title>
2215
- </clause>
2216
- </annex>
2217
- <bibliography>
2218
- <references id='_' normative='true' obligation='informative'>
2219
- <title>Normative references</title>
2220
- <p id='_'>There are no normative references in this document.</p>
2221
- </references>
2222
- <references id='_' normative='false' obligation='informative'>
2223
- <title>Bibliography</title>
2224
- </references>
2225
- <references id='_' normative='false' obligation='informative'>
2226
- <title>Bibliography</title>
2227
- </references>
2228
- <clause id='_' obligation='informative'>
2229
- <title>Bibliography</title>
2230
- <references id='_' normative='false' obligation='informative'>
2231
- <title>Bibliography Subsection</title>
2232
- </references>
2233
- </clause>
2234
- </bibliography>
2235
- </standard-document>
2236
- OUTPUT
2237
- end
2238
-
2239
- it "processes section names, default to English" do
2240
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2241
- #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: tlh\n:script: Latn\n:nodoc:")}
2242
- .Foreword
2243
-
2244
- Text
2245
-
2246
- [abstract]
2247
- == Abstract
2248
-
2249
- Text
2250
-
2251
- [heading=introduction]
2252
- == Introduction
2253
-
2254
- === Introduction Subsection
2255
-
2256
- [heading=acknowledgements]
2257
- == Acknowledgements
2258
-
2259
- [.preface]
2260
- == Dedication
2261
-
2262
- [heading=scope]
2263
- == Scope
2264
-
2265
- Text
2266
-
2267
- [bibliography,heading=normative references]
2268
- == Normative References
2269
-
2270
- [bibliography,normative=true]
2271
- == Normative References 2
2272
-
2273
- [heading=terms and definitions]
2274
- == Terms and Definitions
2275
-
2276
- === Term1
2277
-
2278
- [heading="terms and definitions"]
2279
- == Terms, Definitions, Symbols and Abbreviated Terms
2280
-
2281
- [.nonterm]
2282
- === Introduction
2283
-
2284
- ==== Intro 1
2285
-
2286
- === Intro 2
2287
-
2288
- [.nonterm]
2289
- ==== Intro 3
2290
-
2291
- === Intro 4
2292
-
2293
- ==== Intro 5
2294
-
2295
- ===== Term1
2296
-
2297
- === Normal Terms
2298
-
2299
- ==== Term2
2300
-
2301
- [heading=symbols and abbreviated terms]
2302
- === Symbols and Abbreviated Terms
2303
-
2304
- [.nonterm]
2305
- ==== General
2306
-
2307
- [heading=symbols]
2308
- ==== Symbols 1
2309
-
2310
- [heading=abbreviated terms]
2311
- == Abbreviated Terms
2312
-
2313
- == Clause 4
2314
-
2315
- === Introduction
2316
-
2317
- === Clause 4.2
2318
-
2319
- == Terms and Definitions
2320
-
2321
- [appendix]
2322
- == Annex
2323
-
2324
- === Annex A.1
2325
-
2326
- [bibliography,heading=bibliography]
2327
- == Bibliography
2328
-
2329
- [bibliography,normative=false]
2330
- == Bibliography 2
2331
-
2332
- === Bibliography Subsection
2333
-
2334
- INPUT
2335
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
2336
- <bibdata type='standard'>
2337
- <title language='en' format='text/plain'>Document title</title>
2338
- <language>tlh</language>
2339
- <script>Latn</script>
2340
- <abstract>
2341
- <p>Text</p>
2342
- </abstract>
2343
- <status>
2344
- <stage>published</stage>
2345
- </status>
2346
- <copyright>
2347
- <from>2020</from>
2348
- </copyright>
2349
- <ext>
2350
- <doctype>article</doctype>
2351
- </ext>
2352
- </bibdata>
2353
- <preface>
2354
- <abstract id='_'>
2355
- <title>Abstract</title>
2356
- <p id='_'>Text</p>
2357
- </abstract>
2358
- <foreword id='_' obligation='informative'>
2359
- <title>Foreword</title>
2360
- <p id='_'>Text</p>
2361
- </foreword>
2362
- <introduction id='_' obligation='informative'>
2363
- <title>Introduction</title>
2364
- <clause id='_' inline-header='false' obligation='informative'>
2365
- <title>Introduction Subsection</title>
2366
- </clause>
2367
- </introduction>
2368
- <clause id='_' inline-header='false' obligation='informative'>
2369
- <title>Dedication</title>
2370
- </clause>
2371
- <acknowledgements id='_' obligation='informative'>
2372
- <title>Acknowledgements</title>
2373
- </acknowledgements>
2374
- </preface>
2375
- <sections>
2376
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
2377
- <title>Scope</title>
2378
- <p id='_'>Text</p>
2379
- </clause>
2380
- <terms id='_' obligation='normative'>
2381
- <title>Terms and definitions</title>
2382
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
2383
- <term id='_'>
2384
- <preferred>Term1</preferred>
2385
- </term>
2386
- </terms>
2387
- <clause id='_' inline-header='false' obligation='normative'>
2388
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
2389
- <clause id='_' inline-header='false' obligation='normative'>
2390
- <title>Introduction</title>
2391
- <clause id='_' inline-header='false' obligation='normative'>
2392
- <title>Intro 1</title>
2393
- </clause>
2394
- </clause>
2395
- <clause id='_' inline-header='false' obligation='normative'>
2396
- <title>Intro 2</title>
2397
- <clause id='_' inline-header='false' obligation='normative'>
2398
- <title>Intro 3</title>
2399
- </clause>
2400
- </clause>
2401
- <clause id='_' inline-header='false' obligation='normative'>
2402
- <title>Intro 4</title>
2403
- <clause id='_' inline-header='false' obligation='normative'>
2404
- <title>Intro 5</title>
2405
- <clause id='_' inline-header='false' obligation='normative'>
2406
- <title>Term1</title>
2407
- </clause>
2408
- </clause>
2409
- </clause>
2410
- <clause id='_' inline-header='false' obligation='normative'>
2411
- <title>Normal Terms</title>
2412
- <clause id='_' inline-header='false' obligation='normative'>
2413
- <title>Term2</title>
2414
- </clause>
2415
- </clause>
2416
- <definitions id='_' obligation='normative'>
2417
- <title>Symbols and abbreviated terms</title>
2418
- <clause id='_' inline-header='false' obligation='normative'>
2419
- <title>General</title>
2420
- </clause>
2421
- <definitions id='_' type='symbols' obligation='normative'>
2422
- <title>Symbols</title>
2423
- </definitions>
2424
- </definitions>
2425
- </clause>
2426
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
2427
- <title>Abbreviated terms</title>
2428
- </definitions>
2429
- <clause id='_' inline-header='false' obligation='normative'>
2430
- <title>Clause 4</title>
2431
- <clause id='_' inline-header='false' obligation='normative'>
2432
- <title>Introduction</title>
2433
- </clause>
2434
- <clause id='_' inline-header='false' obligation='normative'>
2435
- <title>Clause 4.2</title>
2436
- </clause>
2437
- </clause>
2438
- <clause id='_' inline-header='false' obligation='normative'>
2439
- <title>Terms and Definitions</title>
2440
- </clause>
2441
- </sections>
2442
- <annex id='_' inline-header='false' obligation='normative'>
2443
- <title>Annex</title>
2444
- <clause id='_' inline-header='false' obligation='normative'>
2445
- <title>Annex A.1</title>
2446
- </clause>
2447
- </annex>
2448
- <bibliography>
2449
- <references id='_' normative='true' obligation='informative'>
2450
- <title>Normative references</title>
2451
- <p id='_'>There are no normative references in this document.</p>
2452
- </references>
2453
- <references id='_' normative='false' obligation='informative'>
2454
- <title>Bibliography</title>
2455
- </references>
2456
- <references id='_' normative='false' obligation='informative'>
2457
- <title>Bibliography</title>
2458
- </references>
2459
- <clause id='_' obligation='informative'>
2460
- <title>Bibliography</title>
2461
- <references id='_' normative='false' obligation='informative'>
2462
- <title>Bibliography Subsection</title>
2463
- </references>
2464
- </clause>
2465
- </bibliography>
2466
- </standard-document>
2467
- OUTPUT
2468
- end
2469
-
2470
- it "processes section names, French" do
2471
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2472
- #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: fr\n:script: Latn\n:nodoc:")}
2473
- .Foreword
2474
-
2475
- Text
2476
-
2477
- [abstract]
2478
- == Abstract
2479
-
2480
- Text
2481
-
2482
- [heading=introduction]
2483
- == Introduction
2484
-
2485
- === Introduction Subsection
2486
-
2487
- [heading=acknowledgements]
2488
- == Acknowledgements
2489
-
2490
- [.preface]
2491
- == Dedication
2492
-
2493
- [heading=scope]
2494
- == Scope
2495
-
2496
- Text
2497
-
2498
- [bibliography,heading=normative references]
2499
- == Normative References
2500
-
2501
- [bibliography,normative=true]
2502
- == Normative References 2
2503
-
2504
- [heading=terms and definitions]
2505
- == Terms and Definitions
2506
-
2507
- === Term1
2508
-
2509
- [heading="terms and definitions"]
2510
- == Terms, Definitions, Symbols and Abbreviated Terms
2511
-
2512
- [.nonterm]
2513
- === Introduction
2514
-
2515
- ==== Intro 1
2516
-
2517
- === Intro 2
2518
-
2519
- [.nonterm]
2520
- ==== Intro 3
2521
-
2522
- === Intro 4
2523
-
2524
- ==== Intro 5
2525
-
2526
- ===== Term1
2527
-
2528
- === Normal Terms
2529
-
2530
- ==== Term2
2531
-
2532
- [heading=symbols and abbreviated terms]
2533
- === Symbols and Abbreviated Terms
2534
-
2535
- [.nonterm]
2536
- ==== General
2537
-
2538
- [heading=symbols]
2539
- ==== Symbols 1
2540
-
2541
- [heading=abbreviated terms]
2542
- == Abbreviated Terms
2543
-
2544
- == Clause 4
2545
-
2546
- === Introduction
2547
-
2548
- === Clause 4.2
2549
-
2550
- == Terms and Definitions
2551
-
2552
- [appendix]
2553
- == Annex
2554
-
2555
- === Annex A.1
2556
-
2557
- [bibliography,heading=bibliography]
2558
- == Bibliography
2559
-
2560
- [bibliography,normative=false]
2561
- == Bibliography 2
2562
-
2563
- === Bibliography Subsection
2564
-
2565
- INPUT
2566
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
2567
- <bibdata type='standard'>
2568
- <title language='en' format='text/plain'>Document title</title>
2569
- <language>fr</language>
2570
- <script>Latn</script>
2571
- <abstract>
2572
- <p>Text</p>
2573
- </abstract>
2574
- <status>
2575
- <stage>published</stage>
2576
- </status>
2577
- <copyright>
2578
- <from>2020</from>
2579
- </copyright>
2580
- <ext>
2581
- <doctype>article</doctype>
2582
- </ext>
2583
- </bibdata>
2584
- <preface>
2585
- <abstract id='_'>
2586
- <title>Résumé</title>
2587
- <p id='_'>Text</p>
2588
- </abstract>
2589
- <foreword id='_' obligation='informative'>
2590
- <title>Avant-propos</title>
2591
- <p id='_'>Text</p>
2592
- </foreword>
2593
- <introduction id='_' obligation='informative'>
2594
- <title>Introduction</title>
2595
- <clause id='_' inline-header='false' obligation='informative'>
2596
- <title>Introduction Subsection</title>
2597
- </clause>
2598
- </introduction>
2599
- <clause id='_' inline-header='false' obligation='informative'>
2600
- <title>Dedication</title>
2601
- </clause>
2602
- <acknowledgements id='_' obligation='informative'>
2603
- <title>Remerciements</title>
2604
- </acknowledgements>
2605
- </preface>
2606
- <sections>
2607
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
2608
- <title>Domaine d’application</title>
2609
- <p id='_'>Text</p>
2610
- </clause>
2611
- <terms id='_' obligation='normative'>
2612
- <title>Terms et définitions</title>
2613
- <p id='_'>
2614
- Pour les besoins du présent document, les termes et définitions suivants
2615
- s’appliquent.
2616
- </p>
2617
- <term id='_'>
2618
- <preferred>Term1</preferred>
2619
- </term>
2620
- </terms>
2621
- <clause id='_' inline-header='false' obligation='normative'>
2622
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
2623
- <clause id='_' inline-header='false' obligation='normative'>
2624
- <title>Introduction</title>
2625
- <clause id='_' inline-header='false' obligation='normative'>
2626
- <title>Intro 1</title>
2627
- </clause>
2628
- </clause>
2629
- <clause id='_' inline-header='false' obligation='normative'>
2630
- <title>Intro 2</title>
2631
- <clause id='_' inline-header='false' obligation='normative'>
2632
- <title>Intro 3</title>
2633
- </clause>
2634
- </clause>
2635
- <clause id='_' inline-header='false' obligation='normative'>
2636
- <title>Intro 4</title>
2637
- <clause id='_' inline-header='false' obligation='normative'>
2638
- <title>Intro 5</title>
2639
- <clause id='_' inline-header='false' obligation='normative'>
2640
- <title>Term1</title>
2641
- </clause>
2642
- </clause>
2643
- </clause>
2644
- <clause id='_' inline-header='false' obligation='normative'>
2645
- <title>Normal Terms</title>
2646
- <clause id='_' inline-header='false' obligation='normative'>
2647
- <title>Term2</title>
2648
- </clause>
2649
- </clause>
2650
- <definitions id='_' obligation='normative'>
2651
- <title>Symboles et termes abrégés</title>
2652
- <clause id='_' inline-header='false' obligation='normative'>
2653
- <title>General</title>
2654
- </clause>
2655
- <definitions id='_' type='symbols' obligation='normative'>
2656
- <title>Symboles</title>
2657
- </definitions>
2658
- </definitions>
2659
- </clause>
2660
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
2661
- <title>Termes abrégés</title>
2662
- </definitions>
2663
- <clause id='_' inline-header='false' obligation='normative'>
2664
- <title>Clause 4</title>
2665
- <clause id='_' inline-header='false' obligation='normative'>
2666
- <title>Introduction</title>
2667
- </clause>
2668
- <clause id='_' inline-header='false' obligation='normative'>
2669
- <title>Clause 4.2</title>
2670
- </clause>
2671
- </clause>
2672
- <clause id='_' inline-header='false' obligation='normative'>
2673
- <title>Terms and Definitions</title>
2674
- </clause>
2675
- </sections>
2676
- <annex id='_' inline-header='false' obligation='normative'>
2677
- <title>Annex</title>
2678
- <clause id='_' inline-header='false' obligation='normative'>
2679
- <title>Annex A.1</title>
2680
- </clause>
2681
- </annex>
2682
- <bibliography>
2683
- <references id='_' normative='true' obligation='informative'>
2684
- <title>Références normatives</title>
2685
- <p id='_'>Le présent document ne contient aucune référence normative.</p>
2686
- </references>
2687
- <references id='_' normative='false' obligation='informative'>
2688
- <title>Bibliographie</title>
2689
- </references>
2690
- <references id='_' normative='false' obligation='informative'>
2691
- <title>Bibliography</title>
2692
- </references>
2693
- <clause id='_' obligation='informative'>
2694
- <title>Bibliography</title>
2695
- <references id='_' normative='false' obligation='informative'>
2696
- <title>Bibliography Subsection</title>
2697
- </references>
2698
- </clause>
2699
- </bibliography>
2700
- </standard-document>
2701
- OUTPUT
2702
- end
2703
-
2704
- it "processes section names, Simplified Chinese" do
2705
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2706
- #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: zh\n:script: Hans\n:nodoc:")}
2707
- .Foreword
2708
-
2709
- Text
2710
-
2711
- [abstract]
2712
- == Abstract
2713
-
2714
- Text
2715
-
2716
- [heading=introduction]
2717
- == Introduction
2718
-
2719
- === Introduction Subsection
2720
-
2721
- [heading=acknowledgements]
2722
- == Acknowledgements
2723
-
2724
- [.preface]
2725
- == Dedication
2726
-
2727
- [heading=scope]
2728
- == Scope
2729
-
2730
- Text
2731
-
2732
- [bibliography,heading=normative references]
2733
- == Normative References
2734
-
2735
- [bibliography,normative=true]
2736
- == Normative References 2
2737
-
2738
- [heading=terms and definitions]
2739
- == Terms and Definitions
2740
-
2741
- === Term1
2742
-
2743
- [heading="terms and definitions"]
2744
- == Terms, Definitions, Symbols and Abbreviated Terms
2745
-
2746
- [.nonterm]
2747
- === Introduction
2748
-
2749
- ==== Intro 1
2750
-
2751
- === Intro 2
2752
-
2753
- [.nonterm]
2754
- ==== Intro 3
2755
-
2756
- === Intro 4
2757
-
2758
- ==== Intro 5
2759
-
2760
- ===== Term1
2761
-
2762
- === Normal Terms
2763
-
2764
- ==== Term2
2765
-
2766
- [heading=symbols and abbreviated terms]
2767
- === Symbols and Abbreviated Terms
2768
-
2769
- [.nonterm]
2770
- ==== General
2771
-
2772
- [heading=symbols]
2773
- ==== Symbols 1
2774
-
2775
- [heading=abbreviated terms]
2776
- == Abbreviated Terms
2777
-
2778
- == Clause 4
2779
-
2780
- === Introduction
2781
-
2782
- === Clause 4.2
2783
-
2784
- == Terms and Definitions
2785
-
2786
- [appendix]
2787
- == Annex
2788
-
2789
- === Annex A.1
2790
-
2791
- [bibliography,heading=bibliography]
2792
- == Bibliography
2793
-
2794
- [bibliography,normative=false]
2795
- == Bibliography 2
2796
-
2797
- === Bibliography Subsection
2798
-
2799
- INPUT
2800
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
2801
- <bibdata type='standard'>
2802
- <title language='en' format='text/plain'>Document title</title>
2803
- <language>zh</language>
2804
- <script>Hans</script>
2805
- <abstract>
2806
- <p>Text</p>
2807
- </abstract>
2808
- <status>
2809
- <stage>published</stage>
2810
- </status>
2811
- <copyright>
2812
- <from>2020</from>
2813
- </copyright>
2814
- <ext>
2815
- <doctype>article</doctype>
2816
- </ext>
2817
- </bibdata>
2818
- <preface>
2819
- <abstract id='_'>
2820
- <title>摘要</title>
2821
- <p id='_'>Text</p>
2822
- </abstract>
2823
- <foreword id='_' obligation='informative'>
2824
- <title>前言</title>
2825
- <p id='_'>Text</p>
2826
- </foreword>
2827
- <introduction id='_' obligation='informative'>
2828
- <title>引言</title>
2829
- <clause id='_' inline-header='false' obligation='informative'>
2830
- <title>Introduction Subsection</title>
2831
- </clause>
2832
- </introduction>
2833
- <clause id='_' inline-header='false' obligation='informative'>
2834
- <title>Dedication</title>
2835
- </clause>
2836
- <acknowledgements id='_' obligation='informative'>
2837
- <title>致謝</title>
2838
- </acknowledgements>
2839
- </preface>
2840
- <sections>
2841
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
2842
- <title>范围</title>
2843
- <p id='_'>Text</p>
2844
- </clause>
2845
- <terms id='_' obligation='normative'>
2846
- <title>术语和定义</title>
2847
- <p id='_'>下列术语和定义适用于本文件。</p>
2848
- <term id='_'>
2849
- <preferred>Term1</preferred>
2850
- </term>
2851
- </terms>
2852
- <clause id='_' inline-header='false' obligation='normative'>
2853
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
2854
- <clause id='_' inline-header='false' obligation='normative'>
2855
- <title>Introduction</title>
2856
- <clause id='_' inline-header='false' obligation='normative'>
2857
- <title>Intro 1</title>
2858
- </clause>
2859
- </clause>
2860
- <clause id='_' inline-header='false' obligation='normative'>
2861
- <title>Intro 2</title>
2862
- <clause id='_' inline-header='false' obligation='normative'>
2863
- <title>Intro 3</title>
2864
- </clause>
2865
- </clause>
2866
- <clause id='_' inline-header='false' obligation='normative'>
2867
- <title>Intro 4</title>
2868
- <clause id='_' inline-header='false' obligation='normative'>
2869
- <title>Intro 5</title>
2870
- <clause id='_' inline-header='false' obligation='normative'>
2871
- <title>Term1</title>
2872
- </clause>
2873
- </clause>
2874
- </clause>
2875
- <clause id='_' inline-header='false' obligation='normative'>
2876
- <title>Normal Terms</title>
2877
- <clause id='_' inline-header='false' obligation='normative'>
2878
- <title>Term2</title>
2879
- </clause>
2880
- </clause>
2881
- <definitions id='_' obligation='normative'>
2882
- <title>符号、代号和缩略语</title>
2883
- <clause id='_' inline-header='false' obligation='normative'>
2884
- <title>General</title>
2885
- </clause>
2886
- <definitions id='_' type='symbols' obligation='normative'>
2887
- <title>符号</title>
2888
- </definitions>
2889
- </definitions>
2890
- </clause>
2891
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
2892
- <title>代号和缩略语</title>
2893
- </definitions>
2894
- <clause id='_' inline-header='false' obligation='normative'>
2895
- <title>Clause 4</title>
2896
- <clause id='_' inline-header='false' obligation='normative'>
2897
- <title>Introduction</title>
2898
- </clause>
2899
- <clause id='_' inline-header='false' obligation='normative'>
2900
- <title>Clause 4.2</title>
2901
- </clause>
2902
- </clause>
2903
- <clause id='_' inline-header='false' obligation='normative'>
2904
- <title>Terms and Definitions</title>
2905
- </clause>
2906
- </sections>
2907
- <annex id='_' inline-header='false' obligation='normative'>
2908
- <title>Annex</title>
2909
- <clause id='_' inline-header='false' obligation='normative'>
2910
- <title>Annex A.1</title>
2911
- </clause>
2912
- </annex>
2913
- <bibliography>
2914
- <references id='_' normative='true' obligation='informative'>
2915
- <title>规范性引用文件</title>
2916
- <p id='_'>本文件并没有规范性引用文件。</p>
2917
- </references>
2918
- <references id='_' normative='false' obligation='informative'>
2919
- <title>参考文献</title>
2920
- </references>
2921
- <references id='_' normative='false' obligation='informative'>
2922
- <title>Bibliography</title>
2923
- </references>
2924
- <clause id='_' obligation='informative'>
2925
- <title>Bibliography</title>
2926
- <references id='_' normative='false' obligation='informative'>
2927
- <title>Bibliography Subsection</title>
2928
- </references>
2929
- </clause>
2930
- </bibliography>
2931
- </standard-document>
2932
- OUTPUT
2933
- end
2934
-
2935
- it "processes section names, internationalisation file" do
2936
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2937
- #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":i18nyaml: spec/assets/i18n.yaml")}
2938
- .Foreword
2939
-
2940
- Text
2941
-
2942
- [abstract]
2943
- == Abstract
2944
-
2945
- Text
2946
-
2947
- [heading=introduction]
2948
- == Introduction
2949
-
2950
- === Introduction Subsection
2951
-
2952
- [heading=acknowledgements]
2953
- == Acknowledgements
2954
-
2955
- [.preface]
2956
- == Dedication
2957
-
2958
- [heading=scope]
2959
- == Scope
2960
-
2961
- Text
2962
-
2963
- [bibliography,heading=normative references]
2964
- == Normative References
2965
-
2966
- [bibliography,normative=true]
2967
- == Normative References 2
2968
-
2969
- [heading=terms and definitions]
2970
- == Terms and Definitions
2971
-
2972
- === Term1
2973
-
2974
- [heading="terms and definitions"]
2975
- == Terms, Definitions, Symbols and Abbreviated Terms
2976
-
2977
- [.nonterm]
2978
- === Introduction
2979
-
2980
- ==== Intro 1
2981
-
2982
- === Intro 2
2983
-
2984
- [.nonterm]
2985
- ==== Intro 3
2986
-
2987
- === Intro 4
2988
-
2989
- ==== Intro 5
2990
-
2991
- ===== Term1
2992
-
2993
- === Normal Terms
2994
-
2995
- ==== Term2
2996
-
2997
- [heading=symbols and abbreviated terms]
2998
- === Symbols and Abbreviated Terms
2999
-
3000
- [.nonterm]
3001
- ==== General
3002
-
3003
- [heading=symbols]
3004
- ==== Symbols 1
3005
-
3006
- [heading=abbreviated terms]
3007
- == Abbreviated Terms
3008
-
3009
- == Clause 4
3010
-
3011
- === Introduction
3012
-
3013
- === Clause 4.2
3014
-
3015
- == Terms and Definitions
3016
-
3017
- [appendix]
3018
- == Annex
3019
-
3020
- === Annex A.1
3021
-
3022
- [bibliography,heading=bibliography]
3023
- == Bibliography
3024
-
3025
- [bibliography,normative=false]
3026
- == Bibliography 2
3027
-
3028
- === Bibliography Subsection
3029
-
3030
- INPUT
3031
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
3032
- <bibdata type='standard'>
3033
- <title language='en' format='text/plain'>Document title</title>
3034
- <language>en</language>
3035
- <script>Latn</script>
3036
- <abstract>
3037
- <p>Text</p>
3038
- </abstract>
3039
- <status>
3040
- <stage>published</stage>
3041
- </status>
3042
- <copyright>
3043
- <from>2020</from>
3044
- </copyright>
3045
- <ext>
3046
- <doctype>article</doctype>
3047
- </ext>
3048
- </bibdata>
3049
- <preface>
3050
- <abstract id='_'>
3051
- <title>Abstract</title>
3052
- <p id='_'>Text</p>
3053
- </abstract>
3054
- <foreword id='_' obligation='informative'>
3055
- <title>Antaŭparolo</title>
3056
- <p id='_'>Text</p>
3057
- </foreword>
3058
- <introduction id='_' obligation='informative'>
3059
- <title>Enkonduko</title>
3060
- <clause id='_' inline-header='false' obligation='informative'>
3061
- <title>Introduction Subsection</title>
3062
- </clause>
3063
- </introduction>
3064
- <clause id='_' inline-header='false' obligation='informative'>
3065
- <title>Dedication</title>
3066
- </clause>
3067
- <acknowledgements id='_' obligation='informative'>
3068
- <title>Acknowledgements</title>
3069
- </acknowledgements>
3070
- </preface>
3071
- <sections>
3072
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
3073
- <title>Amplekso</title>
3074
- <p id='_'>Text</p>
3075
- </clause>
3076
- <terms id='_' obligation='normative'>
3077
- <title>Terms and definitions</title>
3078
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
3079
- <term id='_'>
3080
- <preferred>Term1</preferred>
3081
- </term>
3082
- </terms>
3083
- <clause id='_' inline-header='false' obligation='normative'>
3084
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
3085
- <clause id='_' inline-header='false' obligation='normative'>
3086
- <title>Introduction</title>
3087
- <clause id='_' inline-header='false' obligation='normative'>
3088
- <title>Intro 1</title>
3089
- </clause>
3090
- </clause>
3091
- <clause id='_' inline-header='false' obligation='normative'>
3092
- <title>Intro 2</title>
3093
- <clause id='_' inline-header='false' obligation='normative'>
3094
- <title>Intro 3</title>
3095
- </clause>
3096
- </clause>
3097
- <clause id='_' inline-header='false' obligation='normative'>
3098
- <title>Intro 4</title>
3099
- <clause id='_' inline-header='false' obligation='normative'>
3100
- <title>Intro 5</title>
3101
- <clause id='_' inline-header='false' obligation='normative'>
3102
- <title>Term1</title>
3103
- </clause>
3104
- </clause>
3105
- </clause>
3106
- <clause id='_' inline-header='false' obligation='normative'>
3107
- <title>Normal Terms</title>
3108
- <clause id='_' inline-header='false' obligation='normative'>
3109
- <title>Term2</title>
3110
- </clause>
3111
- </clause>
3112
- <definitions id='_' obligation='normative'>
3113
- <title>Symbols and abbreviated terms</title>
3114
- <clause id='_' inline-header='false' obligation='normative'>
3115
- <title>General</title>
3116
- </clause>
3117
- <definitions id='_' type='symbols' obligation='normative'>
3118
- <title>Simboloj kai mallongigitaj terminoj</title>
3119
- </definitions>
3120
- </definitions>
3121
- </clause>
3122
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
3123
- <title>Abbreviated terms</title>
3124
- </definitions>
3125
- <clause id='_' inline-header='false' obligation='normative'>
3126
- <title>Clause 4</title>
3127
- <clause id='_' inline-header='false' obligation='normative'>
3128
- <title>Introduction</title>
3129
- </clause>
3130
- <clause id='_' inline-header='false' obligation='normative'>
3131
- <title>Clause 4.2</title>
3132
- </clause>
3133
- </clause>
3134
- <clause id='_' inline-header='false' obligation='normative'>
3135
- <title>Terms and Definitions</title>
3136
- </clause>
3137
- </sections>
3138
- <annex id='_' inline-header='false' obligation='normative'>
3139
- <title>Annex</title>
3140
- <clause id='_' inline-header='false' obligation='normative'>
3141
- <title>Annex A.1</title>
3142
- </clause>
3143
- </annex>
3144
- <bibliography>
3145
- <references id='_' normative='true' obligation='informative'>
3146
- <title>Normaj citaĵoj</title>
3147
- <p id='_'>There are no normative references in this document.</p>
3148
- </references>
3149
- <references id='_' normative='false' obligation='informative'>
3150
- <title>Bibliografio</title>
3151
- </references>
3152
- <references id='_' normative='false' obligation='informative'>
3153
- <title>Bibliography</title>
3154
- </references>
3155
- <clause id='_' obligation='informative'>
3156
- <title>Bibliography</title>
3157
- <references id='_' normative='false' obligation='informative'>
3158
- <title>Bibliography Subsection</title>
3159
- </references>
3160
- </clause>
3161
- </bibliography>
3162
- </standard-document>
3163
- OUTPUT
3164
- end
3165
-
3166
- it "fixes illegal anchors" do
3167
- input = <<~INPUT
3168
- #{ASCIIDOC_BLANK_HDR}
3169
-
3170
- [[a:b]]
3171
- == A
3172
- <</:ab>>
3173
- <<:>>
3174
- <<1>>
3175
- <<1:>>
3176
- <<1#b>>
3177
- <<:a#b:>>
1828
+ [[a:b]]
1829
+ == A
1830
+ <</:ab>>
1831
+ <<:>>
1832
+ <<1>>
1833
+ <<1:>>
1834
+ <<1#b>>
1835
+ <<:a#b:>>
3178
1836
 
3179
1837
  INPUT
3180
1838
  expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true).gsub(/<p id="_[^"]+">/, "").gsub('</p>', ""))).to be_equivalent_to (<<~"OUTPUT")
@@ -3250,10 +1908,150 @@ expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true))
3250
1908
  </standard-document>
3251
1909
  OUTPUT
3252
1910
 
1911
+ end
1912
+ it "customises italicisation of MathML" do
1913
+ input = <<~INPUT
1914
+ = Document title
1915
+ Author
1916
+ :stem:
1917
+
1918
+ [stem]
1919
+ ++++
1920
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1921
+ <mi>A</mi>
1922
+ <mo>+</mo>
1923
+ <mi>a</mi>
1924
+ <mo>+</mo>
1925
+ <mi>Α</mi>
1926
+ <mo>+</mo>
1927
+ <mi>α</mi>
1928
+ <mo>+</mo>
1929
+ <mi>AB</mi>
1930
+ </math>
1931
+ ++++
1932
+ INPUT
1933
+
1934
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1935
+ #{BLANK_HDR}
1936
+ <sections>
1937
+ <formula id='_'>
1938
+ <stem type='MathML'>
1939
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1940
+ <mi>A</mi>
1941
+ <mo>+</mo>
1942
+ <mi>a</mi>
1943
+ <mo>+</mo>
1944
+ <mi>Α</mi>
1945
+ <mo>+</mo>
1946
+ <mi>α</mi>
1947
+ <mo>+</mo>
1948
+ <mi>AB</mi>
1949
+ </math>
1950
+ </stem>
1951
+ </formula>
1952
+ </sections>
1953
+ </standard-document>
1954
+ OUTPUT
1955
+ mock_mathml_italicise({ uppergreek: false, upperroman: true, lowergreek: true, lowerroman: true })
1956
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1957
+ #{BLANK_HDR}
1958
+ <sections>
1959
+ <formula id='_'>
1960
+ <stem type='MathML'>
1961
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1962
+ <mi>A</mi>
1963
+ <mo>+</mo>
1964
+ <mi>a</mi>
1965
+ <mo>+</mo>
1966
+ <mi mathvariant="normal">Α</mi>
1967
+ <mo>+</mo>
1968
+ <mi>α</mi>
1969
+ <mo>+</mo>
1970
+ <mi>AB</mi>
1971
+ </math>
1972
+ </stem>
1973
+ </formula>
1974
+ </sections>
1975
+ </standard-document>
1976
+ OUTPUT
1977
+ mock_mathml_italicise({ uppergreek: true, upperroman: false, lowergreek: true, lowerroman: true })
1978
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1979
+ #{BLANK_HDR}
1980
+ <sections>
1981
+ <formula id='_'>
1982
+ <stem type='MathML'>
1983
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1984
+ <mi mathvariant="normal">A</mi>
1985
+ <mo>+</mo>
1986
+ <mi>a</mi>
1987
+ <mo>+</mo>
1988
+ <mi>Α</mi>
1989
+ <mo>+</mo>
1990
+ <mi>α</mi>
1991
+ <mo>+</mo>
1992
+ <mi>AB</mi>
1993
+ </math>
1994
+ </stem>
1995
+ </formula>
1996
+ </sections>
1997
+ </standard-document>
1998
+ OUTPUT
1999
+ mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: false, lowerroman: true })
2000
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2001
+ #{BLANK_HDR}
2002
+ <sections>
2003
+ <formula id='_'>
2004
+ <stem type='MathML'>
2005
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2006
+ <mi>A</mi>
2007
+ <mo>+</mo>
2008
+ <mi>a</mi>
2009
+ <mo>+</mo>
2010
+ <mi>Α</mi>
2011
+ <mo>+</mo>
2012
+ <mi mathvariant="normal">α</mi>
2013
+ <mo>+</mo>
2014
+ <mi>AB</mi>
2015
+ </math>
2016
+ </stem>
2017
+ </formula>
2018
+ </sections>
2019
+ </standard-document>
2020
+ OUTPUT
2021
+ mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: true, lowerroman: false })
2022
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2023
+ #{BLANK_HDR}
2024
+ <sections>
2025
+ <formula id='_'>
2026
+ <stem type='MathML'>
2027
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2028
+ <mi>A</mi>
2029
+ <mo>+</mo>
2030
+ <mi mathvariant="normal">a</mi>
2031
+ <mo>+</mo>
2032
+ <mi>Α</mi>
2033
+ <mo>+</mo>
2034
+ <mi>α</mi>
2035
+ <mo>+</mo>
2036
+ <mi>AB</mi>
2037
+ </math>
2038
+ </stem>
2039
+ </formula>
2040
+ </sections>
2041
+ </standard-document>
2042
+ OUTPUT
2043
+ mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: true, lowerroman: true })
2044
+
2045
+
3253
2046
  end
3254
2047
 
3255
2048
  private
3256
2049
 
2050
+ def mock_mathml_italicise(x)
2051
+ allow_any_instance_of(::Asciidoctor::Standoc::Cleanup).to receive(:mathml_mi_italics).and_return(x)
2052
+ end
2053
+
2054
+
3257
2055
  def mock_iecbib_get_iec60050_103_01
3258
2056
  expect(Iecbib::IecBibliography).to receive(:get).with("IEC 60050-103", nil, {keep_year: true}) do
3259
2057
  IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")