metanorma-standoc 1.10.7 → 1.10.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +19 -23
- data/lib/asciidoctor/standoc/base.rb +2 -0
- data/lib/asciidoctor/standoc/basicdoc.rng +21 -4
- data/lib/asciidoctor/standoc/blocks.rb +23 -23
- data/lib/asciidoctor/standoc/blocks_notes.rb +17 -22
- data/lib/asciidoctor/standoc/cleanup_image.rb +6 -7
- data/lib/asciidoctor/standoc/cleanup_inline.rb +25 -0
- data/lib/asciidoctor/standoc/cleanup_ref.rb +5 -0
- data/lib/asciidoctor/standoc/isodoc.rng +192 -50
- data/lib/asciidoctor/standoc/lists.rb +15 -15
- data/lib/asciidoctor/standoc/macros_terms.rb +6 -3
- data/lib/asciidoctor/standoc/reqt.rng +23 -2
- data/lib/asciidoctor/standoc/validate.rb +23 -14
- data/lib/asciidoctor/standoc/validate_section.rb +5 -2
- data/lib/metanorma/standoc/version.rb +1 -1
- data/spec/asciidoctor/blocks_spec.rb +28 -28
- data/spec/asciidoctor/cleanup_spec.rb +83 -90
- data/spec/asciidoctor/lists_spec.rb +6 -6
- data/spec/asciidoctor/macros_spec.rb +1 -1
- data/spec/asciidoctor/refs_spec.rb +2 -2
- data/spec/asciidoctor/validate_spec.rb +28 -0
- data/spec/spec_helper.rb +5 -7
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +41 -41
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +10 -10
- data/spec/vcr_cassettes/isobib_get_123.yml +11 -11
- data/spec/vcr_cassettes/isobib_get_123_1.yml +21 -21
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +29 -29
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -11
- data/spec/vcr_cassettes/isobib_get_124.yml +10 -10
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +64 -44
- metadata +2 -2
@@ -14,7 +14,8 @@ module Asciidoctor
|
|
14
14
|
callouts = x.elements.select { |e| e.name == "callout" }
|
15
15
|
annotations = x.elements.select { |e| e.name == "annotation" }
|
16
16
|
if callouts.size != annotations.size
|
17
|
-
|
17
|
+
@log.add("AsciiDoc Input", x,
|
18
|
+
"mismatch of callouts and annotations")
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -42,7 +43,9 @@ module Asciidoctor
|
|
42
43
|
root.xpath("//clause | //annex | //foreword | //introduction | "\
|
43
44
|
"//acknowledgements").each do |c|
|
44
45
|
next unless c.at("./clause")
|
45
|
-
next if c.elements.reject
|
46
|
+
next if c.elements.reject do |n|
|
47
|
+
%w(clause title).include? n.name
|
48
|
+
end.empty?
|
46
49
|
|
47
50
|
style_warning(c, "Hanging paragraph in clause")
|
48
51
|
end
|
@@ -72,7 +72,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
72
72
|
#{ASCIIDOC_BLANK_HDR}
|
73
73
|
|
74
74
|
[[ABC]]
|
75
|
-
[stem%inequality,number=3,keep-with-next=true,keep-lines-together=true]
|
75
|
+
[stem%inequality,number=3,keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
|
76
76
|
++++
|
77
77
|
r = 1 %
|
78
78
|
r = 1 %
|
@@ -97,7 +97,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
97
97
|
output = <<~OUTPUT
|
98
98
|
#{BLANK_HDR}
|
99
99
|
<sections>
|
100
|
-
<formula id='ABC' number='3' keep-with-next='true' keep-lines-together='true' inequality='true'>
|
100
|
+
<formula id='ABC' number='3' keep-with-next='true' keep-lines-together='true' inequality='true' tag='X' multilingual-rendering='common'>
|
101
101
|
<stem type='MathML'>
|
102
102
|
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
103
103
|
<mi>r</mi>
|
@@ -408,7 +408,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
408
408
|
|
409
409
|
NOTE: This is a note
|
410
410
|
|
411
|
-
[NOTE,keep-separate=true]
|
411
|
+
[NOTE,keep-separate=true,tag=X,multilingual-rendering=common]
|
412
412
|
====
|
413
413
|
XYZ
|
414
414
|
====
|
@@ -424,7 +424,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
424
424
|
<termnote id="_">
|
425
425
|
<p id="_">This is a note</p>
|
426
426
|
</termnote>
|
427
|
-
<termnote id='_'>
|
427
|
+
<termnote id='_' tag='X' multilingual-rendering='common'>
|
428
428
|
<p id='_'>XYZ</p>
|
429
429
|
</termnote>
|
430
430
|
</term>
|
@@ -520,7 +520,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
520
520
|
[[ABC]]
|
521
521
|
NOTE: This is a note
|
522
522
|
|
523
|
-
[NOTE,keep-separate=true,number=7,subsequence=A,beforeclauses=true,keep-with-next=true,keep-lines-together=true,type=classified]
|
523
|
+
[NOTE,keep-separate=true,number=7,subsequence=A,beforeclauses=true,keep-with-next=true,keep-lines-together=true,type=classified,tag=X,multilingual-rendering=common]
|
524
524
|
====
|
525
525
|
XYZ
|
526
526
|
====
|
@@ -533,7 +533,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
533
533
|
<p id="_">This is a note</p>
|
534
534
|
</note>
|
535
535
|
</foreword></preface><sections>
|
536
|
-
<note id='_' number="7" subsequence="A" keep-with-next="true" keep-lines-together="true" type="classified">
|
536
|
+
<note id='_' number="7" subsequence="A" keep-with-next="true" keep-lines-together="true" type="classified" tag='X' multilingual-rendering='common'>
|
537
537
|
<p id='_'>XYZ</p>
|
538
538
|
</note>
|
539
539
|
<clause id="_" inline-header="false" obligation="normative">
|
@@ -555,7 +555,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
555
555
|
#{ASCIIDOC_BLANK_HDR}
|
556
556
|
|
557
557
|
[[ABC]]
|
558
|
-
[alt=Literal,keep-with-next=true,keep-lines-together=true]
|
558
|
+
[alt=Literal,keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
|
559
559
|
....
|
560
560
|
<LITERAL>
|
561
561
|
FIGURATIVE
|
@@ -564,7 +564,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
564
564
|
output = <<~OUTPUT
|
565
565
|
#{BLANK_HDR}
|
566
566
|
<sections>
|
567
|
-
<figure id="ABC" keep-with-next="true" keep-lines-together="true">
|
567
|
+
<figure id="ABC" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
|
568
568
|
<pre alt="Literal" id="_"><LITERAL>
|
569
569
|
FIGURATIVE
|
570
570
|
</pre>
|
@@ -601,7 +601,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
601
601
|
#{ASCIIDOC_BLANK_HDR}
|
602
602
|
|
603
603
|
[[ABC]]
|
604
|
-
[CAUTION,type=Safety Precautions,keep-with-next="true",keep-lines-together="true"]
|
604
|
+
[CAUTION,type=Safety Precautions,keep-with-next="true",keep-lines-together="true",tag=X,multilingual-rendering=common]
|
605
605
|
.Precautions
|
606
606
|
====
|
607
607
|
While werewolves are hardy community members, keep in mind the following dietary concerns:
|
@@ -614,7 +614,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
614
614
|
output = <<~OUTPUT
|
615
615
|
#{BLANK_HDR}
|
616
616
|
<sections>
|
617
|
-
<admonition id="ABC" type="safety precautions" keep-with-next="true" keep-lines-together="true">
|
617
|
+
<admonition id="ABC" type="safety precautions" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
|
618
618
|
<name>Precautions</name><p id="_">While werewolves are hardy community members, keep in mind the following dietary concerns:</p>
|
619
619
|
<ol id="_" type="arabic">
|
620
620
|
<li>
|
@@ -643,7 +643,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
643
643
|
=== Term1
|
644
644
|
|
645
645
|
[[ABC]]
|
646
|
-
[example]
|
646
|
+
[example,tag=X,multilingual-rendering=common]
|
647
647
|
This is an example
|
648
648
|
INPUT
|
649
649
|
output = <<~OUTPUT
|
@@ -654,7 +654,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
654
654
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
655
655
|
<term id="term-term1">
|
656
656
|
<preferred>Term1</preferred>
|
657
|
-
<termexample id="ABC">
|
657
|
+
<termexample id="ABC" tag='X' multilingual-rendering='common'>
|
658
658
|
<p id="_">This is an example</p>
|
659
659
|
</termexample></term>
|
660
660
|
</terms>
|
@@ -733,7 +733,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
733
733
|
#{ASCIIDOC_BLANK_HDR}
|
734
734
|
|
735
735
|
[[ABC]]
|
736
|
-
[example,subsequence=A,keep-with-next=true,keep-lines-together=next]
|
736
|
+
[example,subsequence=A,keep-with-next=true,keep-lines-together=next,tag=X,multilingual-rendering=common]
|
737
737
|
.Title
|
738
738
|
====
|
739
739
|
This is an example
|
@@ -754,7 +754,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
754
754
|
output = <<~OUTPUT
|
755
755
|
#{BLANK_HDR}
|
756
756
|
<sections>
|
757
|
-
<example id="ABC" subsequence="A" keep-with-next='true' keep-lines-together='next'>
|
757
|
+
<example id="ABC" subsequence="A" keep-with-next='true' keep-lines-together='next' tag='X' multilingual-rendering='common'>
|
758
758
|
<name>Title</name>
|
759
759
|
<p id="_">This is an example</p>
|
760
760
|
<p id="_">Amen</p></example>
|
@@ -940,7 +940,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
940
940
|
it "accepts attributes on images" do
|
941
941
|
input = <<~INPUT
|
942
942
|
#{ASCIIDOC_BLANK_HDR}
|
943
|
-
[height=4,width=3,alt="IMAGE",filename="riceimg1.png",titleattr="TITLE"]
|
943
|
+
[height=4,width=3,alt="IMAGE",filename="riceimg1.png",titleattr="TITLE",tag=X,multilingual-rendering=common]
|
944
944
|
.Caption
|
945
945
|
image::spec/examples/rice_images/rice_image1.png[]
|
946
946
|
|
@@ -948,7 +948,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
948
948
|
output = <<~OUTPUT
|
949
949
|
#{BLANK_HDR}
|
950
950
|
<sections>
|
951
|
-
<figure id="_"><name>Caption</name>
|
951
|
+
<figure id="_" tag='X' multilingual-rendering='common'><name>Caption</name>
|
952
952
|
<image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="4" width="3" title="TITLE" alt="IMAGE" filename="riceimg1.png"/>
|
953
953
|
</figure>
|
954
954
|
</sections>
|
@@ -1015,13 +1015,13 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1015
1015
|
it "accepts attributes on paragraphs" do
|
1016
1016
|
input = <<~INPUT
|
1017
1017
|
#{ASCIIDOC_BLANK_HDR}
|
1018
|
-
[align=right,keep-with-next=true,keep-lines-together=true]
|
1018
|
+
[align=right,keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
|
1019
1019
|
This para is right-aligned.
|
1020
1020
|
INPUT
|
1021
1021
|
output = <<~OUTPUT
|
1022
1022
|
#{BLANK_HDR}
|
1023
1023
|
<sections>
|
1024
|
-
<p align="right" id="_" keep-with-next="true" keep-lines-together="true">This para is right-aligned.</p>
|
1024
|
+
<p align="right" id="_" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>This para is right-aligned.</p>
|
1025
1025
|
</sections>
|
1026
1026
|
</standard-document>
|
1027
1027
|
OUTPUT
|
@@ -1034,7 +1034,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1034
1034
|
#{ASCIIDOC_BLANK_HDR}
|
1035
1035
|
|
1036
1036
|
[[ABC]]
|
1037
|
-
[quote, ISO, "ISO7301,section 1",align="right",keep-with-next=true,keep-lines-together=true]
|
1037
|
+
[quote, ISO, "ISO7301,section 1",align="right",keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
|
1038
1038
|
____
|
1039
1039
|
Block quotation
|
1040
1040
|
____
|
@@ -1042,7 +1042,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1042
1042
|
output = <<~OUTPUT
|
1043
1043
|
#{BLANK_HDR}
|
1044
1044
|
<sections>
|
1045
|
-
<quote id="ABC" align="right" keep-with-next="true" keep-lines-together="true">
|
1045
|
+
<quote id="ABC" align="right" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
|
1046
1046
|
<source type="inline" bibitemid="ISO7301" citeas="">
|
1047
1047
|
<localityStack>
|
1048
1048
|
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
@@ -1064,7 +1064,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1064
1064
|
|
1065
1065
|
[[ABC]]
|
1066
1066
|
.Caption
|
1067
|
-
[source%unnumbered,ruby,number=3,filename=sourcecode1.rb,keep-with-next=true,keep-lines-together=true]
|
1067
|
+
[source%unnumbered,ruby,number=3,filename=sourcecode1.rb,keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
|
1068
1068
|
--
|
1069
1069
|
puts "Hello, world."
|
1070
1070
|
%w{a b c}.each do |x|
|
@@ -1075,7 +1075,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1075
1075
|
output = <<~OUTPUT
|
1076
1076
|
#{BLANK_HDR}
|
1077
1077
|
<sections>
|
1078
|
-
<sourcecode id="ABC" lang="ruby" filename="sourcecode1.rb" unnumbered="true" number="3" keep-with-next="true" keep-lines-together="true">
|
1078
|
+
<sourcecode id="ABC" lang="ruby" filename="sourcecode1.rb" unnumbered="true" number="3" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
|
1079
1079
|
<name>Caption</name>puts "Hello, world."
|
1080
1080
|
%w{a b c}.each do |x|
|
1081
1081
|
puts x
|
@@ -1257,7 +1257,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1257
1257
|
it "processes recommendation" do
|
1258
1258
|
input = <<~"INPUT"
|
1259
1259
|
#{ASCIIDOC_BLANK_HDR}
|
1260
|
-
[.recommendation,label="/ogc/recommendation/wfs/2",subject="user;developer, implementer",inherit="/ss/584/2015/level/1; /ss/584/2015/level/2",options="unnumbered",type=verification,model=ogc]
|
1260
|
+
[.recommendation,label="/ogc/recommendation/wfs/2",subject="user;developer, implementer",inherit="/ss/584/2015/level/1; /ss/584/2015/level/2",options="unnumbered",type=verification,model=ogc,tag=X,multilingual-rendering=common]
|
1261
1261
|
====
|
1262
1262
|
I recommend this
|
1263
1263
|
====
|
@@ -1265,7 +1265,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1265
1265
|
output = <<~"OUTPUT"
|
1266
1266
|
#{BLANK_HDR}
|
1267
1267
|
<sections>
|
1268
|
-
<recommendation id="_" unnumbered="true" type="verification" model="ogc">
|
1268
|
+
<recommendation id="_" unnumbered="true" type="verification" model="ogc" tag='X' multilingual-rendering='common'>
|
1269
1269
|
<label>/ogc/recommendation/wfs/2</label>
|
1270
1270
|
<subject>user</subject>
|
1271
1271
|
<subject>developer, implementer</subject>
|
@@ -1285,7 +1285,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1285
1285
|
input = <<~"INPUT"
|
1286
1286
|
#{ASCIIDOC_BLANK_HDR}
|
1287
1287
|
[[ABC]]
|
1288
|
-
[.requirement,subsequence="A",inherit="/ss/584/2015/level/1 & /ss/584/2015/level/2",number=3,keep-with-next=true,keep-lines-together=true]
|
1288
|
+
[.requirement,subsequence="A",inherit="/ss/584/2015/level/1 & /ss/584/2015/level/2",number=3,keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
|
1289
1289
|
.Title
|
1290
1290
|
====
|
1291
1291
|
I recommend this
|
@@ -1294,7 +1294,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1294
1294
|
output = <<~OUTPUT
|
1295
1295
|
#{BLANK_HDR}
|
1296
1296
|
<sections>
|
1297
|
-
<requirement id="ABC" subsequence="A" number="3" keep-with-next="true" keep-lines-together="true">
|
1297
|
+
<requirement id="ABC" subsequence="A" number="3" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
|
1298
1298
|
<title>Title</title>
|
1299
1299
|
<inherit>/ss/584/2015/level/1 & /ss/584/2015/level/2</inherit>
|
1300
1300
|
<description><p id="_">I recommend this</p></description>
|
@@ -1312,7 +1312,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1312
1312
|
#{ASCIIDOC_BLANK_HDR}
|
1313
1313
|
|
1314
1314
|
[[ABC]]
|
1315
|
-
[.permission]
|
1315
|
+
[.permission,tag=X,multilingual-rendering=common]
|
1316
1316
|
====
|
1317
1317
|
I recommend this
|
1318
1318
|
====
|
@@ -1320,7 +1320,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1320
1320
|
output = <<~"OUTPUT"
|
1321
1321
|
#{BLANK_HDR}
|
1322
1322
|
<sections>
|
1323
|
-
<permission id="ABC">
|
1323
|
+
<permission id="ABC" tag='X' multilingual-rendering='common'>
|
1324
1324
|
<description><p id="_">I recommend this</p></description>
|
1325
1325
|
</permission>
|
1326
1326
|
</sections>
|
@@ -690,8 +690,6 @@ RSpec.describe Asciidoctor::Standoc do
|
|
690
690
|
File.expand_path("~/.iev.pstore1"), force: true
|
691
691
|
FileUtils.rm_rf "relaton/cache"
|
692
692
|
FileUtils.rm_rf "test.iev.pstore"
|
693
|
-
# mock_iecbib_get_iec60050_102_01
|
694
|
-
# mock_iecbib_get_iec60050_103_01
|
695
693
|
# mock_iev
|
696
694
|
VCR.use_cassette "separates_iev_citations_by_top_level_clause" do
|
697
695
|
input = <<~INPUT
|
@@ -962,23 +960,23 @@ RSpec.describe Asciidoctor::Standoc do
|
|
962
960
|
it "cleans up nested mathvariant instances" do
|
963
961
|
input = <<~INPUT
|
964
962
|
#{ASCIIDOC_BLANK_HDR}
|
965
|
-
|
963
|
+
|
966
964
|
stem:[sf "unitsml(cd)"]
|
967
965
|
INPUT
|
968
966
|
output = <<~OUTPUT
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
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>
|
982
980
|
OUTPUT
|
983
981
|
expect(xmlpp(strip_guid(Nokogiri::XML(
|
984
982
|
Asciidoctor.convert(input, *OPTIONS),
|
@@ -1463,7 +1461,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1463
1461
|
<xref target='L__xf6_we'/>
|
1464
1462
|
<sourcecode id='L__xf6_we'>
|
1465
1463
|
<name>
|
1466
|
-
See
|
1464
|
+
See
|
1467
1465
|
<eref type='inline' bibitemid='L__xf6_wner2016' citeas='Löwner et al. 2016'/>
|
1468
1466
|
</name>
|
1469
1467
|
ABC
|
@@ -1965,89 +1963,84 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1965
1963
|
.to be_equivalent_to xmlpp(output)
|
1966
1964
|
end
|
1967
1965
|
|
1968
|
-
|
1966
|
+
it "creates content-based GUIDs" do
|
1967
|
+
input = <<~INPUT
|
1968
|
+
#{ASCIIDOC_BLANK_HDR}
|
1969
1969
|
|
1970
|
-
|
1971
|
-
|
1972
|
-
.to receive(:mathml_mi_italics).and_return(string)
|
1973
|
-
end
|
1970
|
+
.Foreword
|
1971
|
+
Foreword
|
1974
1972
|
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
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>
|
1993
1993
|
<language>en</language>
|
1994
|
-
<language>fr</language>
|
1995
1994
|
<script>Latn</script>
|
1996
1995
|
<status>
|
1997
|
-
<stage>
|
1996
|
+
<stage>published</stage>
|
1998
1997
|
</status>
|
1999
1998
|
<copyright>
|
2000
|
-
<from>
|
2001
|
-
<owner>
|
2002
|
-
<organization>
|
2003
|
-
<name>International Electrotechnical Commission</name>
|
2004
|
-
<abbreviation>IEC</abbreviation>
|
2005
|
-
<uri>www.iec.ch</uri>
|
2006
|
-
</organization>
|
2007
|
-
</owner>
|
1999
|
+
<from>2021</from>
|
2008
2000
|
</copyright>
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
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)
|
2012
2037
|
end
|
2013
2038
|
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
<title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
|
2020
|
-
<docidentifier>IEC 60050-102:2007</docidentifier>
|
2021
|
-
<date type="published">
|
2022
|
-
<on>2007</on>
|
2023
|
-
</date>
|
2024
|
-
<contributor>
|
2025
|
-
<role type="publisher"/>
|
2026
|
-
<organization>
|
2027
|
-
<name>International Electrotechnical Commission</name>
|
2028
|
-
<abbreviation>IEC</abbreviation>
|
2029
|
-
<uri>www.iec.ch</uri>
|
2030
|
-
</organization>
|
2031
|
-
</contributor>
|
2032
|
-
<language>en</language>
|
2033
|
-
<language>fr</language>
|
2034
|
-
<script>Latn</script>
|
2035
|
-
<status>
|
2036
|
-
<stage>60</stage>
|
2037
|
-
</status>
|
2038
|
-
<copyright>
|
2039
|
-
<from>2018</from>
|
2040
|
-
<owner>
|
2041
|
-
<organization>
|
2042
|
-
<name>International Electrotechnical Commission</name>
|
2043
|
-
<abbreviation>IEC</abbreviation>
|
2044
|
-
<uri>www.iec.ch</uri>
|
2045
|
-
</organization>
|
2046
|
-
</owner>
|
2047
|
-
</copyright>
|
2048
|
-
</bibitem>
|
2049
|
-
OUTPUT
|
2050
|
-
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)
|
2051
2044
|
end
|
2052
2045
|
|
2053
2046
|
def mock_iev
|
@@ -73,7 +73,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
73
73
|
output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
74
74
|
#{ASCIIDOC_BLANK_HDR}
|
75
75
|
[[id]]
|
76
|
-
[keep-with-next=true,keep-lines-together=true]
|
76
|
+
[keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
|
77
77
|
* First
|
78
78
|
* Second
|
79
79
|
+
|
@@ -84,7 +84,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
84
84
|
--
|
85
85
|
|
86
86
|
[[id1]]
|
87
|
-
[keep-with-next=true,keep-lines-together=true]
|
87
|
+
[keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
|
88
88
|
[loweralpha]
|
89
89
|
. First
|
90
90
|
. Second
|
@@ -103,7 +103,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
103
103
|
[arabic]
|
104
104
|
... E
|
105
105
|
... F
|
106
|
-
[keep-with-next=true,keep-lines-together=true]
|
106
|
+
[keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
|
107
107
|
Notes1::
|
108
108
|
Notes:: Note 1.
|
109
109
|
+
|
@@ -117,14 +117,14 @@ RSpec.describe Asciidoctor::Standoc do
|
|
117
117
|
INPUT
|
118
118
|
expect(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
119
119
|
#{BLANK_HDR}
|
120
|
-
<sections><ul id="id" keep-with-next="true" keep-lines-together="true">
|
120
|
+
<sections><ul id="id" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common' >
|
121
121
|
<li>
|
122
122
|
<p id="_">First</p>
|
123
123
|
</li>
|
124
124
|
<li><p id="_">Second</p><p id="_">entry1</p>
|
125
125
|
<p id="_">entry2</p></li>
|
126
126
|
</ul>
|
127
|
-
<ol id="id1" type="alphabet" keep-with-next="true" keep-lines-together="true">
|
127
|
+
<ol id="id1" type="alphabet" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common' >
|
128
128
|
<li>
|
129
129
|
<p id="_">First</p>
|
130
130
|
</li>
|
@@ -164,7 +164,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
164
164
|
</li>
|
165
165
|
<li>
|
166
166
|
<p id="_">F</p>
|
167
|
-
<dl id="_" keep-with-next="true" keep-lines-together="true">
|
167
|
+
<dl id="_" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
|
168
168
|
<dt>Notes1</dt>
|
169
169
|
<dd/>
|
170
170
|
<dt>Notes</dt>
|
@@ -1084,7 +1084,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1084
1084
|
output = <<~OUTPUT
|
1085
1085
|
#{BLANK_HDR}
|
1086
1086
|
<sections>
|
1087
|
-
<form id='
|
1087
|
+
<form id='N0' name='N1' action='/action_page.php' class="checkboxes">
|
1088
1088
|
<p id='_'>
|
1089
1089
|
<label for='fname'>First name:</label>
|
1090
1090
|
<br/>
|
@@ -1684,7 +1684,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1684
1684
|
def mock_isobib_get_123_no_docid(n)
|
1685
1685
|
expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", nil, { lang: "en", title: "<em>Standard</em>", usrlbl: nil }) do
|
1686
1686
|
RelatonBib::XMLParser.from_xml(<<~"OUTPUT")
|
1687
|
-
<bibitem type=\"standard\" id=\"ISO123\">\n <uri type=\"src\">https://www.iso.org/standard/23281.html</uri>\n <uri type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>\n <uri type=\"rss\">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>\n <date type=\"published\">\n <on>2001</on>\n </date>\n <contributor>\n <role type=\"publisher\"/>\n <organization>\n <name>International Organization for Standardization</name>\n <abbreviation>ISO</abbreviation>\n <uri>www.iso.org</uri>\n </organization>\n </contributor>\n <edition>3</edition>\n <language>en</language>\n <language>fr</language>\n <script>Latn</script>\n <status><stage>Published</stage></status>\n <copyright>\n <from>2001</from>\n <owner>\n <organization>\n <name>ISO</name>\n <abbreviation></abbreviation>\n </organization>\n </owner>\n </copyright>\n <relation type=\"obsoletes\">\n <bibitem type="standard">\n <formattedref format="text/plain">ISO 123:1985</formattedref>\n </bibitem>\n </relation>\n <relation type=\"updates\">\n <bibitem type="standard">\n <formattedref format="text/plain">ISO 123:2001</formattedref>\n </bibitem>\n </relation>\n
|
1687
|
+
<bibitem type=\"standard\" id=\"ISO123\">\n <uri type=\"src\">https://www.iso.org/standard/23281.html</uri>\n <uri type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>\n <uri type=\"rss\">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>\n <date type=\"published\">\n <on>2001</on>\n </date>\n <contributor>\n <role type=\"publisher\"/>\n <organization>\n <name>International Organization for Standardization</name>\n <abbreviation>ISO</abbreviation>\n <uri>www.iso.org</uri>\n </organization>\n </contributor>\n <edition>3</edition>\n <language>en</language>\n <language>fr</language>\n <script>Latn</script>\n <status><stage>Published</stage></status>\n <copyright>\n <from>2001</from>\n <owner>\n <organization>\n <name>ISO</name>\n <abbreviation></abbreviation>\n </organization>\n </owner>\n </copyright>\n <relation type=\"obsoletes\">\n <bibitem type="standard">\n <formattedref format="text/plain">ISO 123:1985</formattedref>\n </bibitem>\n </relation>\n <relation type=\"updates\">\n <bibitem type="standard">\n <formattedref format="text/plain">ISO 123:2001</formattedref>\n </bibitem>\n </relation>\n<ext></fred></ext></bibitem>
|
1688
1688
|
OUTPUT
|
1689
1689
|
end.exactly(n).times
|
1690
1690
|
end
|
@@ -1692,7 +1692,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1692
1692
|
def mock_isobib_get_123_no_docid_lbl(n)
|
1693
1693
|
expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", nil, { lang: "en", title: "<em>Standard</em>", usrlbl: "(1)" }) do
|
1694
1694
|
RelatonBib::XMLParser.from_xml(<<~"OUTPUT")
|
1695
|
-
<bibitem type=\"standard\" id=\"ISO123\">\n <uri type=\"src\">https://www.iso.org/standard/23281.html</uri>\n <uri type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>\n <uri type=\"rss\">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>\n <date type=\"published\">\n <on>2001</on>\n </date>\n <contributor>\n <role type=\"publisher\"/>\n <organization>\n <name>International Organization for Standardization</name>\n <abbreviation>ISO</abbreviation>\n <uri>www.iso.org</uri>\n </organization>\n </contributor>\n <edition>3</edition>\n <language>en</language>\n <language>fr</language>\n <script>Latn</script>\n <status><stage>Published</stage></status>\n <copyright>\n <from>2001</from>\n <owner>\n <organization>\n <name>ISO</name>\n <abbreviation></abbreviation>\n </organization>\n </owner>\n </copyright>\n <relation type=\"obsoletes\">\n <bibitem type="standard">\n <formattedref format="text/plain">ISO 123:1985</formattedref>\n </bibitem>\n </relation>\n <relation type=\"updates\">\n <bibitem type="standard">\n <formattedref format="text/plain">ISO 123:2001</formattedref>\n </bibitem>\n </relation>\n
|
1695
|
+
<bibitem type=\"standard\" id=\"ISO123\">\n <uri type=\"src\">https://www.iso.org/standard/23281.html</uri>\n <uri type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>\n <uri type=\"rss\">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>\n <date type=\"published\">\n <on>2001</on>\n </date>\n <contributor>\n <role type=\"publisher\"/>\n <organization>\n <name>International Organization for Standardization</name>\n <abbreviation>ISO</abbreviation>\n <uri>www.iso.org</uri>\n </organization>\n </contributor>\n <edition>3</edition>\n <language>en</language>\n <language>fr</language>\n <script>Latn</script>\n <status><stage>Published</stage></status>\n <copyright>\n <from>2001</from>\n <owner>\n <organization>\n <name>ISO</name>\n <abbreviation></abbreviation>\n </organization>\n </owner>\n </copyright>\n <relation type=\"obsoletes\">\n <bibitem type="standard">\n <formattedref format="text/plain">ISO 123:1985</formattedref>\n </bibitem>\n </relation>\n <relation type=\"updates\">\n <bibitem type="standard">\n <formattedref format="text/plain">ISO 123:2001</formattedref>\n </bibitem>\n </relation>\n<ext></fred></ext></bibitem>
|
1696
1696
|
OUTPUT
|
1697
1697
|
end.exactly(n).times
|
1698
1698
|
end
|
@@ -490,4 +490,32 @@ RSpec.describe Asciidoctor::Standoc do
|
|
490
490
|
expect(File.read("test.err"))
|
491
491
|
.to include "Could not resolve footnoteblock:[id1]"
|
492
492
|
end
|
493
|
+
|
494
|
+
it "Warning if xref/@target does not point to a real identifier" do
|
495
|
+
FileUtils.rm_f "test.err"
|
496
|
+
Asciidoctor.convert(<<~"INPUT", *OPTIONS)
|
497
|
+
= Document title
|
498
|
+
Author
|
499
|
+
:docfile: test.adoc
|
500
|
+
:no-pdf:
|
501
|
+
|
502
|
+
<<id1>>
|
503
|
+
|
504
|
+
[[id2]]
|
505
|
+
[NOTE]
|
506
|
+
--
|
507
|
+
|===
|
508
|
+
|a |b
|
509
|
+
|
510
|
+
|c |d
|
511
|
+
|===
|
512
|
+
|
513
|
+
* A
|
514
|
+
* B
|
515
|
+
* C
|
516
|
+
--
|
517
|
+
INPUT
|
518
|
+
expect(File.read("test.err"))
|
519
|
+
.to include "Crossreference target id1 is undefined"
|
520
|
+
end
|
493
521
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -40,11 +40,9 @@ RSpec.configure do |config|
|
|
40
40
|
end
|
41
41
|
|
42
42
|
config.around :each do |example|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
fail "Unexpected exit encountered"
|
47
|
-
end
|
43
|
+
example.run
|
44
|
+
rescue SystemExit
|
45
|
+
fail "Unexpected exit encountered"
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
@@ -231,7 +229,7 @@ def stub_fetch_ref(**opts)
|
|
231
229
|
xml = ""
|
232
230
|
|
233
231
|
hit = double("hit")
|
234
|
-
expect(hit).to receive(:
|
232
|
+
expect(hit).to receive(:[]).with("title") do
|
235
233
|
Nokogiri::XML(xml).at("//docidentifier").content
|
236
234
|
end.at_least(:once)
|
237
235
|
|
@@ -261,7 +259,7 @@ end
|
|
261
259
|
private
|
262
260
|
|
263
261
|
def get_xml(search, code, opts)
|
264
|
-
c = code.gsub(%r{[
|
262
|
+
c = code.gsub(%r{[/\s:-]}, "_").sub(%r{_+$}, "").downcase
|
265
263
|
o = opts.keys.join "_"
|
266
264
|
file = examples_path("#{[c, o].join '_'}.xml")
|
267
265
|
if File.exist? file
|