metanorma-standoc 2.2.0.1 → 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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/base.rb +12 -0
  3. data/lib/metanorma/standoc/blocks.rb +26 -13
  4. data/lib/metanorma/standoc/cleanup_biblio.rb +14 -8
  5. data/lib/metanorma/standoc/cleanup_reqt.rb +3 -136
  6. data/lib/metanorma/standoc/front_contributor.rb +0 -10
  7. data/lib/metanorma/standoc/reqt.rb +19 -75
  8. data/lib/metanorma/standoc/section.rb +35 -3
  9. data/lib/metanorma/standoc/utils.rb +9 -43
  10. data/lib/metanorma/standoc/version.rb +1 -1
  11. data/metanorma-standoc.gemspec +2 -2
  12. data/spec/metanorma/biblio_spec.rb +8 -8
  13. data/spec/metanorma/blocks_spec.rb +20 -266
  14. data/spec/metanorma/cleanup_blocks_spec.rb +0 -168
  15. data/spec/metanorma/macros_concept_spec.rb +1033 -0
  16. data/spec/metanorma/macros_spec.rb +0 -1030
  17. data/spec/metanorma/reqt_spec.rb +130 -0
  18. data/spec/metanorma/section_spec.rb +5 -0
  19. data/spec/vcr_cassettes/bsi16341.yml +52 -36
  20. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +88 -88
  21. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +10 -10
  22. data/spec/vcr_cassettes/hide_refs.yml +65 -65
  23. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  24. data/spec/vcr_cassettes/isobib_get_123_1.yml +22 -22
  25. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +30 -30
  26. data/spec/vcr_cassettes/isobib_get_123_2.yml +21 -21
  27. data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -11
  28. data/spec/vcr_cassettes/isobib_get_124.yml +11 -11
  29. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +34 -58
  30. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +45 -45
  31. data/spec/vcr_cassettes/std-link.yml +11 -11
  32. metadata +9 -7
@@ -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)
@@ -1616,252 +1616,6 @@ RSpec.describe Metanorma::Standoc do
1616
1616
  .to be_equivalent_to xmlpp(output)
1617
1617
  end
1618
1618
 
1619
- it "processes recommendation" do
1620
- input = <<~"INPUT"
1621
- #{ASCIIDOC_BLANK_HDR}
1622
- [.recommendation,identifier="/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]
1623
- ====
1624
- I recommend this
1625
- ====
1626
- INPUT
1627
- output = <<~"OUTPUT"
1628
- #{BLANK_HDR}
1629
- <sections>
1630
- <recommendation id="_" unnumbered="true" type="verification" model="ogc" tag='X' multilingual-rendering='common'>
1631
- <identifier>/ogc/recommendation/wfs/2</identifier>
1632
- <subject>user</subject>
1633
- <subject>developer, implementer</subject>
1634
- <inherit>/ss/584/2015/level/1</inherit>
1635
- <inherit>/ss/584/2015/level/2</inherit>
1636
- <description><p id="_">I recommend this</p>
1637
- </description>
1638
- </recommendation>
1639
- </sections>
1640
- </standard-document>
1641
- OUTPUT
1642
-
1643
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1644
- .to be_equivalent_to xmlpp(output)
1645
- end
1646
-
1647
- it "processes requirement" do
1648
- input = <<~"INPUT"
1649
- #{ASCIIDOC_BLANK_HDR}
1650
- [[ABC]]
1651
- [.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]
1652
- .Title
1653
- ====
1654
- I recommend this
1655
-
1656
- . http://www.example.com[]
1657
- . <<ABC>>
1658
- ====
1659
- INPUT
1660
- output = <<~OUTPUT
1661
- #{BLANK_HDR}
1662
- <sections>
1663
- <requirement id="ABC" subsequence="A" number="3" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
1664
- <title>Title</title>
1665
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
1666
- <description><p id="_">I recommend this</p>
1667
- <ol id='_' type='arabic'>
1668
- <li>
1669
- <p id='_'>
1670
- <link target='http://www.example.com'/>
1671
- </p>
1672
- </li>
1673
- <li>
1674
- <p id='_'>
1675
- <xref target='ABC'/>
1676
- </p>
1677
- </li>
1678
- </ol>
1679
- </description>
1680
- </requirement>
1681
- </sections>
1682
- </standard-document>
1683
- OUTPUT
1684
-
1685
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1686
- .to be_equivalent_to xmlpp(output)
1687
- end
1688
-
1689
- it "processes permission" do
1690
- input = <<~"INPUT"
1691
- #{ASCIIDOC_BLANK_HDR}
1692
-
1693
- [[ABC]]
1694
- [.permission,tag=X,multilingual-rendering=common]
1695
- ====
1696
- I recommend this
1697
- ====
1698
- INPUT
1699
- output = <<~"OUTPUT"
1700
- #{BLANK_HDR}
1701
- <sections>
1702
- <permission id="ABC" tag='X' multilingual-rendering='common'>
1703
- <description><p id="_">I recommend this</p></description>
1704
- </permission>
1705
- </sections>
1706
- </standard-document>
1707
- OUTPUT
1708
-
1709
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1710
- .to be_equivalent_to xmlpp(output)
1711
- end
1712
-
1713
- it "processes nested permissions" do
1714
- input = <<~"INPUT"
1715
- #{ASCIIDOC_BLANK_HDR}
1716
- [.permission]
1717
- ====
1718
- I permit this
1719
-
1720
- =====
1721
- Example 2
1722
- =====
1723
-
1724
- [.permission]
1725
- =====
1726
- I also permit this
1727
-
1728
- . List
1729
- . List
1730
- =====
1731
-
1732
- [requirement,type="general",identifier="/req/core/quantities-uom"]
1733
- ======
1734
- ======
1735
- ====
1736
- INPUT
1737
- output = <<~"OUTPUT"
1738
- #{BLANK_HDR}
1739
- <sections>
1740
- <permission id="_"><description><p id="_">I permit this</p>
1741
- <example id="_">
1742
- <p id="_">Example 2</p>
1743
- </example></description>
1744
- <permission id="_">
1745
- <description><p id="_">I also permit this</p>
1746
- <ol id='_' type='arabic'>
1747
- <li>
1748
- <p id='_'>List</p>
1749
- </li>
1750
- <li>
1751
- <p id='_'>List</p>
1752
- </li>
1753
- </ol>
1754
- </description>
1755
- </permission>
1756
- <requirement id='_' type='general'>
1757
- <identifier>/req/core/quantities-uom</identifier>
1758
- </requirement>
1759
- </permission>
1760
- </sections>
1761
- </standard-document>
1762
- OUTPUT
1763
-
1764
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1765
- .to be_equivalent_to xmlpp(output)
1766
- end
1767
-
1768
- it "processes recommendation with internal markup of structure" do
1769
- input = <<~"INPUT"
1770
- #{ASCIIDOC_BLANK_HDR}
1771
-
1772
- [[ABC]]
1773
- [.recommendation,identifier="/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"]
1774
- ====
1775
- I recommend _this_.
1776
-
1777
- [.specification,type="tabular",keep-with-next=true,keep-lines-together=true]
1778
- --
1779
- This is the object of the recommendation:
1780
- |===
1781
- |Object |Value
1782
- |Mission | Accomplished
1783
- |===
1784
- --
1785
-
1786
- As for the measurement targets,
1787
-
1788
- [.measurement-target]
1789
- --
1790
- The measurement target shall be measured as:
1791
- [stem]
1792
- ++++
1793
- r/1 = 0
1794
- ++++
1795
- --
1796
-
1797
- [.verification]
1798
- --
1799
- The following code will be run for verification:
1800
-
1801
- [source,CoreRoot]
1802
- ----
1803
- CoreRoot(success): HttpResponse
1804
- if (success)
1805
- recommendation(label: success-response)
1806
- end
1807
- ----
1808
- --
1809
-
1810
- [.import%exclude]
1811
- --
1812
- [source,CoreRoot]
1813
- ----
1814
- success-response()
1815
- ----
1816
- --
1817
-
1818
- [.component]
1819
- --
1820
- Hello
1821
- --
1822
-
1823
- [.component,class=condition]
1824
- --
1825
- If this be thus
1826
- --
1827
- ====
1828
- INPUT
1829
- output = <<~"OUTPUT"
1830
- #{BLANK_HDR}
1831
- <sections>
1832
- <recommendation id="ABC" obligation="permission,recommendation" filename="reqt1.rq"><identifier>/ogc/recommendation/wfs/2</identifier><subject>user</subject>
1833
- <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>
1834
- <description><p id="_">I recommend <em>this</em>.</p>
1835
- </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>
1836
- <p id="_">As for the measurement targets,</p>
1837
- </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>
1838
- <mrow>
1839
- <mi>r</mi>
1840
- </mrow>
1841
- <mrow>
1842
- <mn>1</mn>
1843
- </mrow>
1844
- </mfrac><mo>=</mo><mn>0</mn></math></stem></formula></measurement-target>
1845
- <verification exclude="false"><p id="_">The following code will be run for verification:</p><sourcecode lang="CoreRoot" id="_">CoreRoot(success): HttpResponse
1846
- if (success)
1847
- recommendation(label: success-response)
1848
- end</sourcecode></verification>
1849
- <import exclude="true"> <sourcecode lang="CoreRoot" id="_">success-response()</sourcecode></import>
1850
- <component exclude='false' class='component'>
1851
- <p id='_'>Hello</p>
1852
- </component>
1853
- <component exclude='false' class='condition'>
1854
- <p id='_'>If this be thus</p>
1855
- </component>
1856
- </recommendation>
1857
- </sections>
1858
- </standard-document>
1859
- OUTPUT
1860
-
1861
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1862
- .to be_equivalent_to xmlpp(output)
1863
- end
1864
-
1865
1619
  it "processes delete change clauses" do
1866
1620
  input = <<~"INPUT"
1867
1621
  #{ASCIIDOC_BLANK_HDR}
@@ -792,174 +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
- identifier:: 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
- target:: http://www.example.com
816
- classification:: priority:P0
817
- classification:: domain:Hydrology,Groundwater
818
- classification:: control-class:Technical
819
- obligation:: recommendation,requirement
820
-
821
- I recommend this
822
- ====
823
- INPUT
824
- output = <<~OUTPUT
825
- #{BLANK_HDR}
826
- <sections>
827
- <clause id='_' inline-header='false' obligation='normative'>
828
- <title>Clause</title>
829
- <requirement id='_' subsequence='A' obligation='recommendation,requirement' model='ogc' type='class'>
830
- <identifier>http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules</identifier>
831
- <subject>Encoding of logical models</subject>
832
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
833
- <inherit>urn:iso:dis:iso:19156:clause:7.2.2</inherit>
834
- <inherit>urn:iso:dis:iso:19156:clause:8</inherit>
835
- <inherit>http://www.opengis.net/doc/IS/GML/3.2/clause/2.4</inherit>
836
- <inherit>O&amp;M Abstract model, OGC 10-004r3, clause D.3.4</inherit>
837
- <inherit>http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used</inherit>
838
- <inherit>
839
- <xref target='ref2'/>
840
- </inherit>
841
- <inherit>
842
- <xref target='ref3'/>
843
- </inherit>
844
- <classification>
845
- <tag>priority</tag>
846
- <value>P0</value>
847
- </classification>
848
- <classification>
849
- <tag>domain</tag>
850
- <value>Hydrology</value>
851
- </classification>
852
- <classification>
853
- <tag>domain</tag>
854
- <value>Groundwater</value>
855
- </classification>
856
- <classification>
857
- <tag>control-class</tag>
858
- <value>Technical</value>
859
- </classification>
860
- <classification>
861
- <tag>target</tag>
862
- <value><link target='http://www.example.com'/></value>
863
- </classification>
864
- <description>
865
- <p id='_'>I recommend this</p>
866
- </description>
867
- </requirement>
868
- </clause>
869
- </sections>
870
- </standard-document>
871
- OUTPUT
872
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
873
- .to be_equivalent_to xmlpp(output)
874
- end
875
-
876
- it "moves inherit macros to correct location" do
877
- input = <<~INPUT
878
- #{ASCIIDOC_BLANK_HDR}
879
-
880
- == Clause
881
-
882
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
883
- .Title
884
- ====
885
- inherit:[A]
886
- inherit:[B]
887
- I recommend this
888
- ====
889
-
890
- [.requirement,subsequence="A",classification="X:Y"]
891
- .Title
892
- ====
893
- inherit:[A]
894
- I recommend this
895
- ====
896
-
897
- [.requirement,subsequence="A"]
898
- .Title
899
- ====
900
- inherit:[A]
901
- I recommend this
902
- ====
903
-
904
- [.requirement,subsequence="A"]
905
- .Title
906
- ====
907
- inherit:[A]
908
- ====
909
-
910
- [.requirement,subsequence="A"]
911
- ====
912
- inherit:[A]
913
- ====
914
-
915
- INPUT
916
- output = <<~OUTPUT
917
- #{BLANK_HDR}
918
- <sections>
919
- <clause id='_' inline-header='false' obligation='normative'>
920
- <title>Clause</title>
921
- <requirement id='_' subsequence='A'>
922
- <title>Title</title>
923
- <inherit>A</inherit>
924
- <inherit>B</inherit>
925
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
926
- <description>
927
- <p id='_'> I recommend this</p>
928
- </description>
929
- </requirement>
930
- <requirement id='_' subsequence='A'>
931
- <title>Title</title>
932
- <inherit>A</inherit>
933
- <classification>
934
- <tag>X</tag>
935
- <value>Y</value>
936
- </classification>
937
- <description>
938
- <p id='_'> I recommend this</p>
939
- </description>
940
- </requirement>
941
- <requirement id='_' subsequence='A'>
942
- <title>Title</title>
943
- <inherit>A</inherit>
944
- <description>
945
- <p id='_'> I recommend this</p>
946
- </description>
947
- </requirement>
948
- <requirement id='_' subsequence='A'>
949
- <title>Title</title>
950
- <inherit>A</inherit>
951
- </requirement>
952
- <requirement id='_' subsequence='A'>
953
- <inherit>A</inherit>
954
- </requirement>
955
- </clause>
956
- </sections>
957
- </standard-document>
958
- OUTPUT
959
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
960
- .to be_equivalent_to xmlpp(output)
961
- end
962
-
963
795
  it "moves %beforeclause admonitions to right position" do
964
796
  input = <<~INPUT
965
797
  #{ASCIIDOC_BLANK_HDR}