metanorma-standoc 1.6.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) 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 +8 -16
  5. data/lib/asciidoctor/standoc/basicdoc.rng +50 -3
  6. data/lib/asciidoctor/standoc/cleanup.rb +52 -4
  7. data/lib/asciidoctor/standoc/cleanup_block.rb +41 -4
  8. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +47 -20
  9. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +14 -0
  10. data/lib/asciidoctor/standoc/cleanup_inline.rb +9 -3
  11. data/lib/asciidoctor/standoc/cleanup_ref.rb +17 -24
  12. data/lib/asciidoctor/standoc/cleanup_terms.rb +4 -6
  13. data/lib/asciidoctor/standoc/converter.rb +71 -1
  14. data/lib/asciidoctor/standoc/front.rb +6 -0
  15. data/lib/asciidoctor/standoc/front_contributor.rb +8 -4
  16. data/lib/asciidoctor/standoc/inline.rb +6 -5
  17. data/lib/asciidoctor/standoc/isodoc.rng +36 -43
  18. data/lib/asciidoctor/standoc/lists.rb +4 -2
  19. data/lib/asciidoctor/standoc/macros.rb +55 -59
  20. data/lib/asciidoctor/standoc/macros_terms.rb +82 -0
  21. data/lib/asciidoctor/standoc/ref.rb +19 -25
  22. data/lib/asciidoctor/standoc/ref_sect.rb +4 -3
  23. data/lib/asciidoctor/standoc/section.rb +21 -20
  24. data/lib/asciidoctor/standoc/table.rb +12 -0
  25. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +86 -0
  26. data/lib/asciidoctor/standoc/utils.rb +2 -0
  27. data/lib/metanorma/standoc/version.rb +1 -1
  28. data/metanorma-standoc.gemspec +5 -3
  29. data/spec/asciidoctor-standoc/base_spec.rb +14 -4
  30. data/spec/asciidoctor-standoc/blocks_spec.rb +14 -9
  31. data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1519 -0
  32. data/spec/asciidoctor-standoc/cleanup_spec.rb +416 -1554
  33. data/spec/asciidoctor-standoc/converter_spec.rb +8 -0
  34. data/spec/asciidoctor-standoc/inline_spec.rb +2 -5
  35. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +16 -9
  36. data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
  37. data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
  38. data/spec/asciidoctor-standoc/macros_plantuml_spec.rb +307 -0
  39. data/spec/asciidoctor-standoc/macros_spec.rb +408 -169
  40. data/spec/asciidoctor-standoc/refs_dl_spec.rb +6 -6
  41. data/spec/asciidoctor-standoc/refs_spec.rb +112 -65
  42. data/spec/asciidoctor-standoc/section_spec.rb +17 -12
  43. data/spec/asciidoctor-standoc/table_spec.rb +86 -0
  44. data/spec/asciidoctor-standoc/validate_spec.rb +26 -0
  45. data/spec/fixtures/diagram_definitions.lutaml +22 -0
  46. data/spec/fixtures/test.exp +121 -0
  47. data/spec/spec_helper.rb +33 -0
  48. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +59 -243
  49. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  50. data/spec/vcr_cassettes/isobib_get_123_1.yml +27 -119
  51. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
  52. data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -60
  53. data/spec/vcr_cassettes/isobib_get_124.yml +11 -57
  54. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  55. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +281 -157
  56. metadata +45 -11
  57. data/.github/workflows/macos.yml +0 -41
  58. data/.github/workflows/ubuntu.yml +0 -45
  59. data/.github/workflows/windows.yml +0 -43
@@ -7,11 +7,14 @@ RSpec.describe Asciidoctor::Standoc do
7
7
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
8
8
  #{ASCIIDOC_BLANK_HDR}
9
9
  == "Quotation" A's
10
+
11
+ '24:00:00'.
10
12
  INPUT
11
13
  #{BLANK_HDR}
12
14
  <sections>
13
15
  <clause id="_" inline-header="false" obligation="normative">
14
16
  <title>“Quotation” A’s</title>
17
+ <p id='_'>‘24:00:00’.</p>
15
18
  </clause>
16
19
  </sections>
17
20
  </standard-document>
@@ -158,7 +161,7 @@ RSpec.describe Asciidoctor::Standoc do
158
161
  <terms id="_" obligation="normative">
159
162
  <title>Terms and definitions</title>
160
163
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
161
- <term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
164
+ <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
162
165
  <mrow>
163
166
  <mi>t</mi>
164
167
  </mrow>
@@ -200,11 +203,11 @@ RSpec.describe Asciidoctor::Standoc do
200
203
  <terms id="_" obligation="normative">
201
204
  <title>Terms and definitions</title>
202
205
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
203
- <term id="_">
206
+ <term id="term-tempus">
204
207
  <preferred>Tempus</preferred>
205
208
  <domain>relativity</domain><definition><p id="_"> Time</p></definition>
206
209
  </term>
207
- <term id='_'>
210
+ <term id='term-tempus1'>
208
211
  <preferred>Tempus1</preferred>
209
212
  <domain>relativity2</domain>
210
213
  <definition>
@@ -243,7 +246,7 @@ RSpec.describe Asciidoctor::Standoc do
243
246
  <terms id="_" obligation="normative">
244
247
  <title>Terms and definitions</title>
245
248
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
246
- <term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
249
+ <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
247
250
  <mrow>
248
251
  <mi>t</mi>
249
252
  </mrow>
@@ -268,33 +271,6 @@ RSpec.describe Asciidoctor::Standoc do
268
271
  OUTPUT
269
272
  end
270
273
 
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
274
  it "moves notes inside preceding blocks, if they are not at clause end, and the blocks are not delimited" do
299
275
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
300
276
  #{ASCIIDOC_BLANK_HDR}
@@ -415,6 +391,9 @@ RSpec.describe Asciidoctor::Standoc do
415
391
  #{ASCIIDOC_BLANK_HDR}
416
392
  <<iso216,whole,clause=3,example=9-11,locality:prelude="33 a",locality:entirety:the reference,xyz>>
417
393
  <<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>>
394
+ <<iso216,_whole_>>
395
+ <<iso216,a _whole_ flagon>>
396
+ <<iso216,whole,clause=3,a _whole_ flagon>>
418
397
 
419
398
  [bibliography]
420
399
  == Normative References
@@ -462,7 +441,25 @@ RSpec.describe Asciidoctor::Standoc do
462
441
  </localityStack>
463
442
  the reference,xyz
464
443
  </eref>
465
-
444
+ <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
445
+ <em>whole</em>
446
+ </eref>
447
+ <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
448
+ a
449
+ <em>whole</em>
450
+ flagon
451
+ </eref>
452
+ <eref type='inline' bibitemid='iso216' citeas='ISO 216'>
453
+ <localityStack>
454
+ <locality type='whole'/>
455
+ <locality type='clause'>
456
+ <referenceFrom>3</referenceFrom>
457
+ </locality>
458
+ </localityStack>
459
+ a
460
+ <em>whole</em>
461
+ flagon
462
+ </eref>
466
463
  </p>
467
464
  </foreword></preface><sections>
468
465
  </sections><bibliography><references id="_" obligation="informative" normative="true">
@@ -536,7 +533,7 @@ RSpec.describe Asciidoctor::Standoc do
536
533
  <terms id="_" obligation="normative">
537
534
  <title>Terms and definitions</title>
538
535
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
539
- <term id="_">
536
+ <term id="term-term1">
540
537
  <preferred>Term1</preferred>
541
538
  <termsource status="identical">
542
539
  <origin bibitemid="ISO2191" type="inline" citeas="">
@@ -552,114 +549,6 @@ RSpec.describe Asciidoctor::Standoc do
552
549
  OUTPUT
553
550
  end
554
551
 
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
552
  it "inserts IDs into paragraphs" do
664
553
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
665
554
  #{ASCIIDOC_BLANK_HDR}
@@ -703,24 +592,68 @@ end
703
592
  Key
704
593
 
705
594
  a:: b
595
+
596
+ |===
597
+ |a |b |c
598
+ |===
599
+
600
+ [%key]
601
+ a:: b
602
+
603
+ |===
604
+ |a |b |c
605
+ |===
606
+
607
+ a:: b
706
608
  INPUT
707
609
  #{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>
610
+ <sections>
611
+ <table id='_'>
612
+ <tbody>
613
+ <tr>
614
+ <td valign='top' align='left'>a</td>
615
+ <td valign='top' align='left'>b</td>
616
+ <td valign='top' align='left'>c</td>
617
+ </tr>
618
+ </tbody>
619
+ <dl id='_' key='true'>
620
+ <dt>a</dt>
621
+ <dd>
622
+ <p id='_'>b</p>
623
+ </dd>
624
+ </dl>
625
+ </table>
626
+ <table id='_'>
627
+ <tbody>
628
+ <tr>
629
+ <td valign='top' align='left'>a</td>
630
+ <td valign='top' align='left'>b</td>
631
+ <td valign='top' align='left'>c</td>
632
+ </tr>
633
+ </tbody>
634
+ <dl id='_' key='true'>
635
+ <dt>a</dt>
636
+ <dd>
637
+ <p id='_'>b</p>
638
+ </dd>
639
+ </dl>
640
+ </table>
641
+ <table id='_'>
642
+ <tbody>
643
+ <tr>
644
+ <td valign='top' align='left'>a</td>
645
+ <td valign='top' align='left'>b</td>
646
+ <td valign='top' align='left'>c</td>
647
+ </tr>
648
+ </tbody>
649
+ </table>
650
+ <dl id='_'>
651
+ <dt>a</dt>
652
+ <dd>
653
+ <p id='_'>b</p>
654
+ </dd>
655
+ </dl>
656
+ </sections>
724
657
  </standard-document>
725
658
  OUTPUT
726
659
  end
@@ -851,18 +784,76 @@ end
851
784
  Where,
852
785
 
853
786
  a:: b
787
+
788
+ [stem]
789
+ ++++
790
+ Formula
791
+ ++++
792
+
793
+ [%key]
794
+ a:: b
795
+
796
+ [stem]
797
+ ++++
798
+ Formula
799
+ ++++
800
+
801
+ a:: b
854
802
  INPUT
855
803
  #{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>
804
+ <sections>
805
+ <formula id='_'>
806
+ <stem type='MathML'>
807
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
808
+ <mi>F</mi>
809
+ <mi>or</mi>
810
+ <mi>μ</mi>
811
+ <mi>l</mi>
812
+ <mi>a</mi>
813
+ </math>
814
+ </stem>
815
+ <dl id='_' key='true'>
816
+ <dt>a</dt>
817
+ <dd>
818
+ <p id='_'>b</p>
819
+ </dd>
820
+ </dl>
821
+ </formula>
822
+ <formula id='_'>
823
+ <stem type='MathML'>
824
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
825
+ <mi>F</mi>
826
+ <mi>or</mi>
827
+ <mi>μ</mi>
828
+ <mi>l</mi>
829
+ <mi>a</mi>
830
+ </math>
831
+ </stem>
832
+ <dl id='_' key='true'>
833
+ <dt>a</dt>
834
+ <dd>
835
+ <p id='_'>b</p>
836
+ </dd>
837
+ </dl>
838
+ </formula>
839
+ <formula id='_'>
840
+ <stem type='MathML'>
841
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
842
+ <mi>F</mi>
843
+ <mi>or</mi>
844
+ <mi>μ</mi>
845
+ <mi>l</mi>
846
+ <mi>a</mi>
847
+ </math>
848
+ </stem>
849
+ </formula>
850
+ <dl id='_'>
851
+ <dt>a</dt>
852
+ <dd>
853
+ <p id='_'>b</p>
854
+ </dd>
855
+ </dl>
856
+ </sections>
866
857
  </standard-document>
867
858
  OUTPUT
868
859
  end
@@ -914,19 +905,46 @@ end
914
905
  key:
915
906
 
916
907
  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
908
 
928
- </sections>
909
+ image::spec/examples/rice_images/rice_image1.png[]
910
+
911
+ [%key]
912
+ a:: b
929
913
 
914
+ image::spec/examples/rice_images/rice_image1.png[]
915
+
916
+ a:: b
917
+ INPUT
918
+ #{BLANK_HDR}
919
+ <sections>
920
+ <figure id='_'>
921
+ <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
922
+ <dl id='_' key='true'>
923
+ <dt>a</dt>
924
+ <dd>
925
+ <p id='_'>b</p>
926
+ </dd>
927
+ </dl>
928
+ </figure>
929
+ <figure id='_'>
930
+ <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
931
+ <dl id='_' key='true'>
932
+ <dt>a</dt>
933
+ <dd>
934
+ <p id='_'>b</p>
935
+ </dd>
936
+ </dl>
937
+ </figure>
938
+ <figure id='_'>
939
+ <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
940
+ </figure>
941
+ <dl id='_'>
942
+ <dt>a</dt>
943
+ <dd>
944
+ <p id='_'>b</p>
945
+ </dd>
946
+ </dl>
947
+ </sections>
930
948
  </standard-document>
931
949
  OUTPUT
932
950
  end
@@ -1010,7 +1028,7 @@ end
1010
1028
  <name>ISO</name>
1011
1029
  </organization>
1012
1030
  </contributor>
1013
- <note format="text/plain" type="ISO DATE">The standard is in press</note>
1031
+ <note format="text/plain" type="Unpublished-Status">The standard is in press</note>
1014
1032
  </bibitem>
1015
1033
  </references>
1016
1034
  </bibliography>
@@ -1018,31 +1036,6 @@ end
1018
1036
  OUTPUT
1019
1037
  end
1020
1038
 
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
1039
  it "rearranges term note, term example, term source" do
1047
1040
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1048
1041
  #{ASCIIDOC_BLANK_HDR}
@@ -1069,7 +1062,7 @@ end
1069
1062
  <terms id="_" obligation="normative">
1070
1063
  <title>Terms and definitions</title>
1071
1064
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
1072
- <term id="_"><preferred>Term</preferred>
1065
+ <term id="term-term"><preferred>Term</preferred>
1073
1066
 
1074
1067
 
1075
1068
 
@@ -1094,69 +1087,6 @@ end
1094
1087
  OUTPUT
1095
1088
  end
1096
1089
 
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
1090
  it "separates IEV citations by top-level clause" do
1161
1091
  FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
1162
1092
  FileUtils.mv File.expand_path("~/.relaton/cache"), File.expand_path("~/.relaton-bib.pstore1"), force: true
@@ -1167,7 +1097,7 @@ end
1167
1097
  # mock_iecbib_get_iec60050_102_01
1168
1098
  # mock_iecbib_get_iec60050_103_01
1169
1099
  # mock_iev
1170
- VCR.use_cassette "separates_iev_citations_by_top_level_clause", :re_record_interval => 25200 do
1100
+ VCR.use_cassette "separates_iev_citations_by_top_level_clause" do
1171
1101
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1172
1102
  #{CACHED_ISOBIB_BLANK_HDR}
1173
1103
 
@@ -1196,7 +1126,7 @@ end
1196
1126
  <sections>
1197
1127
  <terms id="_" obligation="normative"><title>Terms and definitions</title>
1198
1128
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
1199
- <term id="_">
1129
+ <term id="term-automation1">
1200
1130
  <preferred>Automation1</preferred>
1201
1131
  <termsource status="identical">
1202
1132
  <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
@@ -1206,7 +1136,7 @@ end
1206
1136
  </origin>
1207
1137
  </termsource>
1208
1138
  </term>
1209
- <term id="_">
1139
+ <term id="term-automation2">
1210
1140
  <preferred>Automation2</preferred>
1211
1141
  <termsource status="identical">
1212
1142
  <origin bibitemid="IEC60050-102" type="inline" citeas="IEC 60050-102:2007">
@@ -1216,7 +1146,7 @@ end
1216
1146
  </origin>
1217
1147
  </termsource>
1218
1148
  </term>
1219
- <term id="_">
1149
+ <term id="term-automation3">
1220
1150
  <preferred>Automation3</preferred>
1221
1151
  <termsource status="identical">
1222
1152
  <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
@@ -1238,7 +1168,7 @@ end
1238
1168
  <docidentifier type="IEC">IEC 60050-102:2007</docidentifier>
1239
1169
  <docidentifier type='URN'>urn:iec:std:iec:60050-102:2007:::en</docidentifier>
1240
1170
  <date type="published">
1241
- <on>2007</on>
1171
+ <on>2007-08-27</on>
1242
1172
  </date>
1243
1173
  <contributor>
1244
1174
  <role type="publisher"/>
@@ -1277,7 +1207,7 @@ end
1277
1207
  <docidentifier type="IEC">IEC 60050-103:2009</docidentifier>
1278
1208
  <docidentifier type='URN'>urn:iec:std:iec:60050-103:2009:::en</docidentifier>
1279
1209
  <date type="published">
1280
- <on>2009</on>
1210
+ <on>2009-12-14</on>
1281
1211
  </date>
1282
1212
  <contributor>
1283
1213
  <role type="publisher"/>
@@ -1488,6 +1418,14 @@ OUTPUT
1488
1418
  * [[[iso125,ISO 125]]] _Standard 124_
1489
1419
  * [[[iso126,1]]] _Standard 123_
1490
1420
 
1421
+ [bibliography]
1422
+ == Bibliography Redux
1423
+
1424
+ [bibliography]
1425
+ === Clause 1
1426
+ * [[[iso127,ISO 124]]] _Standard 124_
1427
+ * [[[iso128,1]]] _Standard 123_
1428
+
1491
1429
  INPUT
1492
1430
  #{BLANK_HDR}
1493
1431
  <sections><clause id="_" inline-header="false" obligation="normative">
@@ -1535,77 +1473,34 @@ OUTPUT
1535
1473
  </formattedref>
1536
1474
  <docidentifier type="metanorma">[4]</docidentifier>
1537
1475
  </bibitem>
1476
+ </references>
1477
+ </clause>
1478
+ <clause id='_' obligation='informative'>
1479
+ <title>Bibliography Redux</title>
1480
+ <references id='_' normative='false' obligation='informative'>
1481
+ <title>Clause 1</title>
1482
+ <bibitem id='iso127' type='standard'>
1483
+ <title format='text/plain'>Standard 124</title>
1484
+ <docidentifier>ISO 124</docidentifier>
1485
+ <docnumber>124</docnumber>
1486
+ <contributor>
1487
+ <role type='publisher'/>
1488
+ <organization>
1489
+ <name>ISO</name>
1490
+ </organization>
1491
+ </contributor>
1492
+ </bibitem>
1493
+ <bibitem id='iso128'>
1494
+ <formattedref format='application/x-isodoc+xml'>
1495
+ <em>Standard 123</em>
1496
+ </formattedref>
1497
+ <docidentifier type='metanorma'>[6]</docidentifier>
1498
+ </bibitem>
1538
1499
  </references></clause></bibliography>
1539
1500
  </standard-document>
1540
1501
  OUTPUT
1541
1502
  end
1542
1503
 
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
1504
  it "removes bibdata bibitem IDs" do
1610
1505
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1611
1506
  = Document title
@@ -1960,1221 +1855,18 @@ OUTPUT
1960
1855
  end
1961
1856
 
1962
1857
 
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
1858
+ it "fixes illegal anchors" do
1859
+ input = <<~INPUT
1860
+ #{ASCIIDOC_BLANK_HDR}
2014
1861
 
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
2038
-
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:>>
1862
+ [[a:b]]
1863
+ == A
1864
+ <</:ab>>
1865
+ <<:>>
1866
+ <<1>>
1867
+ <<1:>>
1868
+ <<1#b>>
1869
+ <<:a#b:>>
3178
1870
 
3179
1871
  INPUT
3180
1872
  expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true).gsub(/<p id="_[^"]+">/, "").gsub('</p>', ""))).to be_equivalent_to (<<~"OUTPUT")
@@ -3250,10 +1942,180 @@ expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true))
3250
1942
  </standard-document>
3251
1943
  OUTPUT
3252
1944
 
1945
+ end
1946
+ it "customises italicisation of MathML" do
1947
+ input = <<~INPUT
1948
+ = Document title
1949
+ Author
1950
+ :stem:
1951
+
1952
+ [stem]
1953
+ ++++
1954
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1955
+ <mi>A</mi>
1956
+ <mo>+</mo>
1957
+ <mi>a</mi>
1958
+ <mo>+</mo>
1959
+ <mi>Α</mi>
1960
+ <mo>+</mo>
1961
+ <mi>α</mi>
1962
+ <mo>+</mo>
1963
+ <mi>AB</mi>
1964
+ <mstyle mathvariant="italic">
1965
+ <mrow>
1966
+ <mi>Α</mi>
1967
+ </mrow>
1968
+ </mstyle>
1969
+ </math>
1970
+ ++++
1971
+ INPUT
1972
+
1973
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1974
+ #{BLANK_HDR}
1975
+ <sections>
1976
+ <formula id='_'>
1977
+ <stem type='MathML'>
1978
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1979
+ <mi>A</mi>
1980
+ <mo>+</mo>
1981
+ <mi>a</mi>
1982
+ <mo>+</mo>
1983
+ <mi>Α</mi>
1984
+ <mo>+</mo>
1985
+ <mi>α</mi>
1986
+ <mo>+</mo>
1987
+ <mi>AB</mi>
1988
+ <mstyle mathvariant='italic'>
1989
+ <mrow>
1990
+ <mi>Α</mi>
1991
+ </mrow>
1992
+ </mstyle>
1993
+ </math>
1994
+ </stem>
1995
+ </formula>
1996
+ </sections>
1997
+ </standard-document>
1998
+ OUTPUT
1999
+ mock_mathml_italicise({ uppergreek: false, upperroman: true, lowergreek: true, 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 mathvariant="normal">Α</mi>
2011
+ <mo>+</mo>
2012
+ <mi>α</mi>
2013
+ <mo>+</mo>
2014
+ <mi>AB</mi>
2015
+ <mstyle mathvariant='italic'>
2016
+ <mrow>
2017
+ <mi>Α</mi>
2018
+ </mrow>
2019
+ </mstyle>
2020
+ </math>
2021
+ </stem>
2022
+ </formula>
2023
+ </sections>
2024
+ </standard-document>
2025
+ OUTPUT
2026
+ mock_mathml_italicise({ uppergreek: true, upperroman: false, lowergreek: true, lowerroman: true })
2027
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2028
+ #{BLANK_HDR}
2029
+ <sections>
2030
+ <formula id='_'>
2031
+ <stem type='MathML'>
2032
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2033
+ <mi mathvariant="normal">A</mi>
2034
+ <mo>+</mo>
2035
+ <mi>a</mi>
2036
+ <mo>+</mo>
2037
+ <mi>Α</mi>
2038
+ <mo>+</mo>
2039
+ <mi>α</mi>
2040
+ <mo>+</mo>
2041
+ <mi>AB</mi>
2042
+ <mstyle mathvariant='italic'>
2043
+ <mrow>
2044
+ <mi>Α</mi>
2045
+ </mrow>
2046
+ </mstyle>
2047
+ </math>
2048
+ </stem>
2049
+ </formula>
2050
+ </sections>
2051
+ </standard-document>
2052
+ OUTPUT
2053
+ mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: false, lowerroman: true })
2054
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2055
+ #{BLANK_HDR}
2056
+ <sections>
2057
+ <formula id='_'>
2058
+ <stem type='MathML'>
2059
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2060
+ <mi>A</mi>
2061
+ <mo>+</mo>
2062
+ <mi>a</mi>
2063
+ <mo>+</mo>
2064
+ <mi>Α</mi>
2065
+ <mo>+</mo>
2066
+ <mi mathvariant="normal">α</mi>
2067
+ <mo>+</mo>
2068
+ <mi>AB</mi>
2069
+ <mstyle mathvariant='italic'>
2070
+ <mrow>
2071
+ <mi>Α</mi>
2072
+ </mrow>
2073
+ </mstyle>
2074
+ </math>
2075
+ </stem>
2076
+ </formula>
2077
+ </sections>
2078
+ </standard-document>
2079
+ OUTPUT
2080
+ mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: true, lowerroman: false })
2081
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2082
+ #{BLANK_HDR}
2083
+ <sections>
2084
+ <formula id='_'>
2085
+ <stem type='MathML'>
2086
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
2087
+ <mi>A</mi>
2088
+ <mo>+</mo>
2089
+ <mi mathvariant="normal">a</mi>
2090
+ <mo>+</mo>
2091
+ <mi>Α</mi>
2092
+ <mo>+</mo>
2093
+ <mi>α</mi>
2094
+ <mo>+</mo>
2095
+ <mi>AB</mi>
2096
+ <mstyle mathvariant='italic'>
2097
+ <mrow>
2098
+ <mi>Α</mi>
2099
+ </mrow>
2100
+ </mstyle>
2101
+ </math>
2102
+ </stem>
2103
+ </formula>
2104
+ </sections>
2105
+ </standard-document>
2106
+ OUTPUT
2107
+ mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: true, lowerroman: true })
2108
+
2109
+
3253
2110
  end
3254
2111
 
3255
2112
  private
3256
2113
 
2114
+ def mock_mathml_italicise(x)
2115
+ allow_any_instance_of(::Asciidoctor::Standoc::Cleanup).to receive(:mathml_mi_italics).and_return(x)
2116
+ end
2117
+
2118
+
3257
2119
  def mock_iecbib_get_iec60050_103_01
3258
2120
  expect(Iecbib::IecBibliography).to receive(:get).with("IEC 60050-103", nil, {keep_year: true}) do
3259
2121
  IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")