metanorma-standoc 1.10.4.1 → 1.10.8

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/README.adoc +19 -23
  3. data/lib/asciidoctor/standoc/base.rb +11 -13
  4. data/lib/asciidoctor/standoc/basicdoc.rng +21 -4
  5. data/lib/asciidoctor/standoc/blocks.rb +27 -22
  6. data/lib/asciidoctor/standoc/blocks_notes.rb +17 -22
  7. data/lib/asciidoctor/standoc/cleanup.rb +38 -71
  8. data/lib/asciidoctor/standoc/cleanup_block.rb +5 -70
  9. data/lib/asciidoctor/standoc/cleanup_image.rb +6 -7
  10. data/lib/asciidoctor/standoc/cleanup_inline.rb +27 -98
  11. data/lib/asciidoctor/standoc/cleanup_maths.rb +113 -21
  12. data/lib/asciidoctor/standoc/cleanup_ref.rb +5 -0
  13. data/lib/asciidoctor/standoc/cleanup_reqt.rb +56 -18
  14. data/lib/asciidoctor/standoc/cleanup_section.rb +1 -0
  15. data/lib/asciidoctor/standoc/cleanup_section_names.rb +31 -14
  16. data/lib/asciidoctor/standoc/cleanup_table.rb +68 -0
  17. data/lib/asciidoctor/standoc/cleanup_terms.rb +1 -1
  18. data/lib/asciidoctor/standoc/cleanup_text.rb +73 -0
  19. data/lib/asciidoctor/standoc/cleanup_xref.rb +107 -0
  20. data/lib/asciidoctor/standoc/converter.rb +13 -0
  21. data/lib/asciidoctor/standoc/isodoc.rng +241 -61
  22. data/lib/asciidoctor/standoc/lists.rb +15 -15
  23. data/lib/asciidoctor/standoc/macros.rb +14 -43
  24. data/lib/asciidoctor/standoc/macros_note.rb +45 -0
  25. data/lib/asciidoctor/standoc/macros_terms.rb +33 -15
  26. data/lib/asciidoctor/standoc/reqt.rb +2 -2
  27. data/lib/asciidoctor/standoc/reqt.rng +23 -2
  28. data/lib/asciidoctor/standoc/table.rb +22 -20
  29. data/lib/asciidoctor/standoc/terms.rb +9 -1
  30. data/lib/asciidoctor/standoc/validate.rb +23 -14
  31. data/lib/asciidoctor/standoc/validate_section.rb +5 -2
  32. data/lib/metanorma/standoc/version.rb +1 -1
  33. data/metanorma-standoc.gemspec +1 -1
  34. data/spec/asciidoctor/base_spec.rb +0 -33
  35. data/spec/asciidoctor/blank_spec.rb +37 -0
  36. data/spec/asciidoctor/blocks_spec.rb +151 -30
  37. data/spec/asciidoctor/cleanup_blocks_spec.rb +1018 -0
  38. data/spec/asciidoctor/cleanup_sections_spec.rb +207 -0
  39. data/spec/asciidoctor/cleanup_spec.rb +193 -1078
  40. data/spec/asciidoctor/inline_spec.rb +36 -0
  41. data/spec/asciidoctor/isobib_cache_spec.rb +8 -8
  42. data/spec/asciidoctor/lists_spec.rb +6 -6
  43. data/spec/asciidoctor/macros_plantuml_spec.rb +1 -1
  44. data/spec/asciidoctor/macros_spec.rb +41 -26
  45. data/spec/asciidoctor/refs_dl_spec.rb +1 -1
  46. data/spec/asciidoctor/refs_spec.rb +220 -444
  47. data/spec/asciidoctor/section_spec.rb +1 -1
  48. data/spec/asciidoctor/validate_spec.rb +51 -0
  49. data/spec/assets/xref_error.adoc +1 -0
  50. data/spec/fixtures/datamodel_description_sections_tree.xml +24 -24
  51. data/spec/spec_helper.rb +5 -7
  52. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +231 -143
  53. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +152 -0
  54. data/spec/vcr_cassettes/isobib_get_123.yml +52 -36
  55. data/spec/vcr_cassettes/isobib_get_123_1.yml +103 -71
  56. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +112 -80
  57. data/spec/vcr_cassettes/isobib_get_123_2001.yml +50 -34
  58. data/spec/vcr_cassettes/isobib_get_124.yml +51 -35
  59. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +16 -16
  60. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +70 -46
  61. metadata +11 -4
@@ -3,177 +3,6 @@ require "relaton_iec"
3
3
  require "fileutils"
4
4
 
5
5
  RSpec.describe Asciidoctor::Standoc do
6
- it "processes svgmap" do
7
- FileUtils.cp "spec/fixtures/action_schemaexpg1.svg",
8
- "action_schemaexpg1.svg"
9
- FileUtils.cp "spec/fixtures/action_schemaexpg1.svg",
10
- "action_schemaexpg2.svg"
11
- input = <<~INPUT
12
- #{ASCIIDOC_BLANK_HDR}
13
-
14
- [svgmap%unnumbered,number=8,subsequence=A,keep-with-next=true,keep-lines-together=true]
15
- ====
16
- * <<ref1,Computer>>; http://www.example.com
17
- ====
18
-
19
- [[ref1]]
20
- .SVG title
21
- [.svgmap]
22
- ====
23
- image::action_schemaexpg1.svg[]
24
-
25
- * <<ref1,Computer>>; mn://action_schema
26
- * http://www.example.com[Phone]; http://www.example.com
27
- ====
28
-
29
- [[ref2]]
30
- [svgmap%unnumbered,number=8,subsequence=A,keep-with-next=true,keep-lines-together=true]
31
- ====
32
- [alt=Workmap]
33
- image::action_schemaexpg2.svg[]
34
-
35
- * <<ref1,Computer>>; mn://action_schema
36
- * http://www.example.com[Phone]; mn://basic_attribute_schema
37
- * <<express:action_schema:action_schema.basic,Coffee>>; mn://support_resource_schema
38
- ====
39
- INPUT
40
- output = <<~OUTPUT
41
- #{BLANK_HDR}
42
- <sections>
43
- <svgmap unnumbered='true' number='8' subsequence='A' keep-with-next='true' keep-lines-together='true'>
44
- <target href='http://www.example.com'>
45
- <xref target='ref1'>Computer</xref>
46
- </target>
47
- </svgmap>
48
- <figure id='ref1'>
49
- <name>SVG title</name>
50
- <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1_000000001' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
51
- <style/>
52
- <image/>
53
- <a xlink:href='#ref1'>
54
- <rect x='123.28' y='273.93' class='st0' width='88.05' height='41.84'/>
55
- </a>
56
- <a xlink:href='mn://basic_attribute_schema'>
57
- <rect x='324.69' y='450.52' class='st0' width='132.62' height='40.75'/>
58
- </a>
59
- <a xlink:href='mn://support_resource_schema'>
60
- <rect x='324.69' y='528.36' class='st0' width='148.16' height='40.75'/>
61
- </a>
62
- </svg>
63
- </figure>
64
- <svgmap>
65
- <figure id='ref2' unnumbered='true' number='8' subsequence='A' keep-with-next='true' keep-lines-together='true'>
66
- <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1_000000002' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
67
- <style/>
68
- <image/>
69
- <a xlink:href='#ref1'>
70
- <rect x='123.28' y='273.93' class='st0' width='88.05' height='41.84'/>
71
- </a>
72
- <a xlink:href='http://www.example.com'>
73
- <rect x='324.69' y='450.52' class='st0' width='132.62' height='40.75'/>
74
- </a>
75
- <a xlink:href='mn://support_resource_schema'>
76
- <rect x='324.69' y='528.36' class='st0' width='148.16' height='40.75'/>
77
- </a>
78
- </svg>
79
- </figure>
80
- <target href='mn://support_resource_schema'>
81
- <eref bibitemid='express_action_schema' citeas=''>
82
- <localityStack>
83
- <locality type='anchor'>
84
- <referenceFrom>action_schema.basic</referenceFrom>
85
- </locality>
86
- </localityStack>
87
- Coffee
88
- </eref>
89
- </target>
90
- </svgmap>
91
- </sections>
92
- <bibliography>
93
- <references hidden='true' normative='false'>
94
- <bibitem id='express_action_schema' type='internal'>
95
- <docidentifier type='repository'>express/action_schema</docidentifier>
96
- </bibitem>
97
- </references>
98
- </bibliography>
99
- </standard-document>
100
- OUTPUT
101
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))
102
- .gsub(%r{<image.*?</image>}m, "<image/>")
103
- .gsub(%r{<style.*?</style>}m, "<style/>"))
104
- .to be_equivalent_to xmlpp(output)
105
- end
106
-
107
- it "processes markup in sourcecode" do
108
- input = <<~INPUT
109
- #{ASCIIDOC_BLANK_HDR}
110
-
111
- [source]
112
- ----
113
- <tag/>
114
- ----
115
-
116
- [[A]]
117
- [source]
118
- ----
119
- var {{{*x*}}} : {{{<<A,recursive>>}}} <tag/>
120
- ----
121
-
122
-
123
- INPUT
124
- output = <<~OUTPUT
125
- #{BLANK_HDR}
126
- <sections>
127
- <sourcecode id='_'>&lt;tag/&gt;</sourcecode>
128
- <sourcecode id='A'>
129
- var
130
- <strong>x</strong>
131
- :
132
- <xref target='A'>recursive</xref>
133
- &lt;tag/&gt;
134
- </sourcecode>
135
- </sections>
136
- </standard-document>
137
- OUTPUT
138
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
139
- .to be_equivalent_to xmlpp(output)
140
- end
141
-
142
- it "processes markup in sourcecode with custom delimiters" do
143
- input = <<~INPUT
144
- = Document title
145
- Author
146
- :docfile: test.adoc
147
- :nodoc:
148
- :novalid:
149
- :no-isobib:
150
- :sourcecode-markup-start: [[[
151
- :sourcecode-markup-end: ]]]
152
-
153
- [[A]]
154
- [source]
155
- ----
156
- var [[[*x*]]] : [[[<<A,recursive>>]]]
157
- ----
158
-
159
-
160
- INPUT
161
- output = <<~OUTPUT
162
- #{BLANK_HDR}
163
- <sections>
164
- <sourcecode id='A'>
165
- var
166
- <strong>x</strong>
167
- :
168
- <xref target='A'>recursive</xref>
169
- </sourcecode>
170
- </sections>
171
- </standard-document>
172
- OUTPUT
173
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
174
- .to be_equivalent_to xmlpp(output)
175
- end
176
-
177
6
  it "applies smartquotes by default" do
178
7
  input = <<~INPUT
179
8
  #{ASCIIDOC_BLANK_HDR}
@@ -519,89 +348,6 @@ RSpec.describe Asciidoctor::Standoc do
519
348
  .to be_equivalent_to xmlpp(output)
520
349
  end
521
350
 
522
- it "moves notes inside preceding blocks, if they are not at clause end, and the blocks are not delimited" do
523
- input = <<~INPUT
524
- #{ASCIIDOC_BLANK_HDR}
525
-
526
- [stem]
527
- ++++
528
- r = 1 %
529
- r = 1 %
530
- ++++
531
-
532
- NOTE: That formula does not do much
533
-
534
- Indeed.
535
- INPUT
536
- output = <<~OUTPUT
537
- #{BLANK_HDR}
538
- <sections><formula id="_">
539
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo></math></stem>
540
- <note id="_">
541
- <p id="_">That formula does not do much</p>
542
- </note></formula>
543
- <p id="_">Indeed.</p></sections>
544
- </standard-document>
545
- OUTPUT
546
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
547
- .to be_equivalent_to xmlpp(output)
548
- end
549
-
550
- it "does not move notes inside preceding blocks, if they are marked as keep-separate" do
551
- input = <<~INPUT
552
- #{ASCIIDOC_BLANK_HDR}
553
-
554
- [stem]
555
- ++++
556
- r = 1 %
557
- r = 1 %
558
- ++++
559
-
560
- [NOTE,keep-separate=true]
561
- ====
562
- That formula does not do much
563
- ====
564
-
565
- Indeed.
566
- INPUT
567
- output = <<~OUTPUT
568
- #{BLANK_HDR}
569
- <sections><formula id="_">
570
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo></math></stem></formula>
571
- <note id="_">
572
- <p id="_">That formula does not do much</p>
573
- </note>
574
- <p id="_">Indeed.</p></sections>
575
- </standard-document>
576
- OUTPUT
577
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
578
- .to be_equivalent_to xmlpp(output)
579
- end
580
-
581
- it "does not move notes inside preceding blocks, if they are at clause end" do
582
- input = <<~INPUT
583
- #{ASCIIDOC_BLANK_HDR}
584
- [source,ruby]
585
- [1...x].each do |y|
586
- puts y
587
- end
588
-
589
- NOTE: That loop does not do much
590
- INPUT
591
- output = <<~OUTPUT
592
- #{BLANK_HDR}
593
- <sections><sourcecode id="_" lang="ruby">[1...x].each do |y|
594
- puts y
595
- end</sourcecode>
596
- <note id="_">
597
- <p id="_">That loop does not do much</p>
598
- </note></sections>
599
- </standard-document>
600
- OUTPUT
601
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
602
- .to be_equivalent_to xmlpp(output)
603
- end
604
-
605
351
  it "converts xrefs to references into erefs" do
606
352
  input = <<~INPUT
607
353
  #{ASCIIDOC_BLANK_HDR}
@@ -650,7 +396,7 @@ RSpec.describe Asciidoctor::Standoc do
650
396
  input = <<~INPUT
651
397
  #{ASCIIDOC_BLANK_HDR}
652
398
  <<iso216,whole,clause=3,example=9-11,locality:prelude="33 a",locality:entirety:the reference,xyz>>
653
- <<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>>
399
+ <<iso216,whole,clause=3,example=9-11,locality:prelude=33,locality:entirety="the reference";whole,clause=3,example=9-11,locality:prelude=33,locality:URL:the reference,xyz>>
654
400
  <<iso216,_whole_>>
655
401
  <<iso216,a _whole_ flagon>>
656
402
  <<iso216,whole,clause=3,a _whole_ flagon>>
@@ -699,7 +445,7 @@ RSpec.describe Asciidoctor::Standoc do
699
445
  <locality type='locality:prelude'>
700
446
  <referenceFrom>33</referenceFrom>
701
447
  </locality>
702
- <locality type='locality:entirety'/>
448
+ <locality type='locality:URL'/>
703
449
  </localityStack>
704
450
  the reference,xyz
705
451
  </eref>
@@ -776,515 +522,52 @@ RSpec.describe Asciidoctor::Standoc do
776
522
  </p>
777
523
  </foreword></preface><sections>
778
524
  </sections><bibliography><references id="_" obligation="informative" normative="false">
779
- <title>Bibliography</title>
780
- <bibitem id="iso216" type="standard">
781
- <title format="text/plain">Reference</title>
782
- <docidentifier>ISO 216</docidentifier>
783
- <docnumber>216</docnumber>
784
- <contributor>
785
- <role type="publisher"/>
786
- <organization>
787
- <name>ISO</name>
788
- </organization>
789
- </contributor>
790
- </bibitem>
791
- </references></bibliography>
792
- </standard-document>
793
- OUTPUT
794
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
795
- .to be_equivalent_to xmlpp(output)
796
- end
797
-
798
- it "processes localities in term sources" do
799
- input = <<~INPUT
800
- #{ASCIIDOC_BLANK_HDR}
801
- == Terms and Definitions
802
-
803
- === Term1
804
-
805
- [.source]
806
- <<ISO2191,section=1>>
807
- INPUT
808
- output = <<~OUTPUT
809
- #{BLANK_HDR}
810
- <sections>
811
- <terms id="_" obligation="normative">
812
- <title>Terms and definitions</title>
813
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
814
- <term id="term-term1">
815
- <preferred>Term1</preferred>
816
- <termsource status="identical">
817
- <origin bibitemid="ISO2191" type="inline" citeas="">
818
- <localityStack>
819
- <locality type="section"><referenceFrom>1</referenceFrom></locality>
820
- </localityStack>
821
- </origin>
822
- </termsource>
823
- </term>
824
- </terms>
825
- </sections>
826
- </standard-document>
827
- OUTPUT
828
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
829
- .to be_equivalent_to xmlpp(output)
830
- end
831
-
832
- it "inserts IDs into paragraphs" do
833
- input = <<~INPUT
834
- #{ASCIIDOC_BLANK_HDR}
835
- Paragraph
836
- INPUT
837
- output = <<~OUTPUT
838
- #{BLANK_HDR}
839
- <sections>
840
- <p id="_">Paragraph</p>
841
- </sections>
842
- </standard-document>
843
- OUTPUT
844
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
845
- .to be_equivalent_to xmlpp(output)
846
- end
847
-
848
- it "inserts IDs into notes" do
849
- input = <<~INPUT
850
- #{ASCIIDOC_BLANK_HDR}
851
- [example]
852
- ====
853
- NOTE: This note has no ID
854
- ====
855
- INPUT
856
- output = <<~OUTPUT
857
- #{BLANK_HDR}
858
- <sections>
859
- <example id="_">
860
- <note id="_">
861
- <p id="_">This note has no ID</p>
862
- </note>
863
- </example>
864
- </sections>
865
- </standard-document>
866
- OUTPUT
867
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
868
- .to be_equivalent_to xmlpp(output)
869
- end
870
-
871
- it "moves table key inside table" do
872
- input = <<~INPUT
873
- #{ASCIIDOC_BLANK_HDR}
874
- |===
875
- |a |b |c
876
- |===
877
-
878
- Key
879
-
880
- a:: b
881
-
882
- |===
883
- |a |b |c
884
- |===
885
-
886
- [%key]
887
- a:: b
888
-
889
- |===
890
- |a |b |c
891
- |===
892
-
893
- a:: b
894
- INPUT
895
- output = <<~OUTPUT
896
- #{BLANK_HDR}
897
- <sections>
898
- <table id='_'>
899
- <tbody>
900
- <tr>
901
- <td valign='top' align='left'>a</td>
902
- <td valign='top' align='left'>b</td>
903
- <td valign='top' align='left'>c</td>
904
- </tr>
905
- </tbody>
906
- <dl id='_' key='true'>
907
- <dt>a</dt>
908
- <dd>
909
- <p id='_'>b</p>
910
- </dd>
911
- </dl>
912
- </table>
913
- <table id='_'>
914
- <tbody>
915
- <tr>
916
- <td valign='top' align='left'>a</td>
917
- <td valign='top' align='left'>b</td>
918
- <td valign='top' align='left'>c</td>
919
- </tr>
920
- </tbody>
921
- <dl id='_' key='true'>
922
- <dt>a</dt>
923
- <dd>
924
- <p id='_'>b</p>
925
- </dd>
926
- </dl>
927
- </table>
928
- <table id='_'>
929
- <tbody>
930
- <tr>
931
- <td valign='top' align='left'>a</td>
932
- <td valign='top' align='left'>b</td>
933
- <td valign='top' align='left'>c</td>
934
- </tr>
935
- </tbody>
936
- </table>
937
- <dl id='_'>
938
- <dt>a</dt>
939
- <dd>
940
- <p id='_'>b</p>
941
- </dd>
942
- </dl>
943
- </sections>
944
- </standard-document>
945
- OUTPUT
946
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
947
- .to be_equivalent_to xmlpp(output)
948
- end
949
-
950
- it "processes headerrows attribute for table without header rows" do
951
- input = <<~INPUT
952
- #{ASCIIDOC_BLANK_HDR}
953
- [headerrows=3]
954
- |===
955
- |a |b |c
956
- |a |b |c
957
- |a |b |c
958
- |a |b |c
959
- |===
960
- INPUT
961
- output = <<~OUTPUT
962
- #{BLANK_HDR}
963
- <sections>
964
- <table id="_"><thead><tr>
965
- <th valign="top" align="left">a</th>
966
- <th valign="top" align="left">b</th>
967
- <th valign="top" align="left">c</th>
968
- </tr><tr>
969
- <th valign="top" align="left">a</th>
970
- <th valign="top" align="left">b</th>
971
- <th valign="top" align="left">c</th>
972
- </tr><tr>
973
- <th valign="top" align="left">a</th>
974
- <th valign="top" align="left">b</th>
975
- <th valign="top" align="left">c</th>
976
- </tr></thead>
977
- <tbody>
978
- <tr>
979
- <td valign="top" align="left">a</td>
980
- <td valign="top" align="left">b</td>
981
- <td valign="top" align="left">c</td>
982
- </tr>
983
- </tbody>
984
- </table>
985
- </sections>
986
- </standard-document>
987
- OUTPUT
988
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
989
- .to be_equivalent_to xmlpp(output)
990
- end
991
-
992
- it "processes headerrows attribute for table with header rows" do
993
- input = <<~INPUT
994
- #{ASCIIDOC_BLANK_HDR}
995
- [headerrows=3]
996
- |===
997
- |a |b |c
998
-
999
- |a |b |c
1000
- |a |b |c
1001
- |a |b |c
1002
- |===
1003
- INPUT
1004
- output = <<~OUTPUT
1005
- #{BLANK_HDR}
1006
- <sections>
1007
- <table id="_">
1008
- <thead>
1009
- <tr>
1010
- <th valign="top" align="left">a</th>
1011
- <th valign="top" align="left">b</th>
1012
- <th valign="top" align="left">c</th>
1013
- </tr>
1014
- <tr>
1015
- <th valign="top" align="left">a</th>
1016
- <th valign="top" align="left">b</th>
1017
- <th valign="top" align="left">c</th>
1018
- </tr><tr>
1019
- <th valign="top" align="left">a</th>
1020
- <th valign="top" align="left">b</th>
1021
- <th valign="top" align="left">c</th>
1022
- </tr></thead>
1023
- <tbody>
1024
-
1025
-
1026
- <tr>
1027
- <td valign="top" align="left">a</td>
1028
- <td valign="top" align="left">b</td>
1029
- <td valign="top" align="left">c</td>
1030
- </tr>
1031
- </tbody>
1032
- </table>
1033
- </sections>
1034
- </standard-document>
1035
- OUTPUT
1036
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1037
- .to be_equivalent_to xmlpp(output)
1038
- end
1039
-
1040
- it "moves table notes inside table" do
1041
- input = <<~INPUT
1042
- #{ASCIIDOC_BLANK_HDR}
1043
- |===
1044
- |a |b |c
1045
- |===
1046
-
1047
- NOTE: Note 1
1048
-
1049
- NOTE: Note 2
1050
- INPUT
1051
- output = <<~OUTPUT
1052
- #{BLANK_HDR}
1053
- <sections><table id="_">
1054
- <tbody>
1055
- <tr>
1056
- <td valign="top" align="left">a</td>
1057
- <td valign="top" align="left">b</td>
1058
- <td valign="top" align="left">c</td>
1059
- </tr>
1060
- </tbody>
1061
- <note id="_">
1062
- <p id="_">Note 1</p>
1063
- </note><note id="_">
1064
- <p id="_">Note 2</p>
1065
- </note></table>
1066
-
1067
- </sections>
1068
- </standard-document>
1069
- OUTPUT
1070
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1071
- .to be_equivalent_to xmlpp(output)
1072
- end
1073
-
1074
- it "moves formula key inside formula" do
1075
- input = <<~INPUT
1076
- #{ASCIIDOC_BLANK_HDR}
1077
- [stem]
1078
- ++++
1079
- Formula
1080
- ++++
1081
-
1082
- Where,
1083
-
1084
- a:: b
1085
-
1086
- [stem]
1087
- ++++
1088
- Formula
1089
- ++++
1090
-
1091
- [%key]
1092
- a:: b
1093
-
1094
- [stem]
1095
- ++++
1096
- Formula
1097
- ++++
1098
-
1099
- a:: b
1100
- INPUT
1101
- output = <<~OUTPUT
1102
- #{BLANK_HDR}
1103
- <sections>
1104
- <formula id='_'>
1105
- <stem type='MathML'>
1106
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1107
- <mi>F</mi>
1108
- <mi>or</mi>
1109
- <mi>μ</mi>
1110
- <mi>l</mi>
1111
- <mi>a</mi>
1112
- </math>
1113
- </stem>
1114
- <dl id='_' key='true'>
1115
- <dt>a</dt>
1116
- <dd>
1117
- <p id='_'>b</p>
1118
- </dd>
1119
- </dl>
1120
- </formula>
1121
- <formula id='_'>
1122
- <stem type='MathML'>
1123
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1124
- <mi>F</mi>
1125
- <mi>or</mi>
1126
- <mi>μ</mi>
1127
- <mi>l</mi>
1128
- <mi>a</mi>
1129
- </math>
1130
- </stem>
1131
- <dl id='_' key='true'>
1132
- <dt>a</dt>
1133
- <dd>
1134
- <p id='_'>b</p>
1135
- </dd>
1136
- </dl>
1137
- </formula>
1138
- <formula id='_'>
1139
- <stem type='MathML'>
1140
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
1141
- <mi>F</mi>
1142
- <mi>or</mi>
1143
- <mi>μ</mi>
1144
- <mi>l</mi>
1145
- <mi>a</mi>
1146
- </math>
1147
- </stem>
1148
- </formula>
1149
- <dl id='_'>
1150
- <dt>a</dt>
1151
- <dd>
1152
- <p id='_'>b</p>
1153
- </dd>
1154
- </dl>
1155
- </sections>
1156
- </standard-document>
1157
- OUTPUT
1158
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1159
- .to be_equivalent_to xmlpp(output)
1160
- end
1161
-
1162
- it "moves footnotes inside figures" do
1163
- input = <<~INPUT
1164
- #{ASCIIDOC_BLANK_HDR}
1165
- .Figuretitle.footnote:[xyz]
1166
- image::spec/examples/rice_images/rice_image1.png[]
1167
-
1168
- footnote:[This is a footnote to a figure]
1169
-
1170
- footnote:[This is another footnote to a figure]
1171
-
1172
- A footnote:[This is a third footnote]
1173
- INPUT
1174
- output = <<~OUTPUT
1175
- #{BLANK_HDR}
1176
- <sections><figure id="_">
1177
- <name>
1178
- Figuretitle.
1179
- <fn reference='1'>
1180
- <p id='_'>xyz</p>
1181
- </fn>
1182
- </name>
1183
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1184
- <fn reference="a">
1185
- <p id="_">This is a footnote to a figure</p>
1186
- </fn><fn reference="b">
1187
- <p id="_">This is another footnote to a figure</p>
1188
- </fn></figure>
1189
- <p id='_'>
1190
- A
1191
- <fn reference='2'>
1192
- <p id='_'>This is a third footnote</p>
1193
- </fn>
1194
- </p>
1195
- </sections>
1196
- </standard-document>
1197
- OUTPUT
1198
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1199
- .to be_equivalent_to xmlpp(output)
1200
- end
1201
-
1202
- it "moves figure key inside figure" do
1203
- input = <<~INPUT
1204
- #{ASCIIDOC_BLANK_HDR}
1205
- image::spec/examples/rice_images/rice_image1.png[]
1206
-
1207
- key:
1208
-
1209
- a:: b
1210
-
1211
- image::spec/examples/rice_images/rice_image1.png[]
1212
-
1213
- [%key]
1214
- a:: b
1215
-
1216
- image::spec/examples/rice_images/rice_image1.png[]
1217
-
1218
- a:: b
1219
- INPUT
1220
- output = <<~OUTPUT
1221
- #{BLANK_HDR}
1222
- <sections>
1223
- <figure id='_'>
1224
- <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
1225
- <dl id='_' key='true'>
1226
- <dt>a</dt>
1227
- <dd>
1228
- <p id='_'>b</p>
1229
- </dd>
1230
- </dl>
1231
- </figure>
1232
- <figure id='_'>
1233
- <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
1234
- <dl id='_' key='true'>
1235
- <dt>a</dt>
1236
- <dd>
1237
- <p id='_'>b</p>
1238
- </dd>
1239
- </dl>
1240
- </figure>
1241
- <figure id='_'>
1242
- <image src='spec/examples/rice_images/rice_image1.png' id='_' mimetype='image/png' height='auto' width='auto'/>
1243
- </figure>
1244
- <dl id='_'>
1245
- <dt>a</dt>
1246
- <dd>
1247
- <p id='_'>b</p>
1248
- </dd>
1249
- </dl>
1250
- </sections>
1251
- </standard-document>
525
+ <title>Bibliography</title>
526
+ <bibitem id="iso216" type="standard">
527
+ <title format="text/plain">Reference</title>
528
+ <docidentifier>ISO 216</docidentifier>
529
+ <docnumber>216</docnumber>
530
+ <contributor>
531
+ <role type="publisher"/>
532
+ <organization>
533
+ <name>ISO</name>
534
+ </organization>
535
+ </contributor>
536
+ </bibitem>
537
+ </references></bibliography>
538
+ </standard-document>
1252
539
  OUTPUT
1253
540
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1254
541
  .to be_equivalent_to xmlpp(output)
1255
542
  end
1256
543
 
1257
- it "processes subfigures" do
544
+ it "processes localities in term sources" do
1258
545
  input = <<~INPUT
1259
546
  #{ASCIIDOC_BLANK_HDR}
1260
- [[figureC-2]]
1261
- .Stages of gelatinization
1262
- ====
1263
- .Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)
1264
- image::spec/examples/rice_images/rice_image3_1.png[]
547
+ == Terms and Definitions
1265
548
 
1266
- .Intermediate stages: Some fully gelatinized kernels are visible
1267
- image::spec/examples/rice_images/rice_image3_2.png[]
549
+ === Term1
1268
550
 
1269
- .Final stages: All kernels are fully gelatinized
1270
- image::spec/examples/rice_images/rice_image3_3.png[]
1271
- ====
551
+ [.source]
552
+ <<ISO2191,section=1>>
1272
553
  INPUT
1273
554
  output = <<~OUTPUT
1274
- #{BLANK_HDR}
1275
- <sections>
1276
- <figure id="figureC-2"><name>Stages of gelatinization</name><figure id="_">
1277
- <name>Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)</name>
1278
- <image src="spec/examples/rice_images/rice_image3_1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1279
- </figure>
1280
- <figure id="_">
1281
- <name>Intermediate stages: Some fully gelatinized kernels are visible</name>
1282
- <image src="spec/examples/rice_images/rice_image3_2.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1283
- </figure>
1284
- <figure id="_">
1285
- <name>Final stages: All kernels are fully gelatinized</name>
1286
- <image src="spec/examples/rice_images/rice_image3_3.png" id="_" mimetype="image/png" height="auto" width="auto"/>
1287
- </figure></figure>
555
+ #{BLANK_HDR}
556
+ <sections>
557
+ <terms id="_" obligation="normative">
558
+ <title>Terms and definitions</title>
559
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
560
+ <term id="term-term1">
561
+ <preferred>Term1</preferred>
562
+ <termsource status="identical">
563
+ <origin bibitemid="ISO2191" type="inline" citeas="">
564
+ <localityStack>
565
+ <locality type="section"><referenceFrom>1</referenceFrom></locality>
566
+ </localityStack>
567
+ </origin>
568
+ </termsource>
569
+ </term>
570
+ </terms>
1288
571
  </sections>
1289
572
  </standard-document>
1290
573
  OUTPUT
@@ -1375,9 +658,6 @@ RSpec.describe Asciidoctor::Standoc do
1375
658
  <title>Terms and definitions</title>
1376
659
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
1377
660
  <term id="term-term"><preferred>Term</preferred>
1378
-
1379
-
1380
-
1381
661
  <termnote id="_">
1382
662
  <p id="_">Note</p>
1383
663
  </termnote><termnote id="_">
@@ -1410,8 +690,6 @@ RSpec.describe Asciidoctor::Standoc do
1410
690
  File.expand_path("~/.iev.pstore1"), force: true
1411
691
  FileUtils.rm_rf "relaton/cache"
1412
692
  FileUtils.rm_rf "test.iev.pstore"
1413
- # mock_iecbib_get_iec60050_102_01
1414
- # mock_iecbib_get_iec60050_103_01
1415
693
  # mock_iev
1416
694
  VCR.use_cassette "separates_iev_citations_by_top_level_clause" do
1417
695
  input = <<~INPUT
@@ -1679,6 +957,33 @@ RSpec.describe Asciidoctor::Standoc do
1679
957
  .to be_equivalent_to xmlpp(output)
1680
958
  end
1681
959
 
960
+ it "cleans up nested mathvariant instances" do
961
+ input = <<~INPUT
962
+ #{ASCIIDOC_BLANK_HDR}
963
+
964
+ stem:[sf "unitsml(cd)"]
965
+ INPUT
966
+ output = <<~OUTPUT
967
+ <sections>
968
+ <p id='_'>
969
+ <stem type='MathML'>
970
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
971
+ <mstyle mathvariant='sans-serif'>
972
+ <mrow xref='U_NISTu7'>
973
+ <mi mathvariant='sans-serif'>cd</mi>
974
+ </mrow>
975
+ </mstyle>
976
+ </math>
977
+ </stem>
978
+ </p>
979
+ </sections>
980
+ OUTPUT
981
+ expect(xmlpp(strip_guid(Nokogiri::XML(
982
+ Asciidoctor.convert(input, *OPTIONS),
983
+ ).at("//xmlns:sections").to_xml)))
984
+ .to be_equivalent_to xmlpp(output)
985
+ end
986
+
1682
987
  it "removes nested bibitem IDs" do
1683
988
  input = <<~INPUT
1684
989
  #{BLANK_HDR}
@@ -2011,7 +1316,7 @@ RSpec.describe Asciidoctor::Standoc do
2011
1316
  <dd>
2012
1317
  <p id='_'>Definition 2</p>
2013
1318
  </dd>
2014
- <dt id='symbol-&#945;'>α</dt>
1319
+ <dt id='symbol-__x3b1_'>α</dt>
2015
1320
  <dd>
2016
1321
  <p id='_'>Definition 1</p>
2017
1322
  </dd>
@@ -2081,7 +1386,7 @@ RSpec.describe Asciidoctor::Standoc do
2081
1386
  <dd>
2082
1387
  <p id='_'>Definition 2</p>
2083
1388
  </dd>
2084
- <dt id='symbol-_-&#945;-'>
1389
+ <dt id='symbol-_-__x3b1_-'>
2085
1390
  <stem type='MathML'>
2086
1391
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
2087
1392
  <mi>α</mi>
@@ -2100,226 +1405,6 @@ RSpec.describe Asciidoctor::Standoc do
2100
1405
  .to be_equivalent_to xmlpp(output)
2101
1406
  end
2102
1407
 
2103
- it "moves metadata deflist to correct location" do
2104
- input = <<~INPUT
2105
- #{ASCIIDOC_BLANK_HDR}
2106
-
2107
- == Clause
2108
-
2109
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
2110
- ====
2111
- [%metadata]
2112
- model:: ogc
2113
- type:: class
2114
- label:: http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules[*req/core*]
2115
- subject:: Encoding of logical models
2116
- inherit:: urn:iso:dis:iso:19156:clause:7.2.2
2117
- inherit:: urn:iso:dis:iso:19156:clause:8
2118
- inherit:: http://www.opengis.net/doc/IS/GML/3.2/clause/2.4
2119
- inherit:: O&M Abstract model, OGC 10-004r3, clause D.3.4
2120
- inherit:: http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used
2121
- inherit:: <<ref2>>
2122
- inherit:: <<ref3>>
2123
- classification:: priority:P0
2124
- classification:: domain:Hydrology,Groundwater
2125
- classification:: control-class:Technical
2126
- obligation:: recommendation,requirement
2127
-
2128
- I recommend this
2129
- ====
2130
- INPUT
2131
- output = <<~OUTPUT
2132
- #{BLANK_HDR}
2133
- <sections>
2134
- <clause id='_' inline-header='false' obligation='normative'>
2135
- <title>Clause</title>
2136
- <requirement id='_' subsequence='A'>
2137
- <label>
2138
- <link target='http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules'>
2139
- <strong>req/core</strong>
2140
- </link>
2141
- </label>
2142
- <subject>Encoding of logical models</subject>
2143
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
2144
- <inherit>urn:iso:dis:iso:19156:clause:7.2.2</inherit>
2145
- <inherit>urn:iso:dis:iso:19156:clause:8</inherit>
2146
- <inherit>
2147
- <link target='http://www.opengis.net/doc/IS/GML/3.2/clause/2.4'/>
2148
- </inherit>
2149
- <inherit>O&amp;M Abstract model, OGC 10-004r3, clause D.3.4</inherit>
2150
- <inherit>
2151
- <link target='http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used'/>
2152
- </inherit>
2153
- <inherit>
2154
- <xref target='ref2'/>
2155
- </inherit>
2156
- <inherit>
2157
- <xref target='ref3'/>
2158
- </inherit>
2159
- <classification>
2160
- <tag>control-class</tag>
2161
- <value>Technical</value>
2162
- </classification>
2163
- <classification>
2164
- <tag>domain</tag>
2165
- <value>Groundwater</value>
2166
- </classification>
2167
- <classification>
2168
- <tag>domain</tag>
2169
- <value>Hydrology</value>
2170
- </classification>
2171
- <classification>
2172
- <tag>priority</tag>
2173
- <value>P0</value>
2174
- </classification>
2175
- <description>
2176
- <p id='_'>I recommend this</p>
2177
- </description>
2178
- </requirement>
2179
- </clause>
2180
- </sections>
2181
- </standard-document>
2182
- OUTPUT
2183
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2184
- .to be_equivalent_to xmlpp(output)
2185
- end
2186
-
2187
- it "moves inherit macros to correct location" do
2188
- input = <<~INPUT
2189
- #{ASCIIDOC_BLANK_HDR}
2190
-
2191
- == Clause
2192
-
2193
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
2194
- .Title
2195
- ====
2196
- inherit:[A]
2197
- inherit:[B]
2198
- I recommend this
2199
- ====
2200
-
2201
- [.requirement,subsequence="A",classification="X:Y"]
2202
- .Title
2203
- ====
2204
- inherit:[A]
2205
- I recommend this
2206
- ====
2207
-
2208
- [.requirement,subsequence="A"]
2209
- .Title
2210
- ====
2211
- inherit:[A]
2212
- I recommend this
2213
- ====
2214
-
2215
- [.requirement,subsequence="A"]
2216
- .Title
2217
- ====
2218
- inherit:[A]
2219
- ====
2220
-
2221
-
2222
- INPUT
2223
- output = <<~OUTPUT
2224
- #{BLANK_HDR}
2225
- <sections>
2226
- <clause id='_' inline-header='false' obligation='normative'>
2227
- <title>Clause</title>
2228
- <requirement id='_' subsequence='A'>
2229
- <title>Title</title>
2230
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
2231
- <inherit>A</inherit>
2232
- <inherit>B</inherit>
2233
- <description>
2234
- <p id='_'> I recommend this</p>
2235
- </description>
2236
- </requirement>
2237
- <requirement id='_' subsequence='A'>
2238
- <title>Title</title>
2239
- <inherit>A</inherit>
2240
- <classification>
2241
- <tag>X</tag>
2242
- <value>Y</value>
2243
- </classification>
2244
- <description>
2245
- <p id='_'> I recommend this</p>
2246
- </description>
2247
- </requirement>
2248
- <requirement id='_' subsequence='A'>
2249
- <title>Title</title>
2250
- <inherit>A</inherit>
2251
- <description>
2252
- <p id='_'> I recommend this</p>
2253
- </description>
2254
- </requirement>
2255
- <requirement id='_' subsequence='A'>
2256
- <title>Title</title>
2257
- <inherit>A</inherit>
2258
- <description>
2259
- <p id='_'> </p>
2260
- </description>
2261
- </requirement>
2262
- </clause>
2263
- </sections>
2264
- </standard-document>
2265
- OUTPUT
2266
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2267
- .to be_equivalent_to xmlpp(output)
2268
- end
2269
-
2270
- it "moves %beforeclause admonitions to right position" do
2271
- input = <<~INPUT
2272
- #{ASCIIDOC_BLANK_HDR}
2273
-
2274
- .Foreword
2275
- Foreword
2276
-
2277
- [NOTE,beforeclauses=true]
2278
- ====
2279
- Note which is very important
2280
- ====
2281
-
2282
- == Introduction
2283
- Introduction
2284
-
2285
- == Scope
2286
- Scope statement
2287
-
2288
- [IMPORTANT,beforeclauses=true]
2289
- ====
2290
- Notice which is very important
2291
- ====
2292
- INPUT
2293
- output = <<~OUTPUT
2294
- #{BLANK_HDR}
2295
- <preface>
2296
- <note id='_'>
2297
- <p id='_'>Note which is very important</p>
2298
- </note>
2299
- <foreword id='_' obligation='informative'>
2300
- <title>Foreword</title>
2301
- <p id='_'>Foreword</p>
2302
- </foreword>
2303
- <introduction id='_' obligation='informative'>
2304
- <title>Introduction</title>
2305
- <p id='_'>Introduction</p>
2306
- </introduction>
2307
- </preface>
2308
- <sections>
2309
- <admonition id='_' type='important'>
2310
- <p id='_'>Notice which is very important</p>
2311
- </admonition>
2312
- <clause id='_' inline-header='false' obligation='normative' type="scope">
2313
- <title>Scope</title>
2314
- <p id='_'>Scope statement</p>
2315
- </clause>
2316
- </sections>
2317
- </standard-document>
2318
- OUTPUT
2319
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2320
- .to be_equivalent_to xmlpp(output)
2321
- end
2322
-
2323
1408
  it "fixes illegal anchors" do
2324
1409
  input = <<~INPUT
2325
1410
  #{ASCIIDOC_BLANK_HDR}
@@ -2334,6 +1419,17 @@ RSpec.describe Asciidoctor::Standoc do
2334
1419
  <<:a#b:>>
2335
1420
  <</%ab>>
2336
1421
  <<1!>>
1422
+ <<Löwe>>
1423
+
1424
+ [[Löwe]]
1425
+ .See <<Löwner2016>>
1426
+ ----
1427
+ ABC
1428
+ ----
1429
+
1430
+ [bibliography]
1431
+ == Bibliography
1432
+ * [[[Löwner2016,Löwner et al. 2016]]], Löwner, M.-O., Gröger, G., Benner, J., Biljecki, F., Nagel, C., 2016: *Proposal for a new LOD and multi-representation concept for CityGML*. In: Proceedings of the 11th 3D Geoinfo Conference 2016, ISPRS Annals of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Vol. IV-2/W1, 3–12. https://doi.org/10.5194/isprs-annals-IV-2-W1-3-2016
2337
1433
  INPUT
2338
1434
  output = <<~OUTPUT
2339
1435
  <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
@@ -2351,31 +1447,55 @@ RSpec.describe Asciidoctor::Standoc do
2351
1447
  <doctype>article</doctype>
2352
1448
  </ext>
2353
1449
  </bibdata>
2354
- <sections>
2355
- <clause id='a_b' inline-header='false' obligation='normative'>
2356
- <title>A</title>
2357
- <eref bibitemid='__ab' citeas=''/>
2358
- <xref target='_'/>
2359
- <xref target='_1'/>
2360
- <xref target='_1_'/>
2361
- <xref target='1#b'/>
2362
- <xref target='_a#b_'/>
2363
- <xref target='_%ab'/>
2364
- <xref target='_1_'/>
2365
- </clause>
2366
- </sections>
2367
- <bibliography>
2368
- <references hidden='true' normative='false'>
2369
- <bibitem id='__ab' type='internal'>
2370
- <docidentifier type='repository'>//ab</docidentifier>
2371
- </bibitem>
2372
- </references>
2373
- </bibliography>
2374
- </standard-document>
1450
+ <sections>
1451
+ <clause id='a_b' inline-header='false' obligation='normative'>
1452
+ <title>A</title>
1453
+ <eref bibitemid='__ab' citeas=''/>
1454
+ <xref target='_'/>
1455
+ <xref target='_1'/>
1456
+ <xref target='_1_'/>
1457
+ <xref target='1#b'/>
1458
+ <xref target='_a#b_'/>
1459
+ <xref target='__ab'/>
1460
+ <xref target='_1_'/>
1461
+ <xref target='L__xf6_we'/>
1462
+ <sourcecode id='L__xf6_we'>
1463
+ <name>
1464
+ See
1465
+ <eref type='inline' bibitemid='L__xf6_wner2016' citeas='L&#246;wner et al. 2016'/>
1466
+ </name>
1467
+ ABC
1468
+ </sourcecode>
1469
+ </clause>
1470
+ </sections>
1471
+ <bibliography>
1472
+ <references id='_bibliography' normative='false' obligation='informative'>
1473
+ <title>Bibliography</title>
1474
+ <bibitem id='L__xf6_wner2016'>
1475
+ <formattedref format='application/x-isodoc+xml'>
1476
+ L&#246;wner, M.-O., Gr&#246;ger, G., Benner, J., Biljecki, F., Nagel,
1477
+ C., 2016:
1478
+ <strong>Proposal for a new LOD and multi-representation concept for CityGML</strong>
1479
+ . In: Proceedings of the 11th 3D Geoinfo Conference 2016, ISPRS Annals
1480
+ of the Photogrammetry, Remote Sensing and Spatial Information
1481
+ Sciences, Vol. IV-2/W1, 3&#8211;12.
1482
+ <link target='https://doi.org/10.5194/isprs-annals-IV-2-W1-3-2016'/>
1483
+ </formattedref>
1484
+ <docidentifier>L&#246;wner et al. 2016</docidentifier>
1485
+ <docnumber>2016</docnumber>
1486
+ </bibitem>
1487
+ </references>
1488
+ <references hidden='true' normative='false'>
1489
+ <bibitem id='__ab' type='internal'>
1490
+ <docidentifier type='repository'>//ab</docidentifier>
1491
+ </bibitem>
1492
+ </references>
1493
+ </bibliography>
1494
+ </standard-document>
2375
1495
  OUTPUT
2376
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)
2377
- .gsub(/<p id="_[^"]+">/, "").gsub("</p>", "")))
2378
- .to be_equivalent_to(output)
1496
+ expect(strip_guid(xmlpp(Asciidoctor.convert(input, *OPTIONS)
1497
+ .gsub(/<p id="_[^"]+">/, "").gsub("</p>", ""))))
1498
+ .to be_equivalent_to(xmlpp(output))
2379
1499
  expect { Asciidoctor.convert(input, *OPTIONS) }
2380
1500
  .to output(%r{normalised identifier in <clause id="a_b" inline-header="false" obligation="normative"/> from a:b})
2381
1501
  .to_stderr
@@ -2843,89 +1963,84 @@ RSpec.describe Asciidoctor::Standoc do
2843
1963
  .to be_equivalent_to xmlpp(output)
2844
1964
  end
2845
1965
 
2846
- private
1966
+ it "creates content-based GUIDs" do
1967
+ input = <<~INPUT
1968
+ #{ASCIIDOC_BLANK_HDR}
2847
1969
 
2848
- def mock_mathml_italicise(string)
2849
- allow_any_instance_of(::Asciidoctor::Standoc::Cleanup)
2850
- .to receive(:mathml_mi_italics).and_return(string)
2851
- end
1970
+ .Foreword
1971
+ Foreword
2852
1972
 
2853
- def mock_iecbib_get_iec60050_103_01
2854
- expect(Iecbib::IecBibliography).to receive(:get)
2855
- .with("IEC 60050-103", nil, { keep_year: true }) do
2856
- IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
2857
- <bibitem type="standard" id="IEC60050-103">
2858
- <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
2859
- <docidentifier>IEC 60050-103:2009</docidentifier>
2860
- <date type="published">
2861
- <on>2009</on>
2862
- </date>
2863
- <contributor>
2864
- <role type="publisher"/>
2865
- <organization>
2866
- <name>International Electrotechnical Commission</name>
2867
- <abbreviation>IEC</abbreviation>
2868
- <uri>www.iec.ch</uri>
2869
- </organization>
2870
- </contributor>
1973
+ [NOTE,beforeclauses=true]
1974
+ ====
1975
+ Note which is very important <<a>>
1976
+ ====
1977
+
1978
+ == Introduction
1979
+ Introduction
1980
+
1981
+ == Scope
1982
+ Scope statement
1983
+
1984
+ [IMPORTANT,beforeclauses=true]
1985
+ ====
1986
+ Notice which is very important
1987
+ ====
1988
+ INPUT
1989
+ output = <<~OUTPUT
1990
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='1.10.7'>
1991
+ <bibdata type='standard'>
1992
+ <title language='en' format='text/plain'>Document title</title>
2871
1993
  <language>en</language>
2872
- <language>fr</language>
2873
1994
  <script>Latn</script>
2874
1995
  <status>
2875
- <stage>60</stage>
1996
+ <stage>published</stage>
2876
1997
  </status>
2877
1998
  <copyright>
2878
- <from>2018</from>
2879
- <owner>
2880
- <organization>
2881
- <name>International Electrotechnical Commission</name>
2882
- <abbreviation>IEC</abbreviation>
2883
- <uri>www.iec.ch</uri>
2884
- </organization>
2885
- </owner>
1999
+ <from>2021</from>
2886
2000
  </copyright>
2887
- </bibitem>
2888
- OUTPUT
2889
- end
2001
+ <ext>
2002
+ <doctype>article</doctype>
2003
+ </ext>
2004
+ </bibdata>
2005
+ <preface>
2006
+ <note id='_f91b621e-d8cb-30bf-eef6-7d0150204829'>
2007
+ <p id='_76d95913-a379-c60f-5144-1f09655cafa6'>
2008
+ Note which is very important
2009
+ <xref target='_76d95913-a379-c60f-5144-1f09655cafa6'/>
2010
+ </p>
2011
+ </note>
2012
+ <foreword id='_0826616f-13a4-0634-baee-5003c5534175' obligation='informative'>
2013
+ <title>Foreword</title>
2014
+ <p id='_d2f825bf-3e18-6143-8777-34e59928d48c'>Foreword</p>
2015
+ </foreword>
2016
+ <introduction id='_introduction' obligation='informative'>
2017
+ <title>Introduction</title>
2018
+ <p id='_272021ab-1bfa-78ae-e860-ed770e36f3d2'>Introduction</p>
2019
+ </introduction>
2020
+ </preface>
2021
+ <sections>
2022
+ <admonition id='_068def71-3ec8-0395-8853-0e2d3ef5b841' type='important'>
2023
+ <p id='_69ec375e-c992-5be3-76dd-a2311f9bb6cc'>Notice which is very important</p>
2024
+ </admonition>
2025
+ <clause id='_scope' type='scope' inline-header='false' obligation='normative'>
2026
+ <title>Scope</title>
2027
+ <p id='_fdcef9f1-c898-da99-eff6-f3e6abde7799'>Scope statement</p>
2028
+ </clause>
2029
+ </sections>
2030
+ </standard-document>
2031
+ OUTPUT
2032
+ input1 = xmlpp(Asciidoctor.convert(input, *OPTIONS))
2033
+ .sub(/<p id='([^']+)'>(\s+)Note which is very important(\s+)<xref target='a'/,
2034
+ "<p id='\\1'>\\2Note which is very important\\3<xref target='\\1'")
2035
+ expect(input1)
2036
+ .to be_equivalent_to xmlpp(output)
2890
2037
  end
2891
2038
 
2892
- def mock_iecbib_get_iec60050_102_01
2893
- expect(Iecbib::IecBibliography).to receive(:get)
2894
- .with("IEC 60050-102", nil, { keep_year: true }) do
2895
- IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
2896
- <bibitem type="standard" id="IEC60050-102">
2897
- <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
2898
- <docidentifier>IEC 60050-102:2007</docidentifier>
2899
- <date type="published">
2900
- <on>2007</on>
2901
- </date>
2902
- <contributor>
2903
- <role type="publisher"/>
2904
- <organization>
2905
- <name>International Electrotechnical Commission</name>
2906
- <abbreviation>IEC</abbreviation>
2907
- <uri>www.iec.ch</uri>
2908
- </organization>
2909
- </contributor>
2910
- <language>en</language>
2911
- <language>fr</language>
2912
- <script>Latn</script>
2913
- <status>
2914
- <stage>60</stage>
2915
- </status>
2916
- <copyright>
2917
- <from>2018</from>
2918
- <owner>
2919
- <organization>
2920
- <name>International Electrotechnical Commission</name>
2921
- <abbreviation>IEC</abbreviation>
2922
- <uri>www.iec.ch</uri>
2923
- </organization>
2924
- </owner>
2925
- </copyright>
2926
- </bibitem>
2927
- OUTPUT
2928
- end
2039
+ private
2040
+
2041
+ def mock_mathml_italicise(string)
2042
+ allow_any_instance_of(::Asciidoctor::Standoc::Cleanup)
2043
+ .to receive(:mathml_mi_italics).and_return(string)
2929
2044
  end
2930
2045
 
2931
2046
  def mock_iev