metanorma-standoc 1.5.3 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +66 -0
  3. data/README.adoc +1 -3
  4. data/lib/asciidoctor/standoc/base.rb +6 -1
  5. data/lib/asciidoctor/standoc/basicdoc.rng +4 -11
  6. data/lib/asciidoctor/standoc/cleanup.rb +78 -12
  7. data/lib/asciidoctor/standoc/cleanup_block.rb +41 -4
  8. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +14 -0
  9. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +25 -0
  10. data/lib/asciidoctor/standoc/cleanup_inline.rb +6 -2
  11. data/lib/asciidoctor/standoc/cleanup_ref.rb +3 -4
  12. data/lib/asciidoctor/standoc/converter.rb +58 -3
  13. data/lib/asciidoctor/standoc/front.rb +9 -3
  14. data/lib/asciidoctor/standoc/front_contributor.rb +43 -11
  15. data/lib/asciidoctor/standoc/inline.rb +18 -40
  16. data/lib/asciidoctor/standoc/isodoc.rng +27 -50
  17. data/lib/asciidoctor/standoc/lists.rb +4 -2
  18. data/lib/asciidoctor/standoc/macros.rb +28 -2
  19. data/lib/asciidoctor/standoc/ref.rb +46 -48
  20. data/lib/asciidoctor/standoc/ref_sect.rb +16 -8
  21. data/lib/asciidoctor/standoc/section.rb +5 -9
  22. data/lib/liquid/custom_blocks/with_json_nested_context.rb +18 -0
  23. data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +19 -0
  24. data/lib/metanorma/standoc.rb +0 -5
  25. data/lib/metanorma/standoc/version.rb +20 -1
  26. data/metanorma-standoc.gemspec +7 -3
  27. data/spec/asciidoctor-standoc/base_spec.rb +246 -9
  28. data/spec/asciidoctor-standoc/blocks_spec.rb +1 -1
  29. data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1514 -0
  30. data/spec/asciidoctor-standoc/cleanup_spec.rb +384 -1547
  31. data/spec/asciidoctor-standoc/inline_spec.rb +128 -4
  32. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +15 -22
  33. data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
  34. data/spec/asciidoctor-standoc/macros_json2text_spec.rb +1 -1
  35. data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
  36. data/spec/asciidoctor-standoc/macros_spec.rb +258 -0
  37. data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +1 -1
  38. data/spec/asciidoctor-standoc/refs_dl_spec.rb +8 -8
  39. data/spec/asciidoctor-standoc/refs_spec.rb +362 -104
  40. data/spec/asciidoctor-standoc/validate_spec.rb +26 -0
  41. data/spec/fixtures/diagram_definitions.lutaml +22 -0
  42. data/spec/fixtures/test.exp +121 -0
  43. data/spec/spec_helper.rb +34 -1
  44. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +201 -3
  45. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +47 -231
  46. data/spec/vcr_cassettes/isobib_get_123.yml +14 -60
  47. data/spec/vcr_cassettes/isobib_get_123_1.yml +24 -116
  48. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +361 -0
  49. data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -60
  50. data/spec/vcr_cassettes/isobib_get_124.yml +12 -58
  51. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  52. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +292 -162
  53. metadata +59 -17
  54. data/.github/workflows/macos.yml +0 -46
  55. data/.github/workflows/ubuntu.yml +0 -49
  56. data/.github/workflows/windows.yml +0 -53
  57. data/lib/asciidoctor/standoc/base_structured_text_preprocessor.rb +0 -123
  58. data/lib/asciidoctor/standoc/json2_text_preprocessor.rb +0 -43
  59. data/lib/asciidoctor/standoc/yaml2_text_preprocessor.rb +0 -43
  60. data/lib/metanorma/standoc/latexml_requirement.rb +0 -62
  61. data/lib/metanorma/standoc/requirement.rb +0 -13
@@ -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
@@ -1236,8 +1163,9 @@ end
1236
1163
  <uri type="src">https://webstore.iec.ch/publication/160</uri>
1237
1164
  <uri type="obp">/preview/info_iec60050-102%7Bed1.0%7Db.pdf</uri>
1238
1165
  <docidentifier type="IEC">IEC 60050-102:2007</docidentifier>
1166
+ <docidentifier type='URN'>urn:iec:std:iec:60050-102:2007:::en</docidentifier>
1239
1167
  <date type="published">
1240
- <on>2007</on>
1168
+ <on>2007-08-27</on>
1241
1169
  </date>
1242
1170
  <contributor>
1243
1171
  <role type="publisher"/>
@@ -1274,8 +1202,9 @@ end
1274
1202
  <uri type="src">https://webstore.iec.ch/publication/161</uri>
1275
1203
  <uri type="obp">/preview/info_iec60050-103%7Bed1.0%7Db.pdf</uri>
1276
1204
  <docidentifier type="IEC">IEC 60050-103:2009</docidentifier>
1205
+ <docidentifier type='URN'>urn:iec:std:iec:60050-103:2009:::en</docidentifier>
1277
1206
  <date type="published">
1278
- <on>2009</on>
1207
+ <on>2009-12-14</on>
1279
1208
  </date>
1280
1209
  <contributor>
1281
1210
  <role type="publisher"/>
@@ -1538,72 +1467,6 @@ OUTPUT
1538
1467
  OUTPUT
1539
1468
  end
1540
1469
 
1541
- it "inserts boilerplate before empty Normative References" do
1542
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1543
- #{ASCIIDOC_BLANK_HDR}
1544
-
1545
- [bibliography]
1546
- == Normative References
1547
-
1548
- INPUT
1549
- #{BLANK_HDR}
1550
- <sections>
1551
-
1552
- </sections><bibliography><references id="_" obligation="informative" normative="true">
1553
- <title>Normative references</title><p id="_">There are no normative references in this document.</p>
1554
- </references></bibliography>
1555
- </standard-document>
1556
- OUTPUT
1557
- end
1558
-
1559
- it "inserts boilerplate before non-empty Normative References" do
1560
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1561
- #{ASCIIDOC_BLANK_HDR}
1562
-
1563
- [bibliography]
1564
- == Normative References
1565
- * [[[a,b]]] A
1566
-
1567
- INPUT
1568
- #{BLANK_HDR}
1569
- <sections>
1570
-
1571
- </sections><bibliography><references id="_" obligation="informative" normative="true">
1572
- <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>
1573
- <bibitem id="a">
1574
- <formattedref format="application/x-isodoc+xml">A</formattedref>
1575
- <docidentifier>b</docidentifier>
1576
- </bibitem>
1577
- </references></bibliography>
1578
- </standard-document>
1579
-
1580
- OUTPUT
1581
- end
1582
-
1583
- it "inserts boilerplate before empty Normative References in French" do
1584
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1585
- = Document title
1586
- Author
1587
- :docfile: test.adoc
1588
- :nodoc:
1589
- :novalid:
1590
- :no-isobib:
1591
- :language: fr
1592
-
1593
- [bibliography]
1594
- == Normative References
1595
-
1596
- INPUT
1597
- #{BLANK_HDR.sub(/<language>en/, "<language>fr")}
1598
- <sections>
1599
-
1600
- </sections><bibliography><references id="_" obligation="informative" normative="true">
1601
- <title>Références normatives</title><p id="_">Le présent document ne contient aucune référence normative.</p>
1602
- </references></bibliography>
1603
- </standard-document>
1604
- OUTPUT
1605
- end
1606
-
1607
1470
  it "removes bibdata bibitem IDs" do
1608
1471
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1609
1472
  = Document title
@@ -1619,7 +1482,7 @@ it "removes bibdata bibitem IDs" do
1619
1482
 
1620
1483
  INPUT
1621
1484
  <?xml version='1.0' encoding='UTF-8'?>
1622
- <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
1485
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1623
1486
  <bibdata type='standard'>
1624
1487
  <title language='en' format='text/plain'>Document title</title>
1625
1488
  <language>en</language>
@@ -1665,7 +1528,7 @@ it "imports boilerplate file" do
1665
1528
  == Clause 1
1666
1529
 
1667
1530
  INPUT
1668
- <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
1531
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1669
1532
  <bibdata type='standard'>
1670
1533
  <title language='en' format='text/plain'>Document title</title>
1671
1534
  <language>en</language>
@@ -1958,1225 +1821,22 @@ OUTPUT
1958
1821
  end
1959
1822
 
1960
1823
 
1961
- it "processes section names, with footnotes" do
1962
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1963
- #{ASCIIDOC_BLANK_HDR}
1964
- .Foreword.footnote:[A]
1965
-
1966
- Text
1967
-
1968
- [abstract]
1969
- == Abstract.footnote:[A]
1970
-
1971
- Text
1972
-
1973
- [heading=introduction]
1974
- == Introduction.footnote:[A]
1975
-
1976
- === Introduction Subsection
1977
-
1978
- [heading=acknowledgements]
1979
- == Acknowledgements.footnote:[A]
1980
-
1981
- [.preface]
1982
- == Dedication
1983
-
1984
- [heading=scope]
1985
- == Scope.footnote:[A]
1986
-
1987
- Text
1988
-
1989
- [bibliography,heading=normative references]
1990
- == Normative References.footnote:[A]
1991
-
1992
- [bibliography,normative=true]
1993
- == Normative References 2.footnote:[A]
1994
-
1995
- [heading=terms and definitions]
1996
- == Terms and Definitions.footnote:[A]
1997
-
1998
- === Term1
1999
-
2000
- [heading="terms and definitions"]
2001
- == Terms, Definitions, Symbols and Abbreviated Terms.footnote:[A]
2002
-
2003
- [.nonterm]
2004
- === Introduction
2005
-
2006
- ==== Intro 1
2007
-
2008
- === Intro 2
2009
-
2010
- [.nonterm]
2011
- ==== Intro 3
2012
-
2013
- === Intro 4
2014
-
2015
- ==== Intro 5
2016
-
2017
- ===== Term1
2018
-
2019
- === Normal Terms
2020
-
2021
- ==== Term2
2022
-
2023
- [heading=symbols and abbreviated terms]
2024
- === Symbols and Abbreviated Terms.footnote:[A]
2025
-
2026
- [.nonterm]
2027
- ==== General
2028
-
2029
- [heading=symbols]
2030
- ==== Symbols 1.footnote:[A]
2031
-
2032
- [heading=abbreviated terms]
2033
- == Abbreviated Terms.footnote:[A]
2034
-
2035
- == Clause 4
1824
+ it "fixes illegal anchors" do
1825
+ input = <<~INPUT
1826
+ #{ASCIIDOC_BLANK_HDR}
2036
1827
 
2037
- === Introduction
2038
-
2039
- === Clause 4.2
2040
-
2041
- == Terms and Definitions
2042
-
2043
- [appendix]
2044
- == Annex.footnote:[A]
2045
-
2046
- === Annex A.1
2047
-
2048
- [bibliography,heading=bibliography]
2049
- == Bibliography.footnote:[A]
2050
-
2051
- [bibliography,normative=false]
2052
- == Bibliography 2.footnote:[A]
2053
-
2054
- === Bibliography Subsection
2055
-
2056
- INPUT
2057
- <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
2058
- <bibdata type='standard'>
2059
- <title language='en' format='text/plain'>Document title</title>
2060
- <language>en</language>
2061
- <script>Latn</script>
2062
- <abstract>
2063
- <p>Text</p>
2064
- </abstract>
2065
- <status>
2066
- <stage>published</stage>
2067
- </status>
2068
- <copyright>
2069
- <from>2020</from>
2070
- </copyright>
2071
- <ext>
2072
- <doctype>article</doctype>
2073
- </ext>
2074
- </bibdata>
2075
- <preface>
2076
- <abstract id='_'>
2077
- <title>Abstract</title>
2078
- <p id='_'>Text</p>
2079
- </abstract>
2080
- <foreword id='_' obligation='informative'>
2081
- <title>
2082
- Foreword
2083
- <fn reference='1'>
2084
- <p id='_'>A</p>
2085
- </fn>
2086
- </title>
2087
- <p id='_'>Text</p>
2088
- </foreword>
2089
- <introduction id='_' obligation='informative'>
2090
- <title>Introduction</title>
2091
- <clause id='_' inline-header='false' obligation='informative'>
2092
- <title>Introduction Subsection</title>
2093
- </clause>
2094
- </introduction>
2095
- <clause id='_' inline-header='false' obligation='informative'>
2096
- <title>Dedication</title>
2097
- </clause>
2098
- <acknowledgements id='_' obligation='informative'>
2099
- <title>
2100
- Acknowledgements
2101
- <fn reference='1'>
2102
- <p id='_'>A</p>
2103
- </fn>
2104
- </title>
2105
- </acknowledgements>
2106
- </preface>
2107
- <sections>
2108
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
2109
- <title>
2110
- Scope
2111
- <fn reference='1'>
2112
- <p id='_'>A</p>
2113
- </fn>
2114
- </title>
2115
- <p id='_'>Text</p>
2116
- </clause>
2117
- <terms id='_' obligation='normative'>
2118
- <title>
2119
- Terms and definitions
2120
- <fn reference='1'>
2121
- <p id='_'>A</p>
2122
- </fn>
2123
- </title>
2124
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
2125
- <term id='_'>
2126
- <preferred>Term1</preferred>
2127
- </term>
2128
- </terms>
2129
- <clause id='_' inline-header='false' obligation='normative'>
2130
- <title>
2131
- Terms, Definitions, Symbols and Abbreviated Terms.
2132
- <fn reference='1'>
2133
- <p id='_'>A</p>
2134
- </fn>
2135
- </title>
2136
- <clause id='_' inline-header='false' obligation='normative'>
2137
- <title>Introduction</title>
2138
- <clause id='_' inline-header='false' obligation='normative'>
2139
- <title>Intro 1</title>
2140
- </clause>
2141
- </clause>
2142
- <clause id='_' inline-header='false' obligation='normative'>
2143
- <title>Intro 2</title>
2144
- <clause id='_' inline-header='false' obligation='normative'>
2145
- <title>Intro 3</title>
2146
- </clause>
2147
- </clause>
2148
- <clause id='_' inline-header='false' obligation='normative'>
2149
- <title>Intro 4</title>
2150
- <clause id='_' inline-header='false' obligation='normative'>
2151
- <title>Intro 5</title>
2152
- <clause id='_' inline-header='false' obligation='normative'>
2153
- <title>Term1</title>
2154
- </clause>
2155
- </clause>
2156
- </clause>
2157
- <clause id='_' inline-header='false' obligation='normative'>
2158
- <title>Normal Terms</title>
2159
- <clause id='_' inline-header='false' obligation='normative'>
2160
- <title>Term2</title>
2161
- </clause>
2162
- </clause>
2163
- <definitions id='_' obligation='normative'>
2164
- <title>
2165
- Symbols and abbreviated terms
2166
- <fn reference='1'>
2167
- <p id='_'>A</p>
2168
- </fn>
2169
- </title>
2170
- <clause id='_' inline-header='false' obligation='normative'>
2171
- <title>General</title>
2172
- </clause>
2173
- <definitions id='_' type='symbols' obligation='normative'>
2174
- <title>
2175
- Symbols
2176
- <fn reference='1'>
2177
- <p id='_'>A</p>
2178
- </fn>
2179
- </title>
2180
- </definitions>
2181
- </definitions>
2182
- </clause>
2183
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
2184
- <title>
2185
- Abbreviated terms
2186
- <fn reference='1'>
2187
- <p id='_'>A</p>
2188
- </fn>
2189
- </title>
2190
- </definitions>
2191
- <clause id='_' inline-header='false' obligation='normative'>
2192
- <title>Clause 4</title>
2193
- <clause id='_' inline-header='false' obligation='normative'>
2194
- <title>Introduction</title>
2195
- </clause>
2196
- <clause id='_' inline-header='false' obligation='normative'>
2197
- <title>Clause 4.2</title>
2198
- </clause>
2199
- </clause>
2200
- <clause id='_' inline-header='false' obligation='normative'>
2201
- <title>Terms and Definitions</title>
2202
- </clause>
2203
- </sections>
2204
- <annex id='_' inline-header='false' obligation='normative'>
2205
- <title>
2206
- Annex.
2207
- <fn reference='1'>
2208
- <p id='_'>A</p>
2209
- </fn>
2210
- </title>
2211
- <clause id='_' inline-header='false' obligation='normative'>
2212
- <title>Annex A.1</title>
2213
- </clause>
2214
- </annex>
2215
- <bibliography>
2216
- <references id='_' normative='true' obligation='informative'>
2217
- <title>Normative references</title>
2218
- <p id='_'>There are no normative references in this document.</p>
2219
- </references>
2220
- <references id='_' normative='false' obligation='informative'>
2221
- <title>Bibliography</title>
2222
- </references>
2223
- <references id='_' normative='false' obligation='informative'>
2224
- <title>Bibliography</title>
2225
- </references>
2226
- <clause id='_' obligation='informative'>
2227
- <title>Bibliography</title>
2228
- <references id='_' normative='false' obligation='informative'>
2229
- <title>Bibliography Subsection</title>
2230
- </references>
2231
- </clause>
2232
- </bibliography>
2233
- </standard-document>
2234
- OUTPUT
2235
- end
2236
-
2237
- it "processes section names, default to English" do
2238
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2239
- #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: tlh\n:script: Latn\n:nodoc:")}
2240
- .Foreword
2241
-
2242
- Text
2243
-
2244
- [abstract]
2245
- == Abstract
2246
-
2247
- Text
2248
-
2249
- [heading=introduction]
2250
- == Introduction
2251
-
2252
- === Introduction Subsection
2253
-
2254
- [heading=acknowledgements]
2255
- == Acknowledgements
2256
-
2257
- [.preface]
2258
- == Dedication
2259
-
2260
- [heading=scope]
2261
- == Scope
2262
-
2263
- Text
2264
-
2265
- [bibliography,heading=normative references]
2266
- == Normative References
2267
-
2268
- [bibliography,normative=true]
2269
- == Normative References 2
2270
-
2271
- [heading=terms and definitions]
2272
- == Terms and Definitions
2273
-
2274
- === Term1
2275
-
2276
- [heading="terms and definitions"]
2277
- == Terms, Definitions, Symbols and Abbreviated Terms
2278
-
2279
- [.nonterm]
2280
- === Introduction
2281
-
2282
- ==== Intro 1
2283
-
2284
- === Intro 2
2285
-
2286
- [.nonterm]
2287
- ==== Intro 3
2288
-
2289
- === Intro 4
2290
-
2291
- ==== Intro 5
2292
-
2293
- ===== Term1
2294
-
2295
- === Normal Terms
2296
-
2297
- ==== Term2
2298
-
2299
- [heading=symbols and abbreviated terms]
2300
- === Symbols and Abbreviated Terms
2301
-
2302
- [.nonterm]
2303
- ==== General
2304
-
2305
- [heading=symbols]
2306
- ==== Symbols 1
2307
-
2308
- [heading=abbreviated terms]
2309
- == Abbreviated Terms
2310
-
2311
- == Clause 4
2312
-
2313
- === Introduction
2314
-
2315
- === Clause 4.2
2316
-
2317
- == Terms and Definitions
2318
-
2319
- [appendix]
2320
- == Annex
2321
-
2322
- === Annex A.1
2323
-
2324
- [bibliography,heading=bibliography]
2325
- == Bibliography
2326
-
2327
- [bibliography,normative=false]
2328
- == Bibliography 2
2329
-
2330
- === Bibliography Subsection
2331
-
2332
- INPUT
2333
- <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
2334
- <bibdata type='standard'>
2335
- <title language='en' format='text/plain'>Document title</title>
2336
- <language>tlh</language>
2337
- <script>Latn</script>
2338
- <abstract>
2339
- <p>Text</p>
2340
- </abstract>
2341
- <status>
2342
- <stage>published</stage>
2343
- </status>
2344
- <copyright>
2345
- <from>2020</from>
2346
- </copyright>
2347
- <ext>
2348
- <doctype>article</doctype>
2349
- </ext>
2350
- </bibdata>
2351
- <preface>
2352
- <abstract id='_'>
2353
- <title>Abstract</title>
2354
- <p id='_'>Text</p>
2355
- </abstract>
2356
- <foreword id='_' obligation='informative'>
2357
- <title>Foreword</title>
2358
- <p id='_'>Text</p>
2359
- </foreword>
2360
- <introduction id='_' obligation='informative'>
2361
- <title>Introduction</title>
2362
- <clause id='_' inline-header='false' obligation='informative'>
2363
- <title>Introduction Subsection</title>
2364
- </clause>
2365
- </introduction>
2366
- <clause id='_' inline-header='false' obligation='informative'>
2367
- <title>Dedication</title>
2368
- </clause>
2369
- <acknowledgements id='_' obligation='informative'>
2370
- <title>Acknowledgements</title>
2371
- </acknowledgements>
2372
- </preface>
2373
- <sections>
2374
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
2375
- <title>Scope</title>
2376
- <p id='_'>Text</p>
2377
- </clause>
2378
- <terms id='_' obligation='normative'>
2379
- <title>Terms and definitions</title>
2380
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
2381
- <term id='_'>
2382
- <preferred>Term1</preferred>
2383
- </term>
2384
- </terms>
2385
- <clause id='_' inline-header='false' obligation='normative'>
2386
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
2387
- <clause id='_' inline-header='false' obligation='normative'>
2388
- <title>Introduction</title>
2389
- <clause id='_' inline-header='false' obligation='normative'>
2390
- <title>Intro 1</title>
2391
- </clause>
2392
- </clause>
2393
- <clause id='_' inline-header='false' obligation='normative'>
2394
- <title>Intro 2</title>
2395
- <clause id='_' inline-header='false' obligation='normative'>
2396
- <title>Intro 3</title>
2397
- </clause>
2398
- </clause>
2399
- <clause id='_' inline-header='false' obligation='normative'>
2400
- <title>Intro 4</title>
2401
- <clause id='_' inline-header='false' obligation='normative'>
2402
- <title>Intro 5</title>
2403
- <clause id='_' inline-header='false' obligation='normative'>
2404
- <title>Term1</title>
2405
- </clause>
2406
- </clause>
2407
- </clause>
2408
- <clause id='_' inline-header='false' obligation='normative'>
2409
- <title>Normal Terms</title>
2410
- <clause id='_' inline-header='false' obligation='normative'>
2411
- <title>Term2</title>
2412
- </clause>
2413
- </clause>
2414
- <definitions id='_' obligation='normative'>
2415
- <title>Symbols and abbreviated terms</title>
2416
- <clause id='_' inline-header='false' obligation='normative'>
2417
- <title>General</title>
2418
- </clause>
2419
- <definitions id='_' type='symbols' obligation='normative'>
2420
- <title>Symbols</title>
2421
- </definitions>
2422
- </definitions>
2423
- </clause>
2424
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
2425
- <title>Abbreviated terms</title>
2426
- </definitions>
2427
- <clause id='_' inline-header='false' obligation='normative'>
2428
- <title>Clause 4</title>
2429
- <clause id='_' inline-header='false' obligation='normative'>
2430
- <title>Introduction</title>
2431
- </clause>
2432
- <clause id='_' inline-header='false' obligation='normative'>
2433
- <title>Clause 4.2</title>
2434
- </clause>
2435
- </clause>
2436
- <clause id='_' inline-header='false' obligation='normative'>
2437
- <title>Terms and Definitions</title>
2438
- </clause>
2439
- </sections>
2440
- <annex id='_' inline-header='false' obligation='normative'>
2441
- <title>Annex</title>
2442
- <clause id='_' inline-header='false' obligation='normative'>
2443
- <title>Annex A.1</title>
2444
- </clause>
2445
- </annex>
2446
- <bibliography>
2447
- <references id='_' normative='true' obligation='informative'>
2448
- <title>Normative references</title>
2449
- <p id='_'>There are no normative references in this document.</p>
2450
- </references>
2451
- <references id='_' normative='false' obligation='informative'>
2452
- <title>Bibliography</title>
2453
- </references>
2454
- <references id='_' normative='false' obligation='informative'>
2455
- <title>Bibliography</title>
2456
- </references>
2457
- <clause id='_' obligation='informative'>
2458
- <title>Bibliography</title>
2459
- <references id='_' normative='false' obligation='informative'>
2460
- <title>Bibliography Subsection</title>
2461
- </references>
2462
- </clause>
2463
- </bibliography>
2464
- </standard-document>
2465
- OUTPUT
2466
- end
2467
-
2468
- it "processes section names, French" do
2469
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2470
- #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: fr\n:script: Latn\n:nodoc:")}
2471
- .Foreword
2472
-
2473
- Text
2474
-
2475
- [abstract]
2476
- == Abstract
2477
-
2478
- Text
2479
-
2480
- [heading=introduction]
2481
- == Introduction
2482
-
2483
- === Introduction Subsection
2484
-
2485
- [heading=acknowledgements]
2486
- == Acknowledgements
2487
-
2488
- [.preface]
2489
- == Dedication
2490
-
2491
- [heading=scope]
2492
- == Scope
2493
-
2494
- Text
2495
-
2496
- [bibliography,heading=normative references]
2497
- == Normative References
2498
-
2499
- [bibliography,normative=true]
2500
- == Normative References 2
2501
-
2502
- [heading=terms and definitions]
2503
- == Terms and Definitions
2504
-
2505
- === Term1
2506
-
2507
- [heading="terms and definitions"]
2508
- == Terms, Definitions, Symbols and Abbreviated Terms
2509
-
2510
- [.nonterm]
2511
- === Introduction
2512
-
2513
- ==== Intro 1
2514
-
2515
- === Intro 2
2516
-
2517
- [.nonterm]
2518
- ==== Intro 3
2519
-
2520
- === Intro 4
2521
-
2522
- ==== Intro 5
2523
-
2524
- ===== Term1
2525
-
2526
- === Normal Terms
2527
-
2528
- ==== Term2
2529
-
2530
- [heading=symbols and abbreviated terms]
2531
- === Symbols and Abbreviated Terms
2532
-
2533
- [.nonterm]
2534
- ==== General
2535
-
2536
- [heading=symbols]
2537
- ==== Symbols 1
2538
-
2539
- [heading=abbreviated terms]
2540
- == Abbreviated Terms
2541
-
2542
- == Clause 4
2543
-
2544
- === Introduction
2545
-
2546
- === Clause 4.2
2547
-
2548
- == Terms and Definitions
2549
-
2550
- [appendix]
2551
- == Annex
2552
-
2553
- === Annex A.1
2554
-
2555
- [bibliography,heading=bibliography]
2556
- == Bibliography
2557
-
2558
- [bibliography,normative=false]
2559
- == Bibliography 2
2560
-
2561
- === Bibliography Subsection
2562
-
2563
- INPUT
2564
- <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
2565
- <bibdata type='standard'>
2566
- <title language='en' format='text/plain'>Document title</title>
2567
- <language>fr</language>
2568
- <script>Latn</script>
2569
- <abstract>
2570
- <p>Text</p>
2571
- </abstract>
2572
- <status>
2573
- <stage>published</stage>
2574
- </status>
2575
- <copyright>
2576
- <from>2020</from>
2577
- </copyright>
2578
- <ext>
2579
- <doctype>article</doctype>
2580
- </ext>
2581
- </bibdata>
2582
- <preface>
2583
- <abstract id='_'>
2584
- <title>Résumé</title>
2585
- <p id='_'>Text</p>
2586
- </abstract>
2587
- <foreword id='_' obligation='informative'>
2588
- <title>Avant-propos</title>
2589
- <p id='_'>Text</p>
2590
- </foreword>
2591
- <introduction id='_' obligation='informative'>
2592
- <title>Introduction</title>
2593
- <clause id='_' inline-header='false' obligation='informative'>
2594
- <title>Introduction Subsection</title>
2595
- </clause>
2596
- </introduction>
2597
- <clause id='_' inline-header='false' obligation='informative'>
2598
- <title>Dedication</title>
2599
- </clause>
2600
- <acknowledgements id='_' obligation='informative'>
2601
- <title>Remerciements</title>
2602
- </acknowledgements>
2603
- </preface>
2604
- <sections>
2605
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
2606
- <title>Domaine d’application</title>
2607
- <p id='_'>Text</p>
2608
- </clause>
2609
- <terms id='_' obligation='normative'>
2610
- <title>Terms et définitions</title>
2611
- <p id='_'>
2612
- Pour les besoins du présent document, les termes et définitions suivants
2613
- s’appliquent.
2614
- </p>
2615
- <term id='_'>
2616
- <preferred>Term1</preferred>
2617
- </term>
2618
- </terms>
2619
- <clause id='_' inline-header='false' obligation='normative'>
2620
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
2621
- <clause id='_' inline-header='false' obligation='normative'>
2622
- <title>Introduction</title>
2623
- <clause id='_' inline-header='false' obligation='normative'>
2624
- <title>Intro 1</title>
2625
- </clause>
2626
- </clause>
2627
- <clause id='_' inline-header='false' obligation='normative'>
2628
- <title>Intro 2</title>
2629
- <clause id='_' inline-header='false' obligation='normative'>
2630
- <title>Intro 3</title>
2631
- </clause>
2632
- </clause>
2633
- <clause id='_' inline-header='false' obligation='normative'>
2634
- <title>Intro 4</title>
2635
- <clause id='_' inline-header='false' obligation='normative'>
2636
- <title>Intro 5</title>
2637
- <clause id='_' inline-header='false' obligation='normative'>
2638
- <title>Term1</title>
2639
- </clause>
2640
- </clause>
2641
- </clause>
2642
- <clause id='_' inline-header='false' obligation='normative'>
2643
- <title>Normal Terms</title>
2644
- <clause id='_' inline-header='false' obligation='normative'>
2645
- <title>Term2</title>
2646
- </clause>
2647
- </clause>
2648
- <definitions id='_' obligation='normative'>
2649
- <title>Symboles et termes abrégés</title>
2650
- <clause id='_' inline-header='false' obligation='normative'>
2651
- <title>General</title>
2652
- </clause>
2653
- <definitions id='_' type='symbols' obligation='normative'>
2654
- <title>Symboles</title>
2655
- </definitions>
2656
- </definitions>
2657
- </clause>
2658
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
2659
- <title>Termes abrégés</title>
2660
- </definitions>
2661
- <clause id='_' inline-header='false' obligation='normative'>
2662
- <title>Clause 4</title>
2663
- <clause id='_' inline-header='false' obligation='normative'>
2664
- <title>Introduction</title>
2665
- </clause>
2666
- <clause id='_' inline-header='false' obligation='normative'>
2667
- <title>Clause 4.2</title>
2668
- </clause>
2669
- </clause>
2670
- <clause id='_' inline-header='false' obligation='normative'>
2671
- <title>Terms and Definitions</title>
2672
- </clause>
2673
- </sections>
2674
- <annex id='_' inline-header='false' obligation='normative'>
2675
- <title>Annex</title>
2676
- <clause id='_' inline-header='false' obligation='normative'>
2677
- <title>Annex A.1</title>
2678
- </clause>
2679
- </annex>
2680
- <bibliography>
2681
- <references id='_' normative='true' obligation='informative'>
2682
- <title>Références normatives</title>
2683
- <p id='_'>Le présent document ne contient aucune référence normative.</p>
2684
- </references>
2685
- <references id='_' normative='false' obligation='informative'>
2686
- <title>Bibliographie</title>
2687
- </references>
2688
- <references id='_' normative='false' obligation='informative'>
2689
- <title>Bibliography</title>
2690
- </references>
2691
- <clause id='_' obligation='informative'>
2692
- <title>Bibliography</title>
2693
- <references id='_' normative='false' obligation='informative'>
2694
- <title>Bibliography Subsection</title>
2695
- </references>
2696
- </clause>
2697
- </bibliography>
2698
- </standard-document>
2699
- OUTPUT
2700
- end
2701
-
2702
- it "processes section names, Simplified Chinese" do
2703
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2704
- #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: zh\n:script: Hans\n:nodoc:")}
2705
- .Foreword
2706
-
2707
- Text
2708
-
2709
- [abstract]
2710
- == Abstract
2711
-
2712
- Text
2713
-
2714
- [heading=introduction]
2715
- == Introduction
2716
-
2717
- === Introduction Subsection
2718
-
2719
- [heading=acknowledgements]
2720
- == Acknowledgements
2721
-
2722
- [.preface]
2723
- == Dedication
2724
-
2725
- [heading=scope]
2726
- == Scope
2727
-
2728
- Text
2729
-
2730
- [bibliography,heading=normative references]
2731
- == Normative References
2732
-
2733
- [bibliography,normative=true]
2734
- == Normative References 2
2735
-
2736
- [heading=terms and definitions]
2737
- == Terms and Definitions
2738
-
2739
- === Term1
2740
-
2741
- [heading="terms and definitions"]
2742
- == Terms, Definitions, Symbols and Abbreviated Terms
2743
-
2744
- [.nonterm]
2745
- === Introduction
2746
-
2747
- ==== Intro 1
2748
-
2749
- === Intro 2
2750
-
2751
- [.nonterm]
2752
- ==== Intro 3
2753
-
2754
- === Intro 4
2755
-
2756
- ==== Intro 5
2757
-
2758
- ===== Term1
2759
-
2760
- === Normal Terms
2761
-
2762
- ==== Term2
2763
-
2764
- [heading=symbols and abbreviated terms]
2765
- === Symbols and Abbreviated Terms
2766
-
2767
- [.nonterm]
2768
- ==== General
2769
-
2770
- [heading=symbols]
2771
- ==== Symbols 1
2772
-
2773
- [heading=abbreviated terms]
2774
- == Abbreviated Terms
2775
-
2776
- == Clause 4
2777
-
2778
- === Introduction
2779
-
2780
- === Clause 4.2
2781
-
2782
- == Terms and Definitions
2783
-
2784
- [appendix]
2785
- == Annex
2786
-
2787
- === Annex A.1
2788
-
2789
- [bibliography,heading=bibliography]
2790
- == Bibliography
2791
-
2792
- [bibliography,normative=false]
2793
- == Bibliography 2
2794
-
2795
- === Bibliography Subsection
2796
-
2797
- INPUT
2798
- <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
2799
- <bibdata type='standard'>
2800
- <title language='en' format='text/plain'>Document title</title>
2801
- <language>zh</language>
2802
- <script>Hans</script>
2803
- <abstract>
2804
- <p>Text</p>
2805
- </abstract>
2806
- <status>
2807
- <stage>published</stage>
2808
- </status>
2809
- <copyright>
2810
- <from>2020</from>
2811
- </copyright>
2812
- <ext>
2813
- <doctype>article</doctype>
2814
- </ext>
2815
- </bibdata>
2816
- <preface>
2817
- <abstract id='_'>
2818
- <title>摘要</title>
2819
- <p id='_'>Text</p>
2820
- </abstract>
2821
- <foreword id='_' obligation='informative'>
2822
- <title>前言</title>
2823
- <p id='_'>Text</p>
2824
- </foreword>
2825
- <introduction id='_' obligation='informative'>
2826
- <title>引言</title>
2827
- <clause id='_' inline-header='false' obligation='informative'>
2828
- <title>Introduction Subsection</title>
2829
- </clause>
2830
- </introduction>
2831
- <clause id='_' inline-header='false' obligation='informative'>
2832
- <title>Dedication</title>
2833
- </clause>
2834
- <acknowledgements id='_' obligation='informative'>
2835
- <title>致謝</title>
2836
- </acknowledgements>
2837
- </preface>
2838
- <sections>
2839
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
2840
- <title>范围</title>
2841
- <p id='_'>Text</p>
2842
- </clause>
2843
- <terms id='_' obligation='normative'>
2844
- <title>术语和定义</title>
2845
- <p id='_'>下列术语和定义适用于本文件。</p>
2846
- <term id='_'>
2847
- <preferred>Term1</preferred>
2848
- </term>
2849
- </terms>
2850
- <clause id='_' inline-header='false' obligation='normative'>
2851
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
2852
- <clause id='_' inline-header='false' obligation='normative'>
2853
- <title>Introduction</title>
2854
- <clause id='_' inline-header='false' obligation='normative'>
2855
- <title>Intro 1</title>
2856
- </clause>
2857
- </clause>
2858
- <clause id='_' inline-header='false' obligation='normative'>
2859
- <title>Intro 2</title>
2860
- <clause id='_' inline-header='false' obligation='normative'>
2861
- <title>Intro 3</title>
2862
- </clause>
2863
- </clause>
2864
- <clause id='_' inline-header='false' obligation='normative'>
2865
- <title>Intro 4</title>
2866
- <clause id='_' inline-header='false' obligation='normative'>
2867
- <title>Intro 5</title>
2868
- <clause id='_' inline-header='false' obligation='normative'>
2869
- <title>Term1</title>
2870
- </clause>
2871
- </clause>
2872
- </clause>
2873
- <clause id='_' inline-header='false' obligation='normative'>
2874
- <title>Normal Terms</title>
2875
- <clause id='_' inline-header='false' obligation='normative'>
2876
- <title>Term2</title>
2877
- </clause>
2878
- </clause>
2879
- <definitions id='_' obligation='normative'>
2880
- <title>符号、代号和缩略语</title>
2881
- <clause id='_' inline-header='false' obligation='normative'>
2882
- <title>General</title>
2883
- </clause>
2884
- <definitions id='_' type='symbols' obligation='normative'>
2885
- <title>符号</title>
2886
- </definitions>
2887
- </definitions>
2888
- </clause>
2889
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
2890
- <title>代号和缩略语</title>
2891
- </definitions>
2892
- <clause id='_' inline-header='false' obligation='normative'>
2893
- <title>Clause 4</title>
2894
- <clause id='_' inline-header='false' obligation='normative'>
2895
- <title>Introduction</title>
2896
- </clause>
2897
- <clause id='_' inline-header='false' obligation='normative'>
2898
- <title>Clause 4.2</title>
2899
- </clause>
2900
- </clause>
2901
- <clause id='_' inline-header='false' obligation='normative'>
2902
- <title>Terms and Definitions</title>
2903
- </clause>
2904
- </sections>
2905
- <annex id='_' inline-header='false' obligation='normative'>
2906
- <title>Annex</title>
2907
- <clause id='_' inline-header='false' obligation='normative'>
2908
- <title>Annex A.1</title>
2909
- </clause>
2910
- </annex>
2911
- <bibliography>
2912
- <references id='_' normative='true' obligation='informative'>
2913
- <title>规范性引用文件</title>
2914
- <p id='_'>本文件并没有规范性引用文件。</p>
2915
- </references>
2916
- <references id='_' normative='false' obligation='informative'>
2917
- <title>参考文献</title>
2918
- </references>
2919
- <references id='_' normative='false' obligation='informative'>
2920
- <title>Bibliography</title>
2921
- </references>
2922
- <clause id='_' obligation='informative'>
2923
- <title>Bibliography</title>
2924
- <references id='_' normative='false' obligation='informative'>
2925
- <title>Bibliography Subsection</title>
2926
- </references>
2927
- </clause>
2928
- </bibliography>
2929
- </standard-document>
2930
- OUTPUT
2931
- end
2932
-
2933
- it "processes section names, internationalisation file" do
2934
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2935
- #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":i18nyaml: spec/assets/i18n.yaml")}
2936
- .Foreword
2937
-
2938
- Text
2939
-
2940
- [abstract]
2941
- == Abstract
2942
-
2943
- Text
2944
-
2945
- [heading=introduction]
2946
- == Introduction
2947
-
2948
- === Introduction Subsection
2949
-
2950
- [heading=acknowledgements]
2951
- == Acknowledgements
2952
-
2953
- [.preface]
2954
- == Dedication
2955
-
2956
- [heading=scope]
2957
- == Scope
2958
-
2959
- Text
2960
-
2961
- [bibliography,heading=normative references]
2962
- == Normative References
2963
-
2964
- [bibliography,normative=true]
2965
- == Normative References 2
2966
-
2967
- [heading=terms and definitions]
2968
- == Terms and Definitions
2969
-
2970
- === Term1
2971
-
2972
- [heading="terms and definitions"]
2973
- == Terms, Definitions, Symbols and Abbreviated Terms
2974
-
2975
- [.nonterm]
2976
- === Introduction
2977
-
2978
- ==== Intro 1
2979
-
2980
- === Intro 2
2981
-
2982
- [.nonterm]
2983
- ==== Intro 3
2984
-
2985
- === Intro 4
2986
-
2987
- ==== Intro 5
2988
-
2989
- ===== Term1
2990
-
2991
- === Normal Terms
2992
-
2993
- ==== Term2
2994
-
2995
- [heading=symbols and abbreviated terms]
2996
- === Symbols and Abbreviated Terms
2997
-
2998
- [.nonterm]
2999
- ==== General
3000
-
3001
- [heading=symbols]
3002
- ==== Symbols 1
3003
-
3004
- [heading=abbreviated terms]
3005
- == Abbreviated Terms
3006
-
3007
- == Clause 4
3008
-
3009
- === Introduction
3010
-
3011
- === Clause 4.2
3012
-
3013
- == Terms and Definitions
3014
-
3015
- [appendix]
3016
- == Annex
3017
-
3018
- === Annex A.1
3019
-
3020
- [bibliography,heading=bibliography]
3021
- == Bibliography
3022
-
3023
- [bibliography,normative=false]
3024
- == Bibliography 2
3025
-
3026
- === Bibliography Subsection
3027
-
3028
- INPUT
3029
- <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
3030
- <bibdata type='standard'>
3031
- <title language='en' format='text/plain'>Document title</title>
3032
- <language>en</language>
3033
- <script>Latn</script>
3034
- <abstract>
3035
- <p>Text</p>
3036
- </abstract>
3037
- <status>
3038
- <stage>published</stage>
3039
- </status>
3040
- <copyright>
3041
- <from>2020</from>
3042
- </copyright>
3043
- <ext>
3044
- <doctype>article</doctype>
3045
- </ext>
3046
- </bibdata>
3047
- <preface>
3048
- <abstract id='_'>
3049
- <title>Abstract</title>
3050
- <p id='_'>Text</p>
3051
- </abstract>
3052
- <foreword id='_' obligation='informative'>
3053
- <title>Antaŭparolo</title>
3054
- <p id='_'>Text</p>
3055
- </foreword>
3056
- <introduction id='_' obligation='informative'>
3057
- <title>Enkonduko</title>
3058
- <clause id='_' inline-header='false' obligation='informative'>
3059
- <title>Introduction Subsection</title>
3060
- </clause>
3061
- </introduction>
3062
- <clause id='_' inline-header='false' obligation='informative'>
3063
- <title>Dedication</title>
3064
- </clause>
3065
- <acknowledgements id='_' obligation='informative'>
3066
- <title>Acknowledgements</title>
3067
- </acknowledgements>
3068
- </preface>
3069
- <sections>
3070
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
3071
- <title>Amplekso</title>
3072
- <p id='_'>Text</p>
3073
- </clause>
3074
- <terms id='_' obligation='normative'>
3075
- <title>Terms and definitions</title>
3076
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
3077
- <term id='_'>
3078
- <preferred>Term1</preferred>
3079
- </term>
3080
- </terms>
3081
- <clause id='_' inline-header='false' obligation='normative'>
3082
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
3083
- <clause id='_' inline-header='false' obligation='normative'>
3084
- <title>Introduction</title>
3085
- <clause id='_' inline-header='false' obligation='normative'>
3086
- <title>Intro 1</title>
3087
- </clause>
3088
- </clause>
3089
- <clause id='_' inline-header='false' obligation='normative'>
3090
- <title>Intro 2</title>
3091
- <clause id='_' inline-header='false' obligation='normative'>
3092
- <title>Intro 3</title>
3093
- </clause>
3094
- </clause>
3095
- <clause id='_' inline-header='false' obligation='normative'>
3096
- <title>Intro 4</title>
3097
- <clause id='_' inline-header='false' obligation='normative'>
3098
- <title>Intro 5</title>
3099
- <clause id='_' inline-header='false' obligation='normative'>
3100
- <title>Term1</title>
3101
- </clause>
3102
- </clause>
3103
- </clause>
3104
- <clause id='_' inline-header='false' obligation='normative'>
3105
- <title>Normal Terms</title>
3106
- <clause id='_' inline-header='false' obligation='normative'>
3107
- <title>Term2</title>
3108
- </clause>
3109
- </clause>
3110
- <definitions id='_' obligation='normative'>
3111
- <title>Symbols and abbreviated terms</title>
3112
- <clause id='_' inline-header='false' obligation='normative'>
3113
- <title>General</title>
3114
- </clause>
3115
- <definitions id='_' type='symbols' obligation='normative'>
3116
- <title>Simboloj kai mallongigitaj terminoj</title>
3117
- </definitions>
3118
- </definitions>
3119
- </clause>
3120
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
3121
- <title>Abbreviated terms</title>
3122
- </definitions>
3123
- <clause id='_' inline-header='false' obligation='normative'>
3124
- <title>Clause 4</title>
3125
- <clause id='_' inline-header='false' obligation='normative'>
3126
- <title>Introduction</title>
3127
- </clause>
3128
- <clause id='_' inline-header='false' obligation='normative'>
3129
- <title>Clause 4.2</title>
3130
- </clause>
3131
- </clause>
3132
- <clause id='_' inline-header='false' obligation='normative'>
3133
- <title>Terms and Definitions</title>
3134
- </clause>
3135
- </sections>
3136
- <annex id='_' inline-header='false' obligation='normative'>
3137
- <title>Annex</title>
3138
- <clause id='_' inline-header='false' obligation='normative'>
3139
- <title>Annex A.1</title>
3140
- </clause>
3141
- </annex>
3142
- <bibliography>
3143
- <references id='_' normative='true' obligation='informative'>
3144
- <title>Normaj citaĵoj</title>
3145
- <p id='_'>There are no normative references in this document.</p>
3146
- </references>
3147
- <references id='_' normative='false' obligation='informative'>
3148
- <title>Bibliografio</title>
3149
- </references>
3150
- <references id='_' normative='false' obligation='informative'>
3151
- <title>Bibliography</title>
3152
- </references>
3153
- <clause id='_' obligation='informative'>
3154
- <title>Bibliography</title>
3155
- <references id='_' normative='false' obligation='informative'>
3156
- <title>Bibliography Subsection</title>
3157
- </references>
3158
- </clause>
3159
- </bibliography>
3160
- </standard-document>
3161
- OUTPUT
3162
- end
3163
-
3164
- it "fixes illegal anchors" do
3165
- input = <<~INPUT
3166
- #{ASCIIDOC_BLANK_HDR}
3167
-
3168
- [[a:b]]
3169
- == A
3170
- <</:ab>>
3171
- <<:>>
3172
- <<1>>
3173
- <<1:>>
3174
- <<1#b>>
3175
- <<:a#b:>>
1828
+ [[a:b]]
1829
+ == A
1830
+ <</:ab>>
1831
+ <<:>>
1832
+ <<1>>
1833
+ <<1:>>
1834
+ <<1#b>>
1835
+ <<:a#b:>>
3176
1836
 
3177
1837
  INPUT
3178
1838
  expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true).gsub(/<p id="_[^"]+">/, "").gsub('</p>', ""))).to be_equivalent_to (<<~"OUTPUT")
3179
- <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
1839
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
3180
1840
  <bibdata type='standard'>
3181
1841
  <title language='en' format='text/plain'>Document title</title>
3182
1842
  <language>en</language>
@@ -3212,9 +1872,186 @@ expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to ou
3212
1872
  expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_a#b_"/> from :a#b:}).to_stderr
3213
1873
  end
3214
1874
 
1875
+ it "moves title footnotes to bibdata" do
1876
+ input = <<~INPUT
1877
+ = Document title footnote:[ABC] footnote:[DEF]
1878
+ Author
1879
+ :docfile: test.adoc
1880
+ :nodoc:
1881
+ :novalid:
1882
+ :no-isobib:
1883
+
1884
+ INPUT
1885
+ expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1886
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1887
+ <bibdata type='standard'>
1888
+ <title language='en' format='text/plain'>Document title</title>
1889
+ <note type='title-footnote'>
1890
+ <p>ABC</p>
1891
+ </note>
1892
+ <note type='title-footnote'>
1893
+ <p>DEF</p>
1894
+ </note>
1895
+ <language>en</language>
1896
+ <script>Latn</script>
1897
+ <status>
1898
+ <stage>published</stage>
1899
+ </status>
1900
+ <copyright>
1901
+ <from>2020</from>
1902
+ </copyright>
1903
+ <ext>
1904
+ <doctype>article</doctype>
1905
+ </ext>
1906
+ </bibdata>
1907
+ <sections> </sections>
1908
+ </standard-document>
1909
+ OUTPUT
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
+
2046
+ end
3215
2047
 
3216
2048
  private
3217
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
+
3218
2055
  def mock_iecbib_get_iec60050_103_01
3219
2056
  expect(Iecbib::IecBibliography).to receive(:get).with("IEC 60050-103", nil, {keep_year: true}) do
3220
2057
  IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")