metanorma-standoc 1.10.5 → 1.10.6

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.
@@ -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>
@@ -829,469 +575,6 @@ RSpec.describe Asciidoctor::Standoc do
829
575
  .to be_equivalent_to xmlpp(output)
830
576
  end
831
577
 
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>
1252
- OUTPUT
1253
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1254
- .to be_equivalent_to xmlpp(output)
1255
- end
1256
-
1257
- it "processes subfigures" do
1258
- input = <<~INPUT
1259
- #{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[]
1265
-
1266
- .Intermediate stages: Some fully gelatinized kernels are visible
1267
- image::spec/examples/rice_images/rice_image3_2.png[]
1268
-
1269
- .Final stages: All kernels are fully gelatinized
1270
- image::spec/examples/rice_images/rice_image3_3.png[]
1271
- ====
1272
- INPUT
1273
- 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>
1288
- </sections>
1289
- </standard-document>
1290
- OUTPUT
1291
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1292
- .to be_equivalent_to xmlpp(output)
1293
- end
1294
-
1295
578
  it "numbers bibliographic notes and footnotes sequentially" do
1296
579
  input = <<~INPUT
1297
580
  #{ASCIIDOC_BLANK_HDR}
@@ -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="_">
@@ -2038,7 +1318,7 @@ RSpec.describe Asciidoctor::Standoc do
2038
1318
  <dd>
2039
1319
  <p id='_'>Definition 2</p>
2040
1320
  </dd>
2041
- <dt id='symbol-&#945;'>α</dt>
1321
+ <dt id='symbol-__x3b1_'>α</dt>
2042
1322
  <dd>
2043
1323
  <p id='_'>Definition 1</p>
2044
1324
  </dd>
@@ -2108,7 +1388,7 @@ RSpec.describe Asciidoctor::Standoc do
2108
1388
  <dd>
2109
1389
  <p id='_'>Definition 2</p>
2110
1390
  </dd>
2111
- <dt id='symbol-_-&#945;-'>
1391
+ <dt id='symbol-_-__x3b1_-'>
2112
1392
  <stem type='MathML'>
2113
1393
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
2114
1394
  <mi>α</mi>
@@ -2127,226 +1407,6 @@ RSpec.describe Asciidoctor::Standoc do
2127
1407
  .to be_equivalent_to xmlpp(output)
2128
1408
  end
2129
1409
 
2130
- it "moves metadata deflist to correct location" do
2131
- input = <<~INPUT
2132
- #{ASCIIDOC_BLANK_HDR}
2133
-
2134
- == Clause
2135
-
2136
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
2137
- ====
2138
- [%metadata]
2139
- model:: ogc
2140
- type:: class
2141
- label:: http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules[*req/core*]
2142
- subject:: Encoding of logical models
2143
- inherit:: urn:iso:dis:iso:19156:clause:7.2.2
2144
- inherit:: urn:iso:dis:iso:19156:clause:8
2145
- inherit:: http://www.opengis.net/doc/IS/GML/3.2/clause/2.4
2146
- inherit:: O&M Abstract model, OGC 10-004r3, clause D.3.4
2147
- inherit:: http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used
2148
- inherit:: <<ref2>>
2149
- inherit:: <<ref3>>
2150
- classification:: priority:P0
2151
- classification:: domain:Hydrology,Groundwater
2152
- classification:: control-class:Technical
2153
- obligation:: recommendation,requirement
2154
-
2155
- I recommend this
2156
- ====
2157
- INPUT
2158
- output = <<~OUTPUT
2159
- #{BLANK_HDR}
2160
- <sections>
2161
- <clause id='_' inline-header='false' obligation='normative'>
2162
- <title>Clause</title>
2163
- <requirement id='_' subsequence='A'>
2164
- <label>
2165
- <link target='http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules'>
2166
- <strong>req/core</strong>
2167
- </link>
2168
- </label>
2169
- <subject>Encoding of logical models</subject>
2170
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
2171
- <inherit>urn:iso:dis:iso:19156:clause:7.2.2</inherit>
2172
- <inherit>urn:iso:dis:iso:19156:clause:8</inherit>
2173
- <inherit>
2174
- <link target='http://www.opengis.net/doc/IS/GML/3.2/clause/2.4'/>
2175
- </inherit>
2176
- <inherit>O&amp;M Abstract model, OGC 10-004r3, clause D.3.4</inherit>
2177
- <inherit>
2178
- <link target='http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used'/>
2179
- </inherit>
2180
- <inherit>
2181
- <xref target='ref2'/>
2182
- </inherit>
2183
- <inherit>
2184
- <xref target='ref3'/>
2185
- </inherit>
2186
- <classification>
2187
- <tag>control-class</tag>
2188
- <value>Technical</value>
2189
- </classification>
2190
- <classification>
2191
- <tag>domain</tag>
2192
- <value>Groundwater</value>
2193
- </classification>
2194
- <classification>
2195
- <tag>domain</tag>
2196
- <value>Hydrology</value>
2197
- </classification>
2198
- <classification>
2199
- <tag>priority</tag>
2200
- <value>P0</value>
2201
- </classification>
2202
- <description>
2203
- <p id='_'>I recommend this</p>
2204
- </description>
2205
- </requirement>
2206
- </clause>
2207
- </sections>
2208
- </standard-document>
2209
- OUTPUT
2210
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2211
- .to be_equivalent_to xmlpp(output)
2212
- end
2213
-
2214
- it "moves inherit macros to correct location" do
2215
- input = <<~INPUT
2216
- #{ASCIIDOC_BLANK_HDR}
2217
-
2218
- == Clause
2219
-
2220
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
2221
- .Title
2222
- ====
2223
- inherit:[A]
2224
- inherit:[B]
2225
- I recommend this
2226
- ====
2227
-
2228
- [.requirement,subsequence="A",classification="X:Y"]
2229
- .Title
2230
- ====
2231
- inherit:[A]
2232
- I recommend this
2233
- ====
2234
-
2235
- [.requirement,subsequence="A"]
2236
- .Title
2237
- ====
2238
- inherit:[A]
2239
- I recommend this
2240
- ====
2241
-
2242
- [.requirement,subsequence="A"]
2243
- .Title
2244
- ====
2245
- inherit:[A]
2246
- ====
2247
-
2248
-
2249
- INPUT
2250
- output = <<~OUTPUT
2251
- #{BLANK_HDR}
2252
- <sections>
2253
- <clause id='_' inline-header='false' obligation='normative'>
2254
- <title>Clause</title>
2255
- <requirement id='_' subsequence='A'>
2256
- <title>Title</title>
2257
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
2258
- <inherit>A</inherit>
2259
- <inherit>B</inherit>
2260
- <description>
2261
- <p id='_'> I recommend this</p>
2262
- </description>
2263
- </requirement>
2264
- <requirement id='_' subsequence='A'>
2265
- <title>Title</title>
2266
- <inherit>A</inherit>
2267
- <classification>
2268
- <tag>X</tag>
2269
- <value>Y</value>
2270
- </classification>
2271
- <description>
2272
- <p id='_'> I recommend this</p>
2273
- </description>
2274
- </requirement>
2275
- <requirement id='_' subsequence='A'>
2276
- <title>Title</title>
2277
- <inherit>A</inherit>
2278
- <description>
2279
- <p id='_'> I recommend this</p>
2280
- </description>
2281
- </requirement>
2282
- <requirement id='_' subsequence='A'>
2283
- <title>Title</title>
2284
- <inherit>A</inherit>
2285
- <description>
2286
- <p id='_'> </p>
2287
- </description>
2288
- </requirement>
2289
- </clause>
2290
- </sections>
2291
- </standard-document>
2292
- OUTPUT
2293
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2294
- .to be_equivalent_to xmlpp(output)
2295
- end
2296
-
2297
- it "moves %beforeclause admonitions to right position" do
2298
- input = <<~INPUT
2299
- #{ASCIIDOC_BLANK_HDR}
2300
-
2301
- .Foreword
2302
- Foreword
2303
-
2304
- [NOTE,beforeclauses=true]
2305
- ====
2306
- Note which is very important
2307
- ====
2308
-
2309
- == Introduction
2310
- Introduction
2311
-
2312
- == Scope
2313
- Scope statement
2314
-
2315
- [IMPORTANT,beforeclauses=true]
2316
- ====
2317
- Notice which is very important
2318
- ====
2319
- INPUT
2320
- output = <<~OUTPUT
2321
- #{BLANK_HDR}
2322
- <preface>
2323
- <note id='_'>
2324
- <p id='_'>Note which is very important</p>
2325
- </note>
2326
- <foreword id='_' obligation='informative'>
2327
- <title>Foreword</title>
2328
- <p id='_'>Foreword</p>
2329
- </foreword>
2330
- <introduction id='_' obligation='informative'>
2331
- <title>Introduction</title>
2332
- <p id='_'>Introduction</p>
2333
- </introduction>
2334
- </preface>
2335
- <sections>
2336
- <admonition id='_' type='important'>
2337
- <p id='_'>Notice which is very important</p>
2338
- </admonition>
2339
- <clause id='_' inline-header='false' obligation='normative' type="scope">
2340
- <title>Scope</title>
2341
- <p id='_'>Scope statement</p>
2342
- </clause>
2343
- </sections>
2344
- </standard-document>
2345
- OUTPUT
2346
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
2347
- .to be_equivalent_to xmlpp(output)
2348
- end
2349
-
2350
1410
  it "fixes illegal anchors" do
2351
1411
  input = <<~INPUT
2352
1412
  #{ASCIIDOC_BLANK_HDR}
@@ -2361,6 +1421,17 @@ RSpec.describe Asciidoctor::Standoc do
2361
1421
  <<:a#b:>>
2362
1422
  <</%ab>>
2363
1423
  <<1!>>
1424
+ <<Löwe>>
1425
+
1426
+ [[Löwe]]
1427
+ .See <<Löwner2016>>
1428
+ ----
1429
+ ABC
1430
+ ----
1431
+
1432
+ [bibliography]
1433
+ == Bibliography
1434
+ * [[[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
2364
1435
  INPUT
2365
1436
  output = <<~OUTPUT
2366
1437
  <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
@@ -2378,31 +1449,55 @@ RSpec.describe Asciidoctor::Standoc do
2378
1449
  <doctype>article</doctype>
2379
1450
  </ext>
2380
1451
  </bibdata>
2381
- <sections>
2382
- <clause id='a_b' inline-header='false' obligation='normative'>
2383
- <title>A</title>
2384
- <eref bibitemid='__ab' citeas=''/>
2385
- <xref target='_'/>
2386
- <xref target='_1'/>
2387
- <xref target='_1_'/>
2388
- <xref target='1#b'/>
2389
- <xref target='_a#b_'/>
2390
- <xref target='_%ab'/>
2391
- <xref target='_1_'/>
2392
- </clause>
2393
- </sections>
2394
- <bibliography>
2395
- <references hidden='true' normative='false'>
2396
- <bibitem id='__ab' type='internal'>
2397
- <docidentifier type='repository'>//ab</docidentifier>
2398
- </bibitem>
2399
- </references>
2400
- </bibliography>
2401
- </standard-document>
1452
+ <sections>
1453
+ <clause id='a_b' inline-header='false' obligation='normative'>
1454
+ <title>A</title>
1455
+ <eref bibitemid='__ab' citeas=''/>
1456
+ <xref target='_'/>
1457
+ <xref target='_1'/>
1458
+ <xref target='_1_'/>
1459
+ <xref target='1#b'/>
1460
+ <xref target='_a#b_'/>
1461
+ <xref target='__ab'/>
1462
+ <xref target='_1_'/>
1463
+ <xref target='L__xf6_we'/>
1464
+ <sourcecode id='L__xf6_we'>
1465
+ <name>
1466
+ See
1467
+ <eref type='inline' bibitemid='L__xf6_wner2016' citeas='L&#246;wner et al. 2016'/>
1468
+ </name>
1469
+ ABC
1470
+ </sourcecode>
1471
+ </clause>
1472
+ </sections>
1473
+ <bibliography>
1474
+ <references id='_bibliography' normative='false' obligation='informative'>
1475
+ <title>Bibliography</title>
1476
+ <bibitem id='L__xf6_wner2016'>
1477
+ <formattedref format='application/x-isodoc+xml'>
1478
+ L&#246;wner, M.-O., Gr&#246;ger, G., Benner, J., Biljecki, F., Nagel,
1479
+ C., 2016:
1480
+ <strong>Proposal for a new LOD and multi-representation concept for CityGML</strong>
1481
+ . In: Proceedings of the 11th 3D Geoinfo Conference 2016, ISPRS Annals
1482
+ of the Photogrammetry, Remote Sensing and Spatial Information
1483
+ Sciences, Vol. IV-2/W1, 3&#8211;12.
1484
+ <link target='https://doi.org/10.5194/isprs-annals-IV-2-W1-3-2016'/>
1485
+ </formattedref>
1486
+ <docidentifier>L&#246;wner et al. 2016</docidentifier>
1487
+ <docnumber>2016</docnumber>
1488
+ </bibitem>
1489
+ </references>
1490
+ <references hidden='true' normative='false'>
1491
+ <bibitem id='__ab' type='internal'>
1492
+ <docidentifier type='repository'>//ab</docidentifier>
1493
+ </bibitem>
1494
+ </references>
1495
+ </bibliography>
1496
+ </standard-document>
2402
1497
  OUTPUT
2403
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)
2404
- .gsub(/<p id="_[^"]+">/, "").gsub("</p>", "")))
2405
- .to be_equivalent_to(output)
1498
+ expect(strip_guid(xmlpp(Asciidoctor.convert(input, *OPTIONS)
1499
+ .gsub(/<p id="_[^"]+">/, "").gsub("</p>", ""))))
1500
+ .to be_equivalent_to(xmlpp(output))
2406
1501
  expect { Asciidoctor.convert(input, *OPTIONS) }
2407
1502
  .to output(%r{normalised identifier in <clause id="a_b" inline-header="false" obligation="normative"/> from a:b})
2408
1503
  .to_stderr