metanorma-standoc 2.1.5 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/base.rb +13 -0
  3. data/lib/metanorma/standoc/blocks.rb +26 -17
  4. data/lib/metanorma/standoc/cleanup.rb +1 -1
  5. data/lib/metanorma/standoc/cleanup_biblio.rb +210 -0
  6. data/lib/metanorma/standoc/cleanup_block.rb +6 -4
  7. data/lib/metanorma/standoc/cleanup_maths.rb +2 -15
  8. data/lib/metanorma/standoc/cleanup_ref.rb +22 -13
  9. data/lib/metanorma/standoc/cleanup_reqt.rb +3 -103
  10. data/lib/metanorma/standoc/cleanup_symbols.rb +1 -1
  11. data/lib/metanorma/standoc/cleanup_text.rb +10 -8
  12. data/lib/metanorma/standoc/cleanup_xref.rb +1 -2
  13. data/lib/metanorma/standoc/converter.rb +2 -0
  14. data/lib/metanorma/standoc/front.rb +1 -1
  15. data/lib/metanorma/standoc/front_contributor.rb +0 -10
  16. data/lib/metanorma/standoc/inline.rb +8 -4
  17. data/lib/metanorma/standoc/isodoc.rng +6 -1
  18. data/lib/metanorma/standoc/macros.rb +1 -180
  19. data/lib/metanorma/standoc/macros_inline.rb +194 -0
  20. data/lib/metanorma/standoc/ref_sect.rb +2 -2
  21. data/lib/metanorma/standoc/ref_utility.rb +1 -1
  22. data/lib/metanorma/standoc/reqt.rb +19 -75
  23. data/lib/metanorma/standoc/reqt.rng +1 -1
  24. data/lib/metanorma/standoc/section.rb +35 -3
  25. data/lib/metanorma/standoc/utils.rb +9 -43
  26. data/lib/metanorma/standoc/validate.rb +1 -69
  27. data/lib/metanorma/standoc/validate_table.rb +91 -0
  28. data/lib/metanorma/standoc/version.rb +1 -1
  29. data/metanorma-standoc.gemspec +4 -5
  30. data/spec/metanorma/{refs_dl_spec.rb → biblio_spec.rb} +90 -7
  31. data/spec/metanorma/blocks_spec.rb +31 -267
  32. data/spec/metanorma/cleanup_blocks_spec.rb +0 -171
  33. data/spec/metanorma/inline_spec.rb +4 -0
  34. data/spec/metanorma/macros_concept_spec.rb +1033 -0
  35. data/spec/metanorma/macros_spec.rb +2 -1030
  36. data/spec/metanorma/refs_spec.rb +0 -2
  37. data/spec/metanorma/reqt_spec.rb +130 -0
  38. data/spec/metanorma/section_spec.rb +5 -0
  39. data/spec/metanorma/validate_spec.rb +46 -6
  40. data/spec/vcr_cassettes/bsi16341.yml +80 -52
  41. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +94 -94
  42. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
  43. data/spec/vcr_cassettes/hide_refs.yml +70 -70
  44. data/spec/vcr_cassettes/isobib_get_123.yml +11 -11
  45. data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -23
  46. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
  47. data/spec/vcr_cassettes/isobib_get_123_2.yml +22 -22
  48. data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
  49. data/spec/vcr_cassettes/isobib_get_124.yml +11 -11
  50. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +34 -64
  51. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +45 -45
  52. data/spec/vcr_cassettes/std-link.yml +12 -12
  53. metadata +15 -11
  54. data/lib/metanorma/standoc/cleanup_ref_dl.rb +0 -113
@@ -456,16 +456,16 @@ RSpec.describe Metanorma::Standoc do
456
456
  ====
457
457
  INPUT
458
458
  output = <<~OUTPUT
459
- #{BLANK_HDR}
460
- <sections>
461
- <clause id='_' inline-header='false' obligation='normative'>
462
- <title>Clause</title>
463
- <termnote id='_'>
464
- <p id='_'>XYZ</p>
465
- </termnote>
466
- </clause>
467
- </sections>
468
- </standard-document>
459
+ #{BLANK_HDR}
460
+ <sections>
461
+ <clause id='_' inline-header='false' obligation='normative'>
462
+ <title>Clause</title>
463
+ <termnote id='_'>
464
+ <p id='_'>XYZ</p>
465
+ </termnote>
466
+ </clause>
467
+ </sections>
468
+ </standard-document>
469
469
  OUTPUT
470
470
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
471
471
  .to be_equivalent_to xmlpp(output)
@@ -764,16 +764,16 @@ RSpec.describe Metanorma::Standoc do
764
764
  ====
765
765
  INPUT
766
766
  output = <<~OUTPUT
767
- #{BLANK_HDR}
768
- <sections>
769
- <clause id='_' inline-header='false' obligation='normative'>
770
- <title>Clause</title>
771
- <termexample id='_'>
772
- <p id='_'>XYZ</p>
773
- </termexample>
774
- </clause>
775
- </sections>
776
- </standard-document>
767
+ #{BLANK_HDR}
768
+ <sections>
769
+ <clause id='_' inline-header='false' obligation='normative'>
770
+ <title>Clause</title>
771
+ <termexample id='_'>
772
+ <p id='_'>XYZ</p>
773
+ </termexample>
774
+ </clause>
775
+ </sections>
776
+ </standard-document>
777
777
  OUTPUT
778
778
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
779
779
  .to be_equivalent_to xmlpp(output)
@@ -940,6 +940,9 @@ RSpec.describe Metanorma::Standoc do
940
940
 
941
941
  .Final stages: All kernels are fully gelatinized
942
942
  image::spec/examples/rice_images/rice_image3_3.png[]
943
+
944
+ [%key]
945
+ A:: B
943
946
  ====
944
947
  INPUT
945
948
  output = <<~OUTPUT
@@ -956,7 +959,14 @@ RSpec.describe Metanorma::Standoc do
956
959
  <figure id="_">
957
960
  <name>Final stages: All kernels are fully gelatinized</name>
958
961
  <image src="spec/examples/rice_images/rice_image3_3.png" id="_" mimetype="image/png" height="auto" width="auto"/>
959
- </figure></figure>
962
+ </figure>
963
+ <dl id='_' key='true'>
964
+ <dt>A</dt>
965
+ <dd>
966
+ <p id='_'>B</p>
967
+ </dd>
968
+ </dl>
969
+ </figure>
960
970
  </sections>
961
971
  </standard-document>
962
972
  OUTPUT
@@ -1606,252 +1616,6 @@ RSpec.describe Metanorma::Standoc do
1606
1616
  .to be_equivalent_to xmlpp(output)
1607
1617
  end
1608
1618
 
1609
- it "processes recommendation" do
1610
- input = <<~"INPUT"
1611
- #{ASCIIDOC_BLANK_HDR}
1612
- [.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]
1613
- ====
1614
- I recommend this
1615
- ====
1616
- INPUT
1617
- output = <<~"OUTPUT"
1618
- #{BLANK_HDR}
1619
- <sections>
1620
- <recommendation id="_" unnumbered="true" type="verification" model="ogc" tag='X' multilingual-rendering='common'>
1621
- <label>/ogc/recommendation/wfs/2</label>
1622
- <subject>user</subject>
1623
- <subject>developer, implementer</subject>
1624
- <inherit>/ss/584/2015/level/1</inherit>
1625
- <inherit>/ss/584/2015/level/2</inherit>
1626
- <description><p id="_">I recommend this</p>
1627
- </description>
1628
- </recommendation>
1629
- </sections>
1630
- </standard-document>
1631
- OUTPUT
1632
-
1633
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1634
- .to be_equivalent_to xmlpp(output)
1635
- end
1636
-
1637
- it "processes requirement" do
1638
- input = <<~"INPUT"
1639
- #{ASCIIDOC_BLANK_HDR}
1640
- [[ABC]]
1641
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2",number=3,keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
1642
- .Title
1643
- ====
1644
- I recommend this
1645
-
1646
- . http://www.example.com[]
1647
- . <<ABC>>
1648
- ====
1649
- INPUT
1650
- output = <<~OUTPUT
1651
- #{BLANK_HDR}
1652
- <sections>
1653
- <requirement id="ABC" subsequence="A" number="3" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
1654
- <title>Title</title>
1655
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
1656
- <description><p id="_">I recommend this</p>
1657
- <ol id='_' type='arabic'>
1658
- <li>
1659
- <p id='_'>
1660
- <link target='http://www.example.com'/>
1661
- </p>
1662
- </li>
1663
- <li>
1664
- <p id='_'>
1665
- <xref target='ABC'/>
1666
- </p>
1667
- </li>
1668
- </ol>
1669
- </description>
1670
- </requirement>
1671
- </sections>
1672
- </standard-document>
1673
- OUTPUT
1674
-
1675
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1676
- .to be_equivalent_to xmlpp(output)
1677
- end
1678
-
1679
- it "processes permission" do
1680
- input = <<~"INPUT"
1681
- #{ASCIIDOC_BLANK_HDR}
1682
-
1683
- [[ABC]]
1684
- [.permission,tag=X,multilingual-rendering=common]
1685
- ====
1686
- I recommend this
1687
- ====
1688
- INPUT
1689
- output = <<~"OUTPUT"
1690
- #{BLANK_HDR}
1691
- <sections>
1692
- <permission id="ABC" tag='X' multilingual-rendering='common'>
1693
- <description><p id="_">I recommend this</p></description>
1694
- </permission>
1695
- </sections>
1696
- </standard-document>
1697
- OUTPUT
1698
-
1699
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1700
- .to be_equivalent_to xmlpp(output)
1701
- end
1702
-
1703
- it "processes nested permissions" do
1704
- input = <<~"INPUT"
1705
- #{ASCIIDOC_BLANK_HDR}
1706
- [.permission]
1707
- ====
1708
- I permit this
1709
-
1710
- =====
1711
- Example 2
1712
- =====
1713
-
1714
- [.permission]
1715
- =====
1716
- I also permit this
1717
-
1718
- . List
1719
- . List
1720
- =====
1721
-
1722
- [requirement,type="general",label="/req/core/quantities-uom"]
1723
- ======
1724
- ======
1725
- ====
1726
- INPUT
1727
- output = <<~"OUTPUT"
1728
- #{BLANK_HDR}
1729
- <sections>
1730
- <permission id="_"><description><p id="_">I permit this</p>
1731
- <example id="_">
1732
- <p id="_">Example 2</p>
1733
- </example></description>
1734
- <permission id="_">
1735
- <description><p id="_">I also permit this</p>
1736
- <ol id='_' type='arabic'>
1737
- <li>
1738
- <p id='_'>List</p>
1739
- </li>
1740
- <li>
1741
- <p id='_'>List</p>
1742
- </li>
1743
- </ol>
1744
- </description>
1745
- </permission>
1746
- <requirement id='_' type='general'>
1747
- <label>/req/core/quantities-uom</label>
1748
- </requirement>
1749
- </permission>
1750
- </sections>
1751
- </standard-document>
1752
- OUTPUT
1753
-
1754
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1755
- .to be_equivalent_to xmlpp(output)
1756
- end
1757
-
1758
- it "processes recommendation with internal markup of structure" do
1759
- input = <<~"INPUT"
1760
- #{ASCIIDOC_BLANK_HDR}
1761
-
1762
- [[ABC]]
1763
- [.recommendation,label="/ogc/recommendation/wfs/2",subject="user",classification="control-class:Technical;priority:P0;family:System &amp; Communications Protection,System and Communications Protocols",obligation="permission,recommendation",filename="reqt1.rq"]
1764
- ====
1765
- I recommend _this_.
1766
-
1767
- [.specification,type="tabular",keep-with-next=true,keep-lines-together=true]
1768
- --
1769
- This is the object of the recommendation:
1770
- |===
1771
- |Object |Value
1772
- |Mission | Accomplished
1773
- |===
1774
- --
1775
-
1776
- As for the measurement targets,
1777
-
1778
- [.measurement-target]
1779
- --
1780
- The measurement target shall be measured as:
1781
- [stem]
1782
- ++++
1783
- r/1 = 0
1784
- ++++
1785
- --
1786
-
1787
- [.verification]
1788
- --
1789
- The following code will be run for verification:
1790
-
1791
- [source,CoreRoot]
1792
- ----
1793
- CoreRoot(success): HttpResponse
1794
- if (success)
1795
- recommendation(label: success-response)
1796
- end
1797
- ----
1798
- --
1799
-
1800
- [.import%exclude]
1801
- --
1802
- [source,CoreRoot]
1803
- ----
1804
- success-response()
1805
- ----
1806
- --
1807
-
1808
- [.component]
1809
- --
1810
- Hello
1811
- --
1812
-
1813
- [.component,class=condition]
1814
- --
1815
- If this be thus
1816
- --
1817
- ====
1818
- INPUT
1819
- output = <<~"OUTPUT"
1820
- #{BLANK_HDR}
1821
- <sections>
1822
- <recommendation id="ABC" obligation="permission,recommendation" filename="reqt1.rq"><label>/ogc/recommendation/wfs/2</label><subject>user</subject>
1823
- <classification><tag>control-class</tag><value>Technical</value></classification><classification><tag>priority</tag><value>P0</value></classification><classification><tag>family</tag><value>System &amp; Communications Protection</value></classification><classification><tag>family</tag><value>System and Communications Protocols</value></classification>
1824
- <description><p id="_">I recommend <em>this</em>.</p>
1825
- </description><specification exclude="false" type="tabular" keep-with-next="true" keep-lines-together="true"><p id="_">This is the object of the recommendation:</p><table id="_"> <tbody> <tr> <td valign="top" align="left">Object</td> <td valign="top" align="left">Value</td> </tr> <tr> <td valign="top" align="left">Mission</td> <td valign="top" align="left">Accomplished</td> </tr> </tbody></table></specification><description>
1826
- <p id="_">As for the measurement targets,</p>
1827
- </description><measurement-target exclude="false"><p id="_">The measurement target shall be measured as:</p><formula id="_"> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac>
1828
- <mrow>
1829
- <mi>r</mi>
1830
- </mrow>
1831
- <mrow>
1832
- <mn>1</mn>
1833
- </mrow>
1834
- </mfrac><mo>=</mo><mn>0</mn></math></stem></formula></measurement-target>
1835
- <verification exclude="false"><p id="_">The following code will be run for verification:</p><sourcecode lang="CoreRoot" id="_">CoreRoot(success): HttpResponse
1836
- if (success)
1837
- recommendation(label: success-response)
1838
- end</sourcecode></verification>
1839
- <import exclude="true"> <sourcecode lang="CoreRoot" id="_">success-response()</sourcecode></import>
1840
- <component exclude='false' class='component'>
1841
- <p id='_'>Hello</p>
1842
- </component>
1843
- <component exclude='false' class='condition'>
1844
- <p id='_'>If this be thus</p>
1845
- </component>
1846
- </recommendation>
1847
- </sections>
1848
- </standard-document>
1849
- OUTPUT
1850
-
1851
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1852
- .to be_equivalent_to xmlpp(output)
1853
- end
1854
-
1855
1619
  it "processes delete change clauses" do
1856
1620
  input = <<~"INPUT"
1857
1621
  #{ASCIIDOC_BLANK_HDR}
@@ -792,177 +792,6 @@ RSpec.describe Metanorma::Standoc do
792
792
  .to be_equivalent_to xmlpp(output)
793
793
  end
794
794
 
795
- it "moves metadata deflist to correct location" do
796
- input = <<~INPUT
797
- #{ASCIIDOC_BLANK_HDR}
798
-
799
- == Clause
800
-
801
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
802
- ====
803
- [%metadata]
804
- model:: ogc
805
- type:: class
806
- label:: http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules[*req/core*]
807
- subject:: Encoding of logical models
808
- inherit:: urn:iso:dis:iso:19156:clause:7.2.2
809
- inherit:: urn:iso:dis:iso:19156:clause:8
810
- inherit:: http://www.opengis.net/doc/IS/GML/3.2/clause/2.4
811
- inherit:: O&M Abstract model, OGC 10-004r3, clause D.3.4
812
- inherit:: http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used
813
- inherit:: <<ref2>>
814
- inherit:: <<ref3>>
815
- classification:: priority:P0
816
- classification:: domain:Hydrology,Groundwater
817
- classification:: control-class:Technical
818
- obligation:: recommendation,requirement
819
-
820
- I recommend this
821
- ====
822
- INPUT
823
- output = <<~OUTPUT
824
- #{BLANK_HDR}
825
- <sections>
826
- <clause id='_' inline-header='false' obligation='normative'>
827
- <title>Clause</title>
828
- <requirement id='_' subsequence='A' obligation='recommendation,requirement' model='ogc' type='class'>
829
- <label>
830
- <link target='http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules'>
831
- <strong>req/core</strong>
832
- </link>
833
- </label>
834
- <subject>Encoding of logical models</subject>
835
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
836
- <inherit>urn:iso:dis:iso:19156:clause:7.2.2</inherit>
837
- <inherit>urn:iso:dis:iso:19156:clause:8</inherit>
838
- <inherit>
839
- <link target='http://www.opengis.net/doc/IS/GML/3.2/clause/2.4'/>
840
- </inherit>
841
- <inherit>O&amp;M Abstract model, OGC 10-004r3, clause D.3.4</inherit>
842
- <inherit>
843
- <link target='http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used'/>
844
- </inherit>
845
- <inherit>
846
- <xref target='ref2'/>
847
- </inherit>
848
- <inherit>
849
- <xref target='ref3'/>
850
- </inherit>
851
- <classification>
852
- <tag>control-class</tag>
853
- <value>Technical</value>
854
- </classification>
855
- <classification>
856
- <tag>domain</tag>
857
- <value>Groundwater</value>
858
- </classification>
859
- <classification>
860
- <tag>domain</tag>
861
- <value>Hydrology</value>
862
- </classification>
863
- <classification>
864
- <tag>priority</tag>
865
- <value>P0</value>
866
- </classification>
867
- <description>
868
- <p id='_'>I recommend this</p>
869
- </description>
870
- </requirement>
871
- </clause>
872
- </sections>
873
- </standard-document>
874
- OUTPUT
875
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
876
- .to be_equivalent_to xmlpp(output)
877
- end
878
-
879
- it "moves inherit macros to correct location" do
880
- input = <<~INPUT
881
- #{ASCIIDOC_BLANK_HDR}
882
-
883
- == Clause
884
-
885
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
886
- .Title
887
- ====
888
- inherit:[A]
889
- inherit:[B]
890
- I recommend this
891
- ====
892
-
893
- [.requirement,subsequence="A",classification="X:Y"]
894
- .Title
895
- ====
896
- inherit:[A]
897
- I recommend this
898
- ====
899
-
900
- [.requirement,subsequence="A"]
901
- .Title
902
- ====
903
- inherit:[A]
904
- I recommend this
905
- ====
906
-
907
- [.requirement,subsequence="A"]
908
- .Title
909
- ====
910
- inherit:[A]
911
- ====
912
-
913
- [.requirement,subsequence="A"]
914
- ====
915
- inherit:[A]
916
- ====
917
-
918
- INPUT
919
- output = <<~OUTPUT
920
- #{BLANK_HDR}
921
- <sections>
922
- <clause id='_' inline-header='false' obligation='normative'>
923
- <title>Clause</title>
924
- <requirement id='_' subsequence='A'>
925
- <title>Title</title>
926
- <inherit>A</inherit>
927
- <inherit>B</inherit>
928
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
929
- <description>
930
- <p id='_'> I recommend this</p>
931
- </description>
932
- </requirement>
933
- <requirement id='_' subsequence='A'>
934
- <title>Title</title>
935
- <inherit>A</inherit>
936
- <classification>
937
- <tag>X</tag>
938
- <value>Y</value>
939
- </classification>
940
- <description>
941
- <p id='_'> I recommend this</p>
942
- </description>
943
- </requirement>
944
- <requirement id='_' subsequence='A'>
945
- <title>Title</title>
946
- <inherit>A</inherit>
947
- <description>
948
- <p id='_'> I recommend this</p>
949
- </description>
950
- </requirement>
951
- <requirement id='_' subsequence='A'>
952
- <title>Title</title>
953
- <inherit>A</inherit>
954
- </requirement>
955
- <requirement id='_' subsequence='A'>
956
- <inherit>A</inherit>
957
- </requirement>
958
- </clause>
959
- </sections>
960
- </standard-document>
961
- OUTPUT
962
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
963
- .to be_equivalent_to xmlpp(output)
964
- end
965
-
966
795
  it "moves %beforeclause admonitions to right position" do
967
796
  input = <<~INPUT
968
797
  #{ASCIIDOC_BLANK_HDR}
@@ -59,6 +59,8 @@ RSpec.describe Metanorma::Standoc do
59
59
  [underline]#underline#
60
60
  [smallcap]#smallcap#
61
61
  [keyword]#keyword#
62
+ [css font-family:"Noto Sans JP"]#text#
63
+ [css font-family:'Noto Sans JP']#text#
62
64
  INPUT
63
65
  output = <<~OUTPUT
64
66
  #{BLANK_HDR}
@@ -80,6 +82,8 @@ RSpec.describe Metanorma::Standoc do
80
82
  <underline>underline</underline>
81
83
  <smallcap>smallcap</smallcap>
82
84
  <keyword>keyword</keyword>
85
+ <span style="font-family:&quot;Noto Sans JP&quot;">text</span>
86
+ <span style="font-family:'Noto Sans JP'">text</span>
83
87
  </sections>
84
88
  </standard-document>
85
89
  OUTPUT