metanorma-iso 2.1.3 → 2.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/iso/html/isodoc-dis.css +1 -10
  3. data/lib/isodoc/iso/html/isodoc-dis.scss +1 -13
  4. data/lib/isodoc/iso/html/isodoc.css +4 -11
  5. data/lib/isodoc/iso/html/isodoc.scss +5 -15
  6. data/lib/isodoc/iso/html/style-human.css +3 -0
  7. data/lib/isodoc/iso/html/style-human.scss +4 -0
  8. data/lib/isodoc/iso/html/style-iso.css +3 -0
  9. data/lib/isodoc/iso/html/style-iso.scss +4 -0
  10. data/lib/isodoc/iso/i18n-en.yaml +1 -1
  11. data/lib/isodoc/iso/iso.amendment.xsl +3611 -2912
  12. data/lib/isodoc/iso/iso.international-standard.xsl +3611 -2912
  13. data/lib/isodoc/iso/metadata.rb +1 -1
  14. data/lib/isodoc/iso/presentation_xml_convert.rb +4 -0
  15. data/lib/isodoc/iso/word_cleanup.rb +50 -19
  16. data/lib/isodoc/iso/word_dis_cleanup.rb +10 -14
  17. data/lib/isodoc/iso/word_dis_convert.rb +1 -1
  18. data/lib/metanorma/iso/base.rb +0 -6
  19. data/lib/metanorma/iso/boilerplate-fr.xml +1 -1
  20. data/lib/metanorma/iso/boilerplate-ru.xml +1 -1
  21. data/lib/metanorma/iso/boilerplate.xml +1 -1
  22. data/lib/metanorma/iso/cleanup.rb +4 -2
  23. data/lib/metanorma/iso/front_id.rb +28 -0
  24. data/lib/metanorma/iso/isodoc.rng +32 -1
  25. data/lib/metanorma/iso/isostandard.rng +3 -1
  26. data/lib/metanorma/iso/reqt.rng +1 -1
  27. data/lib/metanorma/iso/version.rb +1 -1
  28. data/metanorma-iso.gemspec +2 -1
  29. data/spec/isodoc/blocks_spec.rb +3 -3
  30. data/spec/isodoc/metadata_spec.rb +1 -2
  31. data/spec/isodoc/postproc_spec.rb +8 -75
  32. data/spec/isodoc/terms_spec.rb +62 -0
  33. data/spec/isodoc/word_dis_spec.rb +133 -15
  34. data/spec/metanorma/base_spec.rb +6 -17
  35. data/spec/metanorma/blocks_spec.rb +0 -33
  36. data/spec/metanorma/cleanup_spec.rb +201 -201
  37. data/spec/metanorma/processor_spec.rb +1 -2
  38. data/spec/metanorma/refs_spec.rb +5 -3
  39. data/spec/metanorma/section_spec.rb +6 -6
  40. data/spec/spec_helper.rb +1 -1
  41. data/spec/vcr_cassettes/withdrawn_iso.yml +28 -28
  42. metadata +18 -5
  43. data/lib/metanorma/iso/macros.rb +0 -29
@@ -1010,9 +1010,9 @@ RSpec.describe IsoDoc do
1010
1010
  Note
1011
1011
  </p>
1012
1012
  </div>
1013
- <div style='page-break-after:avoid;'>
1013
+ <div class="Figureexample" style='page-break-after:avoid;'>
1014
1014
  <a name='D' id='D'/>
1015
- <p class='Example'>
1015
+ <p class='Figureexample'>
1016
1016
  <span style='mso-tab-count:1'>  </span>
1017
1017
  Example
1018
1018
  </p>
@@ -1687,7 +1687,7 @@ RSpec.describe IsoDoc do
1687
1687
  <span style='mso-tab-count:1'>  </span>
1688
1688
  Example start
1689
1689
  </p>
1690
- <p class='Code--'>X</p>
1690
+ <p class='Code--' style='margin-bottom:12pt;'>X</p>
1691
1691
  <p class='Exampleindentcontinued'>Example continued</p>
1692
1692
  </div>
1693
1693
  <p class='Code-'>X</p>
@@ -1728,7 +1728,7 @@ RSpec.describe IsoDoc do
1728
1728
  <div class='WordSection3'>
1729
1729
  <p class='zzSTDTitle'>
1730
1730
  Date and time — Representations for information interchange —
1731
- <span style='font-weight:normal'>Part 1</span>
1731
+ <span style='font-weight:normal'>Part 1:</span>
1732
1732
  Basic rules
1733
1733
  </p>
1734
1734
  <div>
@@ -1799,7 +1799,7 @@ RSpec.describe IsoDoc do
1799
1799
  <div class='WordSection3'>
1800
1800
  <p class='zzSTDTitle'>
1801
1801
  Date and time — Representations for information interchange —
1802
- <span style='font-weight:normal'>Part 1</span>
1802
+ <span style='font-weight:normal'>Part 1:</span>
1803
1803
  Basic rules
1804
1804
  <span style='font-weight:normal'> AMENDMENT 1: Technical corrections</span>
1805
1805
  </p>
@@ -1842,11 +1842,9 @@ RSpec.describe IsoDoc do
1842
1842
  <br/>
1843
1843
  CH-1214 Vernier, Geneva, Switzerland
1844
1844
  <br/>
1845
- Tel. + 41 22 749 01 11
1845
+ Phone: +41 22 749 01 11
1846
1846
  <br/>
1847
- Fax + 41 22 749 09 47
1848
- <br/>
1849
- copyright@iso.org
1847
+ Email: copyright@iso.org
1850
1848
  <br/>
1851
1849
  www.iso.org</p>
1852
1850
  </clause>
@@ -1896,9 +1894,8 @@ RSpec.describe IsoDoc do
1896
1894
  </p>
1897
1895
  <p class='zzCopyright'> Ch. de Blandonnet 8 ?~@? CP 401 </p>
1898
1896
  <p class='zzCopyright'> CH-1214 Vernier, Geneva, Switzerland </p>
1899
- <p class='zzCopyright'> Tel. + 41 22 749 01 11 </p>
1900
- <p class='zzCopyright'> Fax + 41 22 749 09 47 </p>
1901
- <p class='zzCopyright'> copyright@iso.org </p>
1897
+ <p class='zzCopyright'> Phone: +41 22 749 01 11 </p>
1898
+ <p class='zzCopyright'> Email: copyright@iso.org </p>
1902
1899
  <p class='zzCopyright'> www.iso.org</p>
1903
1900
  </div>
1904
1901
  </div>
@@ -1935,12 +1932,133 @@ RSpec.describe IsoDoc do
1935
1932
  </p>
1936
1933
  <p class='zzCopyright' style='text-indent:20.15pt;'> Ch. de Blandonnet 8 ?~@? CP 401 </p>
1937
1934
  <p class='zzCopyright' style='text-indent:20.15pt;'> CH-1214 Vernier, Geneva, Switzerland </p>
1938
- <p class='zzCopyright' style='text-indent:20.15pt;'> Tel. + 41 22 749 01 11 </p>
1939
- <p class='zzCopyright' style='text-indent:20.15pt;'> Fax + 41 22 749 09 47 </p>
1940
- <p class='zzCopyright' style='text-indent:20.15pt;'> copyright@iso.org </p>
1935
+ <p class='zzCopyright' style='text-indent:20.15pt;'> Phone: +41 22 749 01 11 </p>
1936
+ <p class='zzCopyright' style='text-indent:20.15pt;'> Email: copyright@iso.org </p>
1941
1937
  <p class='zzCopyright' style='text-indent:20.15pt;'> www.iso.org</p>
1942
1938
  </div>
1943
1939
  </div>
1944
1940
  OUTPUT
1945
1941
  end
1942
+
1943
+ it "deals with Simple Template styles" do
1944
+ input = <<~INPUT
1945
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1946
+ <bibdata>
1947
+ <status><stage>20</stage></status>
1948
+ </bibdata>
1949
+ <sections>
1950
+ <clause id="A"><title>Clause Title</title>
1951
+ <ul><li>List</li></ul>
1952
+ <note id="B"><p>Note</p>
1953
+ <ul><li>Note List</li></ul>
1954
+ </note>
1955
+ <example id="C"><p>Example</p>
1956
+ <ul><li>Example List</li></ul>
1957
+ </example>
1958
+ <figure id="D"><name>Figure Title</name></figure>
1959
+ <sourcecode id="E">XYZ</sourcecode>
1960
+ <table id="F"><name>Table</name></table>
1961
+ </clause>
1962
+ </sections>
1963
+ <annex id="G"><title>Annex Title</title>
1964
+ <table id="H"><name>Annex Table</name></table>
1965
+ <clause id="I"><title>Annex Clause Title</title>
1966
+ </clause>
1967
+ </annex>
1968
+ <bibliography>
1969
+ <references id="_normative_references" normative="false" obligation="informative">
1970
+ <title>Bibliography</title>
1971
+ <bibitem id="ISO712" type="standard">
1972
+ <formattedref>ALUFFI, Paolo, ed. (2022). <em><span class="std_class">Facets of Algebraic Geometry: A Collection in Honor of William Fulton's 80th Birthday</span></em>, 1st edition. Cambridge, UK: CUP.</formattedref>
1973
+ <docidentifier type="ISO">ISO/IEC 712-3:2022</docidentifier>
1974
+ </bibitem>
1975
+ </references>
1976
+ </bibliography>
1977
+ </iso-standard>
1978
+ INPUT
1979
+ word = <<~WORD
1980
+ <div class='WordSection3'>
1981
+ <p class='zzSTDTitle1'/>
1982
+ <div>
1983
+ <a name='A' id='A'/>
1984
+ <h1>Clause Title</h1>
1985
+ <p style='mso-list:l3 level1 lfo1;' class='MsoListParagraphCxSpFirst'>List</p>
1986
+ <div class='Note'>
1987
+ <a name='B' id='B'/>
1988
+ <p class='Note'>
1989
+ <span class='note_label'/>
1990
+ <span style='mso-tab-count:1'>  </span>
1991
+ Note
1992
+ </p>
1993
+ <p style='font-size:10.0pt;;mso-list:l3 level1 lfo2;' class='MsoListParagraphCxSpFirst'>Note List</p>
1994
+ </div>
1995
+ <div class='Example'>
1996
+ <a name='C' id='C'/>
1997
+ <p class='Example'>
1998
+ <span style='mso-tab-count:1'>  </span>
1999
+ Example
2000
+ </p>
2001
+ <p style='font-size:10.0pt;;mso-list:l3 level1 lfo3;' class='MsoListParagraphCxSpFirst'>Example List</p>
2002
+ </div>
2003
+ <div class='MsoNormal' style='text-align:center;'>
2004
+ <a name='D' id='D'/>
2005
+ <p class='FigureTitle' style='text-align:center;'>Figure Title</p>
2006
+ </div>
2007
+ <p class='Code'>
2008
+ <a name='E' id='E'/>
2009
+ XYZ
2010
+ </p>
2011
+ <p class='Tabletitle' style='text-align:center;'>Table</p>
2012
+ <div align='center' class='table_container'>
2013
+ <table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
2014
+ <a name='F' id='F'/>
2015
+ </table>
2016
+ </div>
2017
+ </div>
2018
+ <p class='MsoNormal'>
2019
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
2020
+ </p>
2021
+ <div class='Section3'>
2022
+ <a name='G' id='G'/>
2023
+ <p class='ANNEX'>Annex Title</p>
2024
+ <p class='AnnexTableTitle' style='text-align:center;'>Annex Table</p>
2025
+ <div align='center' class='table_container'>
2026
+ <table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
2027
+ <a name='H' id='H'/>
2028
+ </table>
2029
+ </div>
2030
+ <div>
2031
+ <a name='I' id='I'/>
2032
+ <p class='a2'>Annex Clause Title</p>
2033
+ </div>
2034
+ </div>
2035
+ <p class='MsoNormal'>
2036
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
2037
+ </p>
2038
+ <div>
2039
+ <p class='BiblioTitle'>Bibliography</p>
2040
+ <p class='MsoNormal'>
2041
+ <a name='ISO712' id='ISO712'/>
2042
+ [1]
2043
+ <span style='mso-tab-count:1'>  </span>
2044
+ ISO/IEC 712-3:2022, ALUFFI, Paolo, ed. (2022).
2045
+ <i>
2046
+ Facets of Algebraic Geometry: A Collection in Honor of William Fulton's
2047
+ 80th Birthday
2048
+ </i>
2049
+ , 1st edition. Cambridge, UK: CUP.
2050
+ </p>
2051
+ </div>
2052
+ </div>
2053
+ WORD
2054
+ FileUtils.rm_f "test.doc"
2055
+ IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
2056
+ expect(File.exist?("test.doc")).to be true
2057
+ output = File.read("test.doc", encoding: "UTF-8")
2058
+ .sub(/^.*<html/m, "<html")
2059
+ .sub(/<\/html>.*$/m, "</html>")
2060
+ expect(strip_guid(xmlpp(Nokogiri::XML(output)
2061
+ .at("//xmlns:div[@class = 'WordSection3']").to_xml)))
2062
+ .to be_equivalent_to xmlpp(word)
2063
+ end
1946
2064
  end
@@ -1008,14 +1008,11 @@ RSpec.describe Metanorma::ISO do
1008
1008
  <title type='title-intro' format='text/plain' language='en' script='Latn'>Rubber latex</title>
1009
1009
  <title type='title-main' format='text/plain' language='en' script='Latn'>Sampling</title>
1010
1010
  <title type='main' format='text/plain' language='en' script='Latn'>Rubber latex&#8201;&#8212;&#8201;Sampling</title>
1011
- <title type='title-intro' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc</title>
1012
- <title type='title-main' format='text/plain' language='fr' script='Latn'>&#201;chantillonnage</title>
1013
- <title type='main' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc&#8201;&#8212;&#8201;&#201;chantillonnage</title>
1014
1011
  <uri type='src'>https://www.iso.org/standard/23281.html</uri>
1015
1012
  <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
1016
1013
  <uri type='rss'>https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
1017
1014
  <docidentifier type='ISO' primary="true">ISO 123:2001</docidentifier>
1018
- <docidentifier type='URN'>urn:iso:std:iso:123:stage-90.93:ed-3:en,fr</docidentifier>
1015
+ <docidentifier type='URN'>urn:iso:std:iso:123:stage-90.93:ed-3</docidentifier>
1019
1016
  <docnumber>123</docnumber>
1020
1017
  <date type='published'><on>2001-05</on></date>
1021
1018
  <contributor>
@@ -1028,7 +1025,6 @@ RSpec.describe Metanorma::ISO do
1028
1025
  </contributor>
1029
1026
  <edition>3</edition>
1030
1027
  <language>en</language>
1031
- <language>fr</language>
1032
1028
  <script>Latn</script>
1033
1029
  <abstract format='text/plain' language='en' script='Latn'>
1034
1030
  This International Standard specifies procedures for sampling natural
@@ -1036,16 +1032,6 @@ RSpec.describe Metanorma::ISO do
1036
1032
  artificial latices. It is also suitable for sampling rubber latex
1037
1033
  contained in drums, tank cars or tanks. The procedures may also be
1038
1034
  used for sampling plastics dispersions.
1039
- </abstract>
1040
- <abstract format='text/plain' language='fr' script='Latn'>
1041
- La pr&#233;sente Norme internationale sp&#233;cifie des m&#233;thodes
1042
- d&#8217;&#233;chantillonnage pour des concentr&#233;s de latex de
1043
- caoutchouc naturel et pour &#233;chantillonner des latex de caoutchouc
1044
- synth&#233;tique et des latex artificiels. Elle s&#8217;applique
1045
- &#233;galement &#224; l&#8217;&#233;chantillonnage de latex de
1046
- caoutchouc contenus dans des f&#251;ts, citernes routi&#232;res ou de
1047
- stockage. Le mode op&#233;ratoire peut aussi &#234;tre utilis&#233;
1048
- pour l&#8217;&#233;chantillonnage de dispersions de plastiques.
1049
1035
  </abstract>
1050
1036
  <status>
1051
1037
  <stage>90</stage>
@@ -1062,6 +1048,7 @@ RSpec.describe Metanorma::ISO do
1062
1048
  <relation type='obsoletes'>
1063
1049
  <bibitem type='standard'>
1064
1050
  <formattedref format='text/plain'>ISO 123:1985</formattedref>
1051
+ <docidentifier type='ISO' primary='true'>ISO 123:1985</docidentifier>
1065
1052
  </bibitem>
1066
1053
  </relation>
1067
1054
  <place>Geneva</place>
@@ -1088,7 +1075,7 @@ RSpec.describe Metanorma::ISO do
1088
1075
  <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:72849:en</uri>
1089
1076
  <uri type='rss'>https://www.iso.org/contents/data/standard/07/28/72849.detail.rss</uri>
1090
1077
  <docidentifier type='ISO' primary="true">ISO 125</docidentifier>
1091
- <docidentifier type='URN'>urn:iso:std:iso:125:stage-60.60:ed-7:en,fr</docidentifier>
1078
+ <docidentifier type='URN'>urn:iso:std:iso:125:stage-60.60:ed-7</docidentifier>
1092
1079
  <docnumber>125</docnumber>
1093
1080
  <contributor>
1094
1081
  <role type='publisher'/>
@@ -1117,6 +1104,7 @@ RSpec.describe Metanorma::ISO do
1117
1104
  <relation type='obsoletes'>
1118
1105
  <bibitem type='standard'>
1119
1106
  <formattedref format='text/plain'>ISO 125:2011</formattedref>
1107
+ <docidentifier type='ISO' primary='true'>ISO 125:2011</docidentifier>
1120
1108
  </bibitem>
1121
1109
  </relation>
1122
1110
  <relation type='instance'>
@@ -1139,7 +1127,7 @@ RSpec.describe Metanorma::ISO do
1139
1127
  <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:72849:en</uri>
1140
1128
  <uri type='rss'>https://www.iso.org/contents/data/standard/07/28/72849.detail.rss</uri>
1141
1129
  <docidentifier type='ISO' primary="true">ISO 125:2020</docidentifier>
1142
- <docidentifier type='URN'>urn:iso:std:iso:125:stage-60.60:ed-7:en,fr</docidentifier>
1130
+ <docidentifier type='URN'>urn:iso:std:iso:125:stage-60.60:ed-7</docidentifier>
1143
1131
  <docnumber>125</docnumber>
1144
1132
  <date type='published'>
1145
1133
  <on>2020-02</on>
@@ -1192,6 +1180,7 @@ RSpec.describe Metanorma::ISO do
1192
1180
  <relation type='obsoletes'>
1193
1181
  <bibitem type='standard'>
1194
1182
  <formattedref format='text/plain'>ISO 125:2011</formattedref>
1183
+ <docidentifier type='ISO' primary='true'>ISO 125:2011</docidentifier>
1195
1184
  </bibitem>
1196
1185
  </relation>
1197
1186
  <place>Geneva</place>
@@ -621,37 +621,4 @@ RSpec.describe Metanorma::ISO do
621
621
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
622
622
  .to be_equivalent_to xmlpp(output)
623
623
  end
624
-
625
- it "processes the macro for editorial notes" do
626
- input = <<~INPUT
627
- #{ASCIIDOC_BLANK_HDR}
628
- EDITOR: Note1
629
-
630
- [EDITOR]
631
- ====
632
- Note2
633
- ====
634
-
635
- [EDITOR]
636
- Note3
637
- INPUT
638
- output = <<~OUTPUT
639
- #{BLANK_HDR}
640
- <sections>
641
- <admonition id='_' type='editorial'>
642
- <p id='_'>Note1</p>
643
- </admonition>
644
- <admonition id='_' type='editorial'>
645
- <p id='_'>Note2</p>
646
- </admonition>
647
- <admonition id='_' type='editorial'>
648
- <p id='_'>Note3</p>
649
- </admonition>
650
- </sections>
651
- </iso-standard>
652
- OUTPUT
653
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
654
- .to be_equivalent_to xmlpp(output)
655
- end
656
-
657
624
  end