metanorma-standoc 1.10.5 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +19 -23
  3. data/Rakefile +1 -1
  4. data/lib/asciidoctor/standoc/base.rb +14 -17
  5. data/lib/asciidoctor/standoc/basicdoc.rng +21 -4
  6. data/lib/asciidoctor/standoc/blocks.rb +26 -23
  7. data/lib/asciidoctor/standoc/blocks_notes.rb +17 -22
  8. data/lib/asciidoctor/standoc/cleanup.rb +46 -12
  9. data/lib/asciidoctor/standoc/cleanup_block.rb +5 -70
  10. data/lib/asciidoctor/standoc/cleanup_image.rb +6 -7
  11. data/lib/asciidoctor/standoc/cleanup_inline.rb +44 -102
  12. data/lib/asciidoctor/standoc/cleanup_maths.rb +5 -6
  13. data/lib/asciidoctor/standoc/cleanup_ref.rb +5 -0
  14. data/lib/asciidoctor/standoc/cleanup_reqt.rb +51 -33
  15. data/lib/asciidoctor/standoc/cleanup_section_names.rb +5 -5
  16. data/lib/asciidoctor/standoc/cleanup_symbols.rb +48 -0
  17. data/lib/asciidoctor/standoc/cleanup_table.rb +68 -0
  18. data/lib/asciidoctor/standoc/cleanup_terms.rb +38 -78
  19. data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +162 -0
  20. data/lib/asciidoctor/standoc/cleanup_text.rb +5 -2
  21. data/lib/asciidoctor/standoc/cleanup_xref.rb +107 -0
  22. data/lib/asciidoctor/standoc/converter.rb +15 -0
  23. data/lib/asciidoctor/standoc/inline.rb +7 -5
  24. data/lib/asciidoctor/standoc/isodoc.rng +435 -78
  25. data/lib/asciidoctor/standoc/lists.rb +15 -15
  26. data/lib/asciidoctor/standoc/macros.rb +14 -43
  27. data/lib/asciidoctor/standoc/macros_note.rb +45 -0
  28. data/lib/asciidoctor/standoc/macros_plantuml.rb +29 -14
  29. data/lib/asciidoctor/standoc/macros_terms.rb +82 -20
  30. data/lib/asciidoctor/standoc/ref_sect.rb +24 -17
  31. data/lib/asciidoctor/standoc/reqt.rb +2 -2
  32. data/lib/asciidoctor/standoc/reqt.rng +23 -2
  33. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +50 -11
  34. data/lib/asciidoctor/standoc/terms.rb +21 -3
  35. data/lib/asciidoctor/standoc/utils.rb +36 -23
  36. data/lib/asciidoctor/standoc/validate.rb +45 -27
  37. data/lib/asciidoctor/standoc/validate_section.rb +5 -2
  38. data/lib/metanorma/standoc/version.rb +1 -1
  39. data/metanorma-standoc.gemspec +1 -1
  40. data/spec/asciidoctor/base_spec.rb +4 -36
  41. data/spec/asciidoctor/blank_spec.rb +37 -0
  42. data/spec/asciidoctor/blocks_spec.rb +296 -47
  43. data/spec/asciidoctor/cleanup_blocks_spec.rb +1018 -0
  44. data/spec/asciidoctor/cleanup_sections_spec.rb +153 -12
  45. data/spec/asciidoctor/cleanup_spec.rb +179 -1265
  46. data/spec/asciidoctor/cleanup_terms_spec.rb +990 -0
  47. data/spec/asciidoctor/inline_spec.rb +38 -2
  48. data/spec/asciidoctor/lists_spec.rb +6 -6
  49. data/spec/asciidoctor/macros_plantuml_spec.rb +37 -2
  50. data/spec/asciidoctor/macros_spec.rb +226 -138
  51. data/spec/asciidoctor/refs_spec.rb +4 -26
  52. data/spec/asciidoctor/section_spec.rb +18 -18
  53. data/spec/asciidoctor/validate_spec.rb +109 -1
  54. data/spec/assets/xref_error.adoc +1 -0
  55. data/spec/fixtures/datamodel_description_sections_tree.xml +327 -326
  56. data/spec/spec_helper.rb +6 -7
  57. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +51 -51
  58. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +13 -13
  59. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  60. data/spec/vcr_cassettes/isobib_get_123_1.yml +26 -26
  61. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +34 -34
  62. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  63. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  64. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +16 -16
  65. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +51 -49
  66. metadata +13 -5
@@ -28,8 +28,8 @@ RSpec.describe Asciidoctor::Standoc do
28
28
  </li>
29
29
  </ul>
30
30
  <term id="term-time">
31
- <preferred>Time</preferred>
32
- <definition><p id="_">This paragraph is extraneous</p></definition>
31
+ <preferred><expression><name>Time</name></expression></preferred>
32
+ <definition><verbaldefinition><p id="_">This paragraph is extraneous</p></verbaldefinition></definition>
33
33
  </term></terms>
34
34
  </sections>
35
35
  </standard-document>
@@ -521,7 +521,7 @@ RSpec.describe Asciidoctor::Standoc do
521
521
  </title>
522
522
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
523
523
  <term id='term-term1'>
524
- <preferred>Term1</preferred>
524
+ <preferred><expression><name>Term1</name></expression></preferred>
525
525
  </term>
526
526
  </terms>
527
527
  <clause id='_' inline-header='false' obligation='normative'>
@@ -796,7 +796,7 @@ RSpec.describe Asciidoctor::Standoc do
796
796
  <title>Terms and definitions</title>
797
797
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
798
798
  <term id='term-term1'>
799
- <preferred>Term1</preferred>
799
+ <preferred><expression><name>Term1</name></expression></preferred>
800
800
  </term>
801
801
  </terms>
802
802
  <clause id='_' inline-header='false' obligation='normative'>
@@ -1033,7 +1033,7 @@ RSpec.describe Asciidoctor::Standoc do
1033
1033
  s’appliquent.
1034
1034
  </p>
1035
1035
  <term id='term-term1'>
1036
- <preferred>Term1</preferred>
1036
+ <preferred><expression><name>Term1</name></expression></preferred>
1037
1037
  </term>
1038
1038
  </terms>
1039
1039
  <clause id='_' inline-header='false' obligation='normative'>
@@ -1267,7 +1267,7 @@ RSpec.describe Asciidoctor::Standoc do
1267
1267
  <title>术语和定义</title>
1268
1268
  <p id='_'>下列术语和定义适用于本文件。</p>
1269
1269
  <term id='term-term1'>
1270
- <preferred>Term1</preferred>
1270
+ <preferred><expression><name>Term1</name></expression></preferred>
1271
1271
  </term>
1272
1272
  </terms>
1273
1273
  <clause id='_' inline-header='false' obligation='normative'>
@@ -1501,7 +1501,7 @@ RSpec.describe Asciidoctor::Standoc do
1501
1501
  <title>Terms and definitions</title>
1502
1502
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1503
1503
  <term id='term-term1'>
1504
- <preferred>Term1</preferred>
1504
+ <preferred><expression><name>Term1</name></expression></preferred>
1505
1505
  </term>
1506
1506
  </terms>
1507
1507
  <clause id='_' inline-header='false' obligation='normative'>
@@ -1610,7 +1610,7 @@ RSpec.describe Asciidoctor::Standoc do
1610
1610
  == Clause
1611
1611
 
1612
1612
  [.variant-title,type=toc]
1613
- Clause _A_ stem:[x]
1613
+ Clause _A_ stem:[y]
1614
1614
 
1615
1615
  Text
1616
1616
  INPUT
@@ -1622,8 +1622,8 @@ RSpec.describe Asciidoctor::Standoc do
1622
1622
  <p id='_'>Text</p>
1623
1623
  <clause id='_' inline-header='false' obligation='normative'>
1624
1624
  <title>Subclause</title>
1625
- <variant-title variant_title='true' type='sub'>&#8220;A&#8221; &#8216;B&#8217;</variant-title>
1626
- <variant-title variant_title='true' type='toc'>
1625
+ <variant-title type='sub'>&#8220;A&#8221; &#8216;B&#8217;</variant-title>
1626
+ <variant-title type='toc'>
1627
1627
  Clause
1628
1628
  <em>A</em>
1629
1629
  <stem type='MathML'>
@@ -1638,12 +1638,153 @@ RSpec.describe Asciidoctor::Standoc do
1638
1638
  </sections>
1639
1639
  <annex id='_' inline-header='false' obligation='normative'>
1640
1640
  <title>Clause</title>
1641
- <variant-title variant_title='true' type='toc'>
1641
+ <variant-title type='toc'>
1642
1642
  Clause
1643
1643
  <em>A</em>
1644
1644
  <stem type='MathML'>
1645
1645
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
1646
- <mi>x</mi>
1646
+ <mi>y</mi>
1647
+ </math>
1648
+ </stem>
1649
+ </variant-title>
1650
+ <p id='_'>Text</p>
1651
+ </annex>
1652
+ </standard-document>
1653
+ OUTPUT
1654
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1655
+ .to be_equivalent_to xmlpp(output)
1656
+ end
1657
+
1658
+ it "processes TOC clause" do
1659
+ input = <<~INPUT
1660
+ #{ASCIIDOC_BLANK_HDR}
1661
+
1662
+ == Clause
1663
+ Text
1664
+
1665
+ [type=toc]
1666
+ === Table of contents
1667
+
1668
+ Text at the start
1669
+
1670
+ ==== Toc 1
1671
+
1672
+ * <<cl2>>
1673
+ ** <<a1>>
1674
+
1675
+ ==== Toc 2
1676
+
1677
+ * <<cl2,some text>>
1678
+ ** <<a1,some more text>>
1679
+
1680
+ [[cl2]]
1681
+ == Clause2
1682
+
1683
+ [.variant-title,type=toc]
1684
+ Clause _A_ stem:[x]
1685
+
1686
+ [.variant-title,type=sub]
1687
+ "A" 'B'
1688
+
1689
+ Text
1690
+
1691
+ [[a1]]
1692
+ [appendix]
1693
+ == Clause
1694
+
1695
+ [.variant-title,type=toc]
1696
+ Clause _A_ stem:[y]
1697
+
1698
+ Text
1699
+ INPUT
1700
+ output = <<~OUTPUT
1701
+ #{BLANK_HDR}
1702
+ <sections>
1703
+ <clause id='_' inline-header='false' obligation='normative'>
1704
+ <title>Clause</title>
1705
+ <p id='_'>Text</p>
1706
+ <clause id='_' type='toc' inline-header='false' obligation='normative'>
1707
+ <title>Table of contents</title>
1708
+ <p id='_'>Text at the start</p>
1709
+ <clause id='_' inline-header='false' obligation='normative'>
1710
+ <title>Toc 1</title>
1711
+ <toc>
1712
+ <ul id='_'>
1713
+ <li>
1714
+ <p id='_'>
1715
+ <xref target='cl2'>
1716
+ Clause
1717
+ <em>A</em>
1718
+ <stem type='MathML'>
1719
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1720
+ <mi>x</mi>
1721
+ </math>
1722
+ </stem>
1723
+ </xref>
1724
+ </p>
1725
+ <ul id='_'>
1726
+ <li>
1727
+ <p id='_'>
1728
+ <xref target='a1'>
1729
+ Clause
1730
+ <em>A</em>
1731
+ <stem type='MathML'>
1732
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1733
+ <mi>y</mi>
1734
+ </math>
1735
+ </stem>
1736
+ </xref>
1737
+ </p>
1738
+ </li>
1739
+ </ul>
1740
+ </li>
1741
+ </ul>
1742
+ </toc>
1743
+ </clause>
1744
+ <clause id='_' inline-header='false' obligation='normative'>
1745
+ <title>Toc 2</title>
1746
+ <toc>
1747
+ <ul id='_'>
1748
+ <li>
1749
+ <p id='_'>
1750
+ <xref target='cl2'>some text</xref>
1751
+ </p>
1752
+ <ul id='_'>
1753
+ <li>
1754
+ <p id='_'>
1755
+ <xref target='a1'>some more text</xref>
1756
+ </p>
1757
+ </li>
1758
+ </ul>
1759
+ </li>
1760
+ </ul>
1761
+ </toc>
1762
+ </clause>
1763
+ </clause>
1764
+ </clause>
1765
+ <clause id='cl2' inline-header='false' obligation='normative'>
1766
+ <title>Clause2</title>
1767
+ <variant-title type='sub'>&#8220;A&#8221; &#8216;B&#8217;</variant-title>
1768
+ <variant-title type='toc'>
1769
+ Clause
1770
+ <em>A</em>
1771
+ <stem type='MathML'>
1772
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1773
+ <mi>x</mi>
1774
+ </math>
1775
+ </stem>
1776
+ </variant-title>
1777
+ <p id='_'>Text</p>
1778
+ </clause>
1779
+ </sections>
1780
+ <annex id='a1' inline-header='false' obligation='normative'>
1781
+ <title>Clause</title>
1782
+ <variant-title type='toc'>
1783
+ Clause
1784
+ <em>A</em>
1785
+ <stem type='MathML'>
1786
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1787
+ <mi>y</mi>
1647
1788
  </math>
1648
1789
  </stem>
1649
1790
  </variant-title>