metanorma-standoc 1.5.1 → 1.6.2
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.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +62 -0
- data/lib/asciidoctor/standoc/base.rb +7 -2
- data/lib/asciidoctor/standoc/basicdoc.rng +23 -0
- data/lib/asciidoctor/standoc/cleanup.rb +32 -12
- data/lib/asciidoctor/standoc/cleanup_amend.rb +54 -0
- data/lib/asciidoctor/standoc/cleanup_block.rb +0 -2
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +14 -0
- data/lib/asciidoctor/standoc/cleanup_footnotes.rb +11 -3
- data/lib/asciidoctor/standoc/cleanup_inline.rb +62 -1
- data/lib/asciidoctor/standoc/cleanup_ref.rb +6 -5
- data/lib/asciidoctor/standoc/cleanup_section.rb +19 -3
- data/lib/asciidoctor/standoc/cleanup_terms.rb +2 -2
- data/lib/asciidoctor/standoc/converter.rb +4 -2
- data/lib/asciidoctor/standoc/front.rb +9 -3
- data/lib/asciidoctor/standoc/front_contributor.rb +58 -18
- data/lib/asciidoctor/standoc/inline.rb +21 -31
- data/lib/asciidoctor/standoc/isodoc.rng +125 -58
- data/lib/asciidoctor/standoc/log.rb +10 -1
- data/lib/asciidoctor/standoc/macros.rb +44 -33
- data/lib/asciidoctor/standoc/ref.rb +39 -44
- data/lib/asciidoctor/standoc/ref_sect.rb +12 -5
- data/lib/asciidoctor/standoc/section.rb +11 -10
- data/lib/asciidoctor/standoc/table.rb +3 -2
- data/lib/asciidoctor/standoc/utils.rb +2 -1
- data/lib/asciidoctor/standoc/validate.rb +30 -18
- data/lib/asciidoctor/standoc/validate_section.rb +1 -1
- data/lib/asciidoctor/standoc/views/datamodel/model_representation.adoc.erb +10 -10
- data/lib/liquid/custom_blocks/key_iterator.rb +21 -0
- data/lib/liquid/custom_blocks/with_json_nested_context.rb +18 -0
- data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +19 -0
- data/lib/liquid/custom_filters/values.rb +7 -0
- data/lib/metanorma/standoc.rb +0 -5
- data/lib/metanorma/standoc/version.rb +20 -1
- data/metanorma-standoc.gemspec +4 -4
- data/spec/asciidoctor-standoc/base_spec.rb +248 -10
- data/spec/asciidoctor-standoc/blocks_spec.rb +263 -144
- data/spec/asciidoctor-standoc/cleanup_spec.rb +199 -50
- data/spec/asciidoctor-standoc/inline_spec.rb +132 -5
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +13 -27
- data/spec/asciidoctor-standoc/macros_json2text_spec.rb +10 -0
- data/spec/asciidoctor-standoc/macros_spec.rb +43 -23
- data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +6 -561
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +5 -3
- data/spec/asciidoctor-standoc/refs_spec.rb +268 -57
- data/spec/asciidoctor-standoc/section_spec.rb +0 -1
- data/spec/asciidoctor-standoc/table_spec.rb +119 -113
- data/spec/asciidoctor-standoc/validate_spec.rb +27 -1
- data/spec/examples/codes_table.html +1365 -1365
- data/spec/fixtures/macros_datamodel/address_class_profile.xml +46 -46
- data/spec/fixtures/macros_datamodel/address_component_profile.xml +21 -21
- data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +21 -21
- data/spec/spec_helper.rb +115 -109
- data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +781 -0
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +54 -238
- data/spec/vcr_cassettes/isobib_get_123.yml +14 -60
- data/spec/vcr_cassettes/isobib_get_123_1.yml +24 -116
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +361 -0
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -60
- data/spec/vcr_cassettes/isobib_get_124.yml +11 -57
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +39 -37
- metadata +42 -11
- data/.github/workflows/macos.yml +0 -46
- data/.github/workflows/ubuntu.yml +0 -49
- data/.github/workflows/windows.yml +0 -53
- data/lib/asciidoctor/standoc/macros_yaml2text.rb +0 -165
- data/lib/metanorma/standoc/latexml_requirement.rb +0 -62
- data/lib/metanorma/standoc/requirement.rb +0 -13
@@ -158,7 +158,21 @@ RSpec.describe Asciidoctor::Standoc do
|
|
158
158
|
<terms id="_" obligation="normative">
|
159
159
|
<title>Terms and definitions</title>
|
160
160
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
161
|
-
<term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub
|
161
|
+
<term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
|
162
|
+
<mrow>
|
163
|
+
<mi>t</mi>
|
164
|
+
</mrow>
|
165
|
+
<mrow>
|
166
|
+
<mn>90</mn>
|
167
|
+
</mrow>
|
168
|
+
</msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
|
169
|
+
<mrow>
|
170
|
+
<mi>t</mi>
|
171
|
+
</mrow>
|
172
|
+
<mrow>
|
173
|
+
<mn>91</mn>
|
174
|
+
</mrow>
|
175
|
+
</msub></math></stem></admitted>
|
162
176
|
<definition><p id="_">Time</p></definition></term>
|
163
177
|
</terms>
|
164
178
|
</sections>
|
@@ -229,8 +243,22 @@ RSpec.describe Asciidoctor::Standoc do
|
|
229
243
|
<terms id="_" obligation="normative">
|
230
244
|
<title>Terms and definitions</title>
|
231
245
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
232
|
-
<term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub
|
233
|
-
|
246
|
+
<term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
|
247
|
+
<mrow>
|
248
|
+
<mi>t</mi>
|
249
|
+
</mrow>
|
250
|
+
<mrow>
|
251
|
+
<mn>90</mn>
|
252
|
+
</mrow>
|
253
|
+
</msub></math></stem></preferred><definition><formula id="_">
|
254
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
|
255
|
+
<mrow>
|
256
|
+
<mi>t</mi>
|
257
|
+
</mrow>
|
258
|
+
<mrow>
|
259
|
+
<mi>A</mi>
|
260
|
+
</mrow>
|
261
|
+
</msub></math></stem>
|
234
262
|
</formula>
|
235
263
|
<p id="_">This paragraph is extraneous</p></definition>
|
236
264
|
</term>
|
@@ -680,9 +708,9 @@ end
|
|
680
708
|
<sections><table id="_">
|
681
709
|
<tbody>
|
682
710
|
<tr>
|
683
|
-
<td align="left">a</td>
|
684
|
-
<td align="left">b</td>
|
685
|
-
<td align="left">c</td>
|
711
|
+
<td valign="top" align="left">a</td>
|
712
|
+
<td valign="top" align="left">b</td>
|
713
|
+
<td valign="top" align="left">c</td>
|
686
714
|
</tr>
|
687
715
|
</tbody>
|
688
716
|
<dl id="_">
|
@@ -711,23 +739,23 @@ end
|
|
711
739
|
#{BLANK_HDR}
|
712
740
|
<sections>
|
713
741
|
<table id="_"><thead><tr>
|
714
|
-
<th align="left">a</th>
|
715
|
-
<th align="left">b</th>
|
716
|
-
<th align="left">c</th>
|
742
|
+
<th valign="top" align="left">a</th>
|
743
|
+
<th valign="top" align="left">b</th>
|
744
|
+
<th valign="top" align="left">c</th>
|
717
745
|
</tr><tr>
|
718
|
-
<th align="left">a</th>
|
719
|
-
<th align="left">b</th>
|
720
|
-
<th align="left">c</th>
|
746
|
+
<th valign="top" align="left">a</th>
|
747
|
+
<th valign="top" align="left">b</th>
|
748
|
+
<th valign="top" align="left">c</th>
|
721
749
|
</tr><tr>
|
722
|
-
<th align="left">a</th>
|
723
|
-
<th align="left">b</th>
|
724
|
-
<th align="left">c</th>
|
750
|
+
<th valign="top" align="left">a</th>
|
751
|
+
<th valign="top" align="left">b</th>
|
752
|
+
<th valign="top" align="left">c</th>
|
725
753
|
</tr></thead>
|
726
754
|
<tbody>
|
727
755
|
<tr>
|
728
|
-
<td align="left">a</td>
|
729
|
-
<td align="left">b</td>
|
730
|
-
<td align="left">c</td>
|
756
|
+
<td valign="top" align="left">a</td>
|
757
|
+
<td valign="top" align="left">b</td>
|
758
|
+
<td valign="top" align="left">c</td>
|
731
759
|
</tr>
|
732
760
|
</tbody>
|
733
761
|
</table>
|
@@ -753,26 +781,26 @@ end
|
|
753
781
|
<table id="_">
|
754
782
|
<thead>
|
755
783
|
<tr>
|
756
|
-
<th align="left">a</th>
|
757
|
-
<th align="left">b</th>
|
758
|
-
<th align="left">c</th>
|
784
|
+
<th valign="top" align="left">a</th>
|
785
|
+
<th valign="top" align="left">b</th>
|
786
|
+
<th valign="top" align="left">c</th>
|
759
787
|
</tr>
|
760
788
|
<tr>
|
761
|
-
<th align="left">a</th>
|
762
|
-
<th align="left">b</th>
|
763
|
-
<th align="left">c</th>
|
789
|
+
<th valign="top" align="left">a</th>
|
790
|
+
<th valign="top" align="left">b</th>
|
791
|
+
<th valign="top" align="left">c</th>
|
764
792
|
</tr><tr>
|
765
|
-
<th align="left">a</th>
|
766
|
-
<th align="left">b</th>
|
767
|
-
<th align="left">c</th>
|
793
|
+
<th valign="top" align="left">a</th>
|
794
|
+
<th valign="top" align="left">b</th>
|
795
|
+
<th valign="top" align="left">c</th>
|
768
796
|
</tr></thead>
|
769
797
|
<tbody>
|
770
798
|
|
771
799
|
|
772
800
|
<tr>
|
773
|
-
<td align="left">a</td>
|
774
|
-
<td align="left">b</td>
|
775
|
-
<td align="left">c</td>
|
801
|
+
<td valign="top" align="left">a</td>
|
802
|
+
<td valign="top" align="left">b</td>
|
803
|
+
<td valign="top" align="left">c</td>
|
776
804
|
</tr>
|
777
805
|
</tbody>
|
778
806
|
</table>
|
@@ -796,9 +824,9 @@ end
|
|
796
824
|
<sections><table id="_">
|
797
825
|
<tbody>
|
798
826
|
<tr>
|
799
|
-
<td align="left">a</td>
|
800
|
-
<td align="left">b</td>
|
801
|
-
<td align="left">c</td>
|
827
|
+
<td valign="top" align="left">a</td>
|
828
|
+
<td valign="top" align="left">b</td>
|
829
|
+
<td valign="top" align="left">c</td>
|
802
830
|
</tr>
|
803
831
|
</tbody>
|
804
832
|
<note id="_">
|
@@ -1139,7 +1167,7 @@ end
|
|
1139
1167
|
# mock_iecbib_get_iec60050_102_01
|
1140
1168
|
# mock_iecbib_get_iec60050_103_01
|
1141
1169
|
# mock_iev
|
1142
|
-
VCR.use_cassette "separates_iev_citations_by_top_level_clause" do
|
1170
|
+
VCR.use_cassette "separates_iev_citations_by_top_level_clause", :re_record_interval => 25200 do
|
1143
1171
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1144
1172
|
#{CACHED_ISOBIB_BLANK_HDR}
|
1145
1173
|
|
@@ -1208,6 +1236,7 @@ end
|
|
1208
1236
|
<uri type="src">https://webstore.iec.ch/publication/160</uri>
|
1209
1237
|
<uri type="obp">/preview/info_iec60050-102%7Bed1.0%7Db.pdf</uri>
|
1210
1238
|
<docidentifier type="IEC">IEC 60050-102:2007</docidentifier>
|
1239
|
+
<docidentifier type='URN'>urn:iec:std:iec:60050-102:2007:::en</docidentifier>
|
1211
1240
|
<date type="published">
|
1212
1241
|
<on>2007</on>
|
1213
1242
|
</date>
|
@@ -1246,6 +1275,7 @@ end
|
|
1246
1275
|
<uri type="src">https://webstore.iec.ch/publication/161</uri>
|
1247
1276
|
<uri type="obp">/preview/info_iec60050-103%7Bed1.0%7Db.pdf</uri>
|
1248
1277
|
<docidentifier type="IEC">IEC 60050-103:2009</docidentifier>
|
1278
|
+
<docidentifier type='URN'>urn:iec:std:iec:60050-103:2009:::en</docidentifier>
|
1249
1279
|
<date type="published">
|
1250
1280
|
<on>2009</on>
|
1251
1281
|
</date>
|
@@ -1359,7 +1389,14 @@ end
|
|
1359
1389
|
#{BLANK_HDR}
|
1360
1390
|
<sections>
|
1361
1391
|
<p id="_">
|
1362
|
-
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac
|
1392
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac>
|
1393
|
+
<mrow>
|
1394
|
+
<mn>1</mn>
|
1395
|
+
</mrow>
|
1396
|
+
<mrow>
|
1397
|
+
<mi>r</mi>
|
1398
|
+
</mrow>
|
1399
|
+
</mfrac></math></stem>
|
1363
1400
|
</p>
|
1364
1401
|
</sections>
|
1365
1402
|
</standard-document>
|
@@ -1584,7 +1621,7 @@ it "removes bibdata bibitem IDs" do
|
|
1584
1621
|
|
1585
1622
|
INPUT
|
1586
1623
|
<?xml version='1.0' encoding='UTF-8'?>
|
1587
|
-
<standard-document xmlns='https://www.metanorma.org/ns/standoc'>
|
1624
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
1588
1625
|
<bibdata type='standard'>
|
1589
1626
|
<title language='en' format='text/plain'>Document title</title>
|
1590
1627
|
<language>en</language>
|
@@ -1630,7 +1667,7 @@ it "imports boilerplate file" do
|
|
1630
1667
|
== Clause 1
|
1631
1668
|
|
1632
1669
|
INPUT
|
1633
|
-
<standard-document xmlns='https://www.metanorma.org/ns/standoc'>
|
1670
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
1634
1671
|
<bibdata type='standard'>
|
1635
1672
|
<title language='en' format='text/plain'>Document title</title>
|
1636
1673
|
<language>en</language>
|
@@ -1669,12 +1706,28 @@ it "sorts symbols lists" do
|
|
1669
1706
|
x_1_:: Definition 3
|
1670
1707
|
x_m_:: Definition 4
|
1671
1708
|
x:: Definition 5
|
1709
|
+
stem:[n]:: Definition 6
|
1710
|
+
m:: Definition 7
|
1672
1711
|
INPUT
|
1673
1712
|
#{BLANK_HDR}
|
1674
1713
|
<sections>
|
1675
1714
|
<definitions id='L' obligation="normative">
|
1676
1715
|
<title>Symbols and abbreviated terms</title>
|
1677
1716
|
<dl id='_'>
|
1717
|
+
<dt>m</dt>
|
1718
|
+
<dd>
|
1719
|
+
<p id='_'>Definition 7</p>
|
1720
|
+
</dd>
|
1721
|
+
<dt>
|
1722
|
+
<stem type='MathML'>
|
1723
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
1724
|
+
<mi>n</mi>
|
1725
|
+
</math>
|
1726
|
+
</stem>
|
1727
|
+
</dt>
|
1728
|
+
<dd>
|
1729
|
+
<p id='_'>Definition 6</p>
|
1730
|
+
</dd>
|
1678
1731
|
<dt>x</dt>
|
1679
1732
|
<dd>
|
1680
1733
|
<p id='_'>Definition 5</p>
|
@@ -1727,8 +1780,12 @@ it "sorts symbols lists" do
|
|
1727
1780
|
<dt><stem type='MathML'>
|
1728
1781
|
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
1729
1782
|
<msub>
|
1730
|
-
<
|
1731
|
-
|
1783
|
+
<mrow>
|
1784
|
+
<mi>x</mi>
|
1785
|
+
</mrow>
|
1786
|
+
<mrow>
|
1787
|
+
<mi>m</mi>
|
1788
|
+
</mrow>
|
1732
1789
|
</msub>
|
1733
1790
|
</math>
|
1734
1791
|
</stem></dt>
|
@@ -1738,8 +1795,12 @@ it "sorts symbols lists" do
|
|
1738
1795
|
<dt><stem type='MathML'>
|
1739
1796
|
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
1740
1797
|
<msub>
|
1741
|
-
<
|
1742
|
-
|
1798
|
+
<mrow>
|
1799
|
+
<mi>x</mi>
|
1800
|
+
</mrow>
|
1801
|
+
<mrow>
|
1802
|
+
<mn>1</mn>
|
1803
|
+
</mrow>
|
1743
1804
|
</msub>
|
1744
1805
|
</math>
|
1745
1806
|
</stem></dt>
|
@@ -1872,6 +1933,9 @@ it "moves %beforeclause admonitions to right position" do
|
|
1872
1933
|
INPUT
|
1873
1934
|
#{BLANK_HDR}
|
1874
1935
|
<preface>
|
1936
|
+
<note id='_'>
|
1937
|
+
<p id='_'>Note which is very important</p>
|
1938
|
+
</note>
|
1875
1939
|
<foreword id='_' obligation='informative'>
|
1876
1940
|
<title>Foreword</title>
|
1877
1941
|
<p id='_'>Foreword</p>
|
@@ -1882,9 +1946,6 @@ INPUT
|
|
1882
1946
|
</introduction>
|
1883
1947
|
</preface>
|
1884
1948
|
<sections>
|
1885
|
-
<note id='_'>
|
1886
|
-
<p id='_'>Note which is very important</p>
|
1887
|
-
</note>
|
1888
1949
|
<admonition id='_' type='important'>
|
1889
1950
|
<p id='_'>Notice which is very important</p>
|
1890
1951
|
</admonition>
|
@@ -1995,7 +2056,7 @@ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, heade
|
|
1995
2056
|
=== Bibliography Subsection
|
1996
2057
|
|
1997
2058
|
INPUT
|
1998
|
-
<standard-document xmlns='https://www.metanorma.org/ns/standoc'>
|
2059
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
1999
2060
|
<bibdata type='standard'>
|
2000
2061
|
<title language='en' format='text/plain'>Document title</title>
|
2001
2062
|
<language>en</language>
|
@@ -2271,7 +2332,7 @@ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, heade
|
|
2271
2332
|
=== Bibliography Subsection
|
2272
2333
|
|
2273
2334
|
INPUT
|
2274
|
-
<standard-document xmlns='https://www.metanorma.org/ns/standoc'>
|
2335
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
2275
2336
|
<bibdata type='standard'>
|
2276
2337
|
<title language='en' format='text/plain'>Document title</title>
|
2277
2338
|
<language>tlh</language>
|
@@ -2502,7 +2563,7 @@ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, heade
|
|
2502
2563
|
=== Bibliography Subsection
|
2503
2564
|
|
2504
2565
|
INPUT
|
2505
|
-
<standard-document xmlns='https://www.metanorma.org/ns/standoc'>
|
2566
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
2506
2567
|
<bibdata type='standard'>
|
2507
2568
|
<title language='en' format='text/plain'>Document title</title>
|
2508
2569
|
<language>fr</language>
|
@@ -2587,7 +2648,7 @@ INPUT
|
|
2587
2648
|
</clause>
|
2588
2649
|
</clause>
|
2589
2650
|
<definitions id='_' obligation='normative'>
|
2590
|
-
<title>
|
2651
|
+
<title>Symboles et termes abrégés</title>
|
2591
2652
|
<clause id='_' inline-header='false' obligation='normative'>
|
2592
2653
|
<title>General</title>
|
2593
2654
|
</clause>
|
@@ -2736,7 +2797,7 @@ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, heade
|
|
2736
2797
|
=== Bibliography Subsection
|
2737
2798
|
|
2738
2799
|
INPUT
|
2739
|
-
<standard-document xmlns='https://www.metanorma.org/ns/standoc'>
|
2800
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
2740
2801
|
<bibdata type='standard'>
|
2741
2802
|
<title language='en' format='text/plain'>Document title</title>
|
2742
2803
|
<language>zh</language>
|
@@ -2967,7 +3028,7 @@ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, heade
|
|
2967
3028
|
=== Bibliography Subsection
|
2968
3029
|
|
2969
3030
|
INPUT
|
2970
|
-
<standard-document xmlns='https://www.metanorma.org/ns/standoc'>
|
3031
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
2971
3032
|
<bibdata type='standard'>
|
2972
3033
|
<title language='en' format='text/plain'>Document title</title>
|
2973
3034
|
<language>en</language>
|
@@ -3102,6 +3163,94 @@ INPUT
|
|
3102
3163
|
OUTPUT
|
3103
3164
|
end
|
3104
3165
|
|
3166
|
+
it "fixes illegal anchors" do
|
3167
|
+
input = <<~INPUT
|
3168
|
+
#{ASCIIDOC_BLANK_HDR}
|
3169
|
+
|
3170
|
+
[[a:b]]
|
3171
|
+
== A
|
3172
|
+
<</:ab>>
|
3173
|
+
<<:>>
|
3174
|
+
<<1>>
|
3175
|
+
<<1:>>
|
3176
|
+
<<1#b>>
|
3177
|
+
<<:a#b:>>
|
3178
|
+
|
3179
|
+
INPUT
|
3180
|
+
expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true).gsub(/<p id="_[^"]+">/, "").gsub('</p>', ""))).to be_equivalent_to (<<~"OUTPUT")
|
3181
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
3182
|
+
<bibdata type='standard'>
|
3183
|
+
<title language='en' format='text/plain'>Document title</title>
|
3184
|
+
<language>en</language>
|
3185
|
+
<script>Latn</script>
|
3186
|
+
<status>
|
3187
|
+
<stage>published</stage>
|
3188
|
+
</status>
|
3189
|
+
<copyright>
|
3190
|
+
<from>2020</from>
|
3191
|
+
</copyright>
|
3192
|
+
<ext>
|
3193
|
+
<doctype>article</doctype>
|
3194
|
+
</ext>
|
3195
|
+
</bibdata>
|
3196
|
+
<sections>
|
3197
|
+
<clause id='a_b' inline-header='false' obligation='normative'>
|
3198
|
+
<title>A</title>
|
3199
|
+
<xref target='__ab'/>
|
3200
|
+
<xref target='_'/>
|
3201
|
+
<xref target='_1'/>
|
3202
|
+
<xref target='_1_'/>
|
3203
|
+
<xref target='1#b'/>
|
3204
|
+
<xref target='_a#b_'/>
|
3205
|
+
</clause>
|
3206
|
+
</sections>
|
3207
|
+
</standard-document>
|
3208
|
+
OUTPUT
|
3209
|
+
expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <clause id="a_b" inline-header="false" obligation="normative"/> from a:b}).to_stderr
|
3210
|
+
expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="__ab"/> from /:ab}).to_stderr
|
3211
|
+
expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_"/> from :}).to_stderr
|
3212
|
+
expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_1"/> from 1}).to_stderr
|
3213
|
+
expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_1_"/> from 1:}).to_stderr
|
3214
|
+
expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_a#b_"/> from :a#b:}).to_stderr
|
3215
|
+
end
|
3216
|
+
|
3217
|
+
it "moves title footnotes to bibdata" do
|
3218
|
+
input = <<~INPUT
|
3219
|
+
= Document title footnote:[ABC] footnote:[DEF]
|
3220
|
+
Author
|
3221
|
+
:docfile: test.adoc
|
3222
|
+
:nodoc:
|
3223
|
+
:novalid:
|
3224
|
+
:no-isobib:
|
3225
|
+
|
3226
|
+
INPUT
|
3227
|
+
expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
3228
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
3229
|
+
<bibdata type='standard'>
|
3230
|
+
<title language='en' format='text/plain'>Document title</title>
|
3231
|
+
<note type='title-footnote'>
|
3232
|
+
<p>ABC</p>
|
3233
|
+
</note>
|
3234
|
+
<note type='title-footnote'>
|
3235
|
+
<p>DEF</p>
|
3236
|
+
</note>
|
3237
|
+
<language>en</language>
|
3238
|
+
<script>Latn</script>
|
3239
|
+
<status>
|
3240
|
+
<stage>published</stage>
|
3241
|
+
</status>
|
3242
|
+
<copyright>
|
3243
|
+
<from>2020</from>
|
3244
|
+
</copyright>
|
3245
|
+
<ext>
|
3246
|
+
<doctype>article</doctype>
|
3247
|
+
</ext>
|
3248
|
+
</bibdata>
|
3249
|
+
<sections> </sections>
|
3250
|
+
</standard-document>
|
3251
|
+
OUTPUT
|
3252
|
+
|
3253
|
+
end
|
3105
3254
|
|
3106
3255
|
private
|
3107
3256
|
|
@@ -10,7 +10,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
10
10
|
text, including **__nest__**ed markup.
|
11
11
|
INPUT
|
12
12
|
<?xml version="1.0" encoding="UTF-8"?>
|
13
|
-
<standard-document xmlns="https://www.metanorma.org/ns/standoc">
|
13
|
+
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Standoc::VERSION}">
|
14
14
|
<bibdata type="standard">
|
15
15
|
<title language="en" format="text/plain">Document title</title>
|
16
16
|
<language>en</language>
|
@@ -77,42 +77,147 @@ text, including <strong><em>nest</em></strong>ed markup.</p>
|
|
77
77
|
OUTPUT
|
78
78
|
end
|
79
79
|
|
80
|
+
it "process mtext spaces" do
|
81
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
82
|
+
#{DUMBQUOTE_BLANK_HDR}
|
83
|
+
|
84
|
+
stem:[n < 1 " for all text "]
|
85
|
+
INPUT
|
86
|
+
#{BLANK_HDR}
|
87
|
+
<sections>
|
88
|
+
<p id='_'>
|
89
|
+
<stem type='MathML'>
|
90
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
91
|
+
<mi>n</mi>
|
92
|
+
<mo/>
|
93
|
+
<mn>1</mn>
|
94
|
+
<mtext> for all text </mtext>
|
95
|
+
</math>
|
96
|
+
</stem>
|
97
|
+
</p>
|
98
|
+
</sections>
|
99
|
+
</standard-document>
|
100
|
+
OUTPUT
|
101
|
+
end
|
102
|
+
|
80
103
|
it "properly handles inline substitution" do
|
81
104
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
82
105
|
#{DUMBQUOTE_BLANK_HDR}
|
83
106
|
|
84
107
|
stem:[n < 1] +
|
85
108
|
latexmath:[n < 1]
|
109
|
+
stem:["‌"^199 "Hg"^+]
|
86
110
|
INPUT
|
87
111
|
#{BLANK_HDR}
|
88
112
|
<sections>
|
89
113
|
<p id="_">
|
90
114
|
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo><</mo><mn>1</mn></math></stem><br/>
|
91
115
|
<stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo><</mo> <mn>1</mn> </mrow> </math></stem>
|
116
|
+
<stem type='MathML'>
|
117
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
118
|
+
<msup>
|
119
|
+
<mrow>
|
120
|
+
<mtext></mtext>
|
121
|
+
</mrow>
|
122
|
+
<mrow>
|
123
|
+
<mn>199</mn>
|
124
|
+
</mrow>
|
125
|
+
</msup>
|
126
|
+
<msup>
|
127
|
+
<mrow>
|
128
|
+
<mtext>Hg</mtext>
|
129
|
+
</mrow>
|
130
|
+
<mrow>
|
131
|
+
<mo>+</mo>
|
132
|
+
</mrow>
|
133
|
+
</msup>
|
134
|
+
</math>
|
135
|
+
</stem>
|
92
136
|
</p>
|
93
137
|
</sections>
|
94
138
|
</standard-document>
|
95
139
|
OUTPUT
|
96
140
|
end
|
97
141
|
|
98
|
-
it "normalises inline stem" do
|
142
|
+
it "normalises inline stem, straight quotes" do
|
99
143
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
100
144
|
#{DUMBQUOTE_BLANK_HDR}
|
101
145
|
|
102
146
|
stem:[n < 1]
|
103
147
|
latexmath:[n < 1]
|
148
|
+
stem:["‌"^199 "Hg"^+]
|
149
|
+
INPUT
|
150
|
+
#{BLANK_HDR}
|
151
|
+
<sections>
|
152
|
+
<p id="_">
|
153
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo><</mo><mn>1</mn></math></stem>
|
154
|
+
<stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo><</mo> <mn>1</mn> </mrow> </math></stem>
|
155
|
+
<stem type='MathML'>
|
156
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
157
|
+
<msup>
|
158
|
+
<mrow>
|
159
|
+
<mtext></mtext>
|
160
|
+
</mrow>
|
161
|
+
<mrow>
|
162
|
+
<mn>199</mn>
|
163
|
+
</mrow>
|
164
|
+
</msup>
|
165
|
+
<msup>
|
166
|
+
<mrow>
|
167
|
+
<mtext>Hg</mtext>
|
168
|
+
</mrow>
|
169
|
+
<mrow>
|
170
|
+
<mo>+</mo>
|
171
|
+
</mrow>
|
172
|
+
</msup>
|
173
|
+
</math>
|
174
|
+
</stem>
|
175
|
+
</p>
|
176
|
+
</sections>
|
177
|
+
</standard-document>
|
178
|
+
OUTPUT
|
179
|
+
end
|
180
|
+
|
181
|
+
it "normalises inline stem, smart quotes" do
|
182
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
183
|
+
#{ASCIIDOC_BLANK_HDR}
|
184
|
+
|
185
|
+
stem:[n < 1]
|
186
|
+
latexmath:[n < 1]
|
187
|
+
stem:["‌"^199 "Hg"^+]
|
104
188
|
INPUT
|
105
189
|
#{BLANK_HDR}
|
106
190
|
<sections>
|
107
191
|
<p id="_">
|
108
192
|
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo><</mo><mn>1</mn></math></stem>
|
109
193
|
<stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>n</mi> <mo><</mo> <mn>1</mn> </mrow> </math></stem>
|
194
|
+
<stem type='MathML'>
|
195
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
196
|
+
<msup>
|
197
|
+
<mrow>
|
198
|
+
<mtext></mtext>
|
199
|
+
</mrow>
|
200
|
+
<mrow>
|
201
|
+
<mn>199</mn>
|
202
|
+
</mrow>
|
203
|
+
</msup>
|
204
|
+
<msup>
|
205
|
+
<mrow>
|
206
|
+
<mtext>Hg</mtext>
|
207
|
+
</mrow>
|
208
|
+
<mrow>
|
209
|
+
<mo>+</mo>
|
210
|
+
</mrow>
|
211
|
+
</msup>
|
212
|
+
</math>
|
213
|
+
</stem>
|
110
214
|
</p>
|
111
215
|
</sections>
|
112
216
|
</standard-document>
|
113
217
|
OUTPUT
|
114
218
|
end
|
115
219
|
|
220
|
+
|
116
221
|
it "generates desired smart quotes for 'dd'" do
|
117
222
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
118
223
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -162,13 +267,16 @@ text, including <strong><em>nest</em></strong>ed markup.</p>
|
|
162
267
|
http://example.com[]
|
163
268
|
http://example.com[Link]
|
164
269
|
http://example.com[Link,title="tip"]
|
270
|
+
link:++https://asciidoctor.org/now_this__link_works.html++[]
|
165
271
|
INPUT
|
166
272
|
#{BLANK_HDR}
|
167
273
|
<sections>
|
168
274
|
<p id="_">mailto:fred@example.com
|
169
275
|
<link target="http://example.com"/>
|
170
276
|
<link target="http://example.com">Link</link>
|
171
|
-
<link target="http://example.com" alt="tip">Link</link
|
277
|
+
<link target="http://example.com" alt="tip">Link</link>
|
278
|
+
<link target='https://asciidoctor.org/now_this__link_works.html'/>
|
279
|
+
</p>
|
172
280
|
</sections>
|
173
281
|
</standard-document>
|
174
282
|
OUTPUT
|
@@ -198,8 +306,14 @@ text, including <strong><em>nest</em></strong>ed markup.</p>
|
|
198
306
|
Inline Reference with Text to <<reference,text>>
|
199
307
|
Footnoted Reference with Text to <<reference,fn: text>>
|
200
308
|
Anchored Crossreference to other document <<a.adoc#b>>
|
309
|
+
Capitalised Reference to <<reference,droploc%capital%>>
|
310
|
+
Lowercase Footnoted Reference to <<reference,capital%droploc%fn>>
|
201
311
|
Capitalised Reference to <<reference,capital%>>
|
202
312
|
Lowercase Footnoted Reference to <<reference,capital%fn>>
|
313
|
+
Capitalised Reference to <<reference,droploc%>>
|
314
|
+
Lowercase Footnoted Reference to <<reference,droploc%fn>>
|
315
|
+
Capitalised Reference to <<reference,droploc%capital%>>
|
316
|
+
Lowercase Footnoted Reference to <<reference,droploc%capital%fn>>
|
203
317
|
INPUT
|
204
318
|
#{BLANK_HDR}
|
205
319
|
<sections>
|
@@ -210,8 +324,21 @@ text, including <strong><em>nest</em></strong>ed markup.</p>
|
|
210
324
|
Inline Reference with Text to <xref target="reference">text</xref>
|
211
325
|
Footnoted Reference with Text to <xref target="reference">text</xref>
|
212
326
|
Anchored Crossreference to other document <xref target="a#b"/>
|
213
|
-
Capitalised Reference to <xref target='reference' case='capital'></xref>
|
214
|
-
Lowercase Footnoted Reference to <xref target='reference' case='capital'></xref
|
327
|
+
Capitalised Reference to <xref target='reference' case='capital' droploc="true"></xref>
|
328
|
+
Lowercase Footnoted Reference to <xref target='reference' case='capital' droploc="true"></xref>
|
329
|
+
Capitalised Reference to
|
330
|
+
<xref target='reference' case='capital'/>
|
331
|
+
Lowercase Footnoted Reference to
|
332
|
+
<xref target='reference' case='capital'/>
|
333
|
+
Capitalised Reference to
|
334
|
+
<xref target='reference' droploc='true'/>
|
335
|
+
Lowercase Footnoted Reference to
|
336
|
+
<xref target='reference' droploc='true'/>
|
337
|
+
Capitalised Reference to
|
338
|
+
<xref target='reference' case='capital' droploc='true'/>
|
339
|
+
Lowercase Footnoted Reference to
|
340
|
+
<xref target='reference' case='capital' droploc='true'/>
|
341
|
+
</p>
|
215
342
|
</clause>
|
216
343
|
</sections>
|
217
344
|
</standard-document>
|