metanorma-iso 2.1.4 → 2.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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>
@@ -1943,4 +1943,126 @@ RSpec.describe IsoDoc do
1943
1943
  </div>
1944
1944
  OUTPUT
1945
1945
  end
1946
+
1947
+ it "deals with Simple Template styles" do
1948
+ input = <<~INPUT
1949
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1950
+ <bibdata>
1951
+ <status><stage>20</stage></status>
1952
+ </bibdata>
1953
+ <sections>
1954
+ <clause id="A"><title>Clause Title</title>
1955
+ <ul><li>List</li></ul>
1956
+ <note id="B"><p>Note</p>
1957
+ <ul><li>Note List</li></ul>
1958
+ </note>
1959
+ <example id="C"><p>Example</p>
1960
+ <ul><li>Example List</li></ul>
1961
+ </example>
1962
+ <figure id="D"><name>Figure Title</name></figure>
1963
+ <sourcecode id="E">XYZ</sourcecode>
1964
+ <table id="F"><name>Table</name></table>
1965
+ </clause>
1966
+ </sections>
1967
+ <annex id="G"><title>Annex Title</title>
1968
+ <table id="H"><name>Annex Table</name></table>
1969
+ <clause id="I"><title>Annex Clause Title</title>
1970
+ </clause>
1971
+ </annex>
1972
+ <bibliography>
1973
+ <references id="_normative_references" normative="false" obligation="informative">
1974
+ <title>Bibliography</title>
1975
+ <bibitem id="ISO712" type="standard">
1976
+ <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>
1977
+ <docidentifier type="ISO">ISO/IEC 712-3:2022</docidentifier>
1978
+ </bibitem>
1979
+ </references>
1980
+ </bibliography>
1981
+ </iso-standard>
1982
+ INPUT
1983
+ word = <<~WORD
1984
+ <div class='WordSection3'>
1985
+ <p class='zzSTDTitle1'/>
1986
+ <div>
1987
+ <a name='A' id='A'/>
1988
+ <h1>Clause Title</h1>
1989
+ <p style='mso-list:l3 level1 lfo1;' class='MsoListParagraphCxSpFirst'>List</p>
1990
+ <div class='Note'>
1991
+ <a name='B' id='B'/>
1992
+ <p class='Note'>
1993
+ <span class='note_label'/>
1994
+ <span style='mso-tab-count:1'>  </span>
1995
+ Note
1996
+ </p>
1997
+ <p style='font-size:10.0pt;;mso-list:l3 level1 lfo2;' class='MsoListParagraphCxSpFirst'>Note List</p>
1998
+ </div>
1999
+ <div class='Example'>
2000
+ <a name='C' id='C'/>
2001
+ <p class='Example'>
2002
+ <span style='mso-tab-count:1'>  </span>
2003
+ Example
2004
+ </p>
2005
+ <p style='font-size:10.0pt;;mso-list:l3 level1 lfo3;' class='MsoListParagraphCxSpFirst'>Example List</p>
2006
+ </div>
2007
+ <div class='MsoNormal' style='text-align:center;'>
2008
+ <a name='D' id='D'/>
2009
+ <p class='FigureTitle' style='text-align:center;'>Figure Title</p>
2010
+ </div>
2011
+ <p class='Code'>
2012
+ <a name='E' id='E'/>
2013
+ XYZ
2014
+ </p>
2015
+ <p class='Tabletitle' style='text-align:center;'>Table</p>
2016
+ <div align='center' class='table_container'>
2017
+ <table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
2018
+ <a name='F' id='F'/>
2019
+ </table>
2020
+ </div>
2021
+ </div>
2022
+ <p class='MsoNormal'>
2023
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
2024
+ </p>
2025
+ <div class='Section3'>
2026
+ <a name='G' id='G'/>
2027
+ <p class='ANNEX'>Annex Title</p>
2028
+ <p class='AnnexTableTitle' style='text-align:center;'>Annex Table</p>
2029
+ <div align='center' class='table_container'>
2030
+ <table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
2031
+ <a name='H' id='H'/>
2032
+ </table>
2033
+ </div>
2034
+ <div>
2035
+ <a name='I' id='I'/>
2036
+ <p class='a2'>Annex Clause Title</p>
2037
+ </div>
2038
+ </div>
2039
+ <p class='MsoNormal'>
2040
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
2041
+ </p>
2042
+ <div>
2043
+ <p class='BiblioTitle'>Bibliography</p>
2044
+ <p class='MsoNormal'>
2045
+ <a name='ISO712' id='ISO712'/>
2046
+ [1]
2047
+ <span style='mso-tab-count:1'>  </span>
2048
+ ISO/IEC 712-3:2022, ALUFFI, Paolo, ed. (2022).
2049
+ <i>
2050
+ Facets of Algebraic Geometry: A Collection in Honor of William Fulton's
2051
+ 80th Birthday
2052
+ </i>
2053
+ , 1st edition. Cambridge, UK: CUP.
2054
+ </p>
2055
+ </div>
2056
+ </div>
2057
+ WORD
2058
+ FileUtils.rm_f "test.doc"
2059
+ IsoDoc::Iso::WordConvert.new({}).convert("test", input, false)
2060
+ expect(File.exist?("test.doc")).to be true
2061
+ output = File.read("test.doc", encoding: "UTF-8")
2062
+ .sub(/^.*<html/m, "<html")
2063
+ .sub(/<\/html>.*$/m, "</html>")
2064
+ expect(strip_guid(xmlpp(Nokogiri::XML(output)
2065
+ .at("//xmlns:div[@class = 'WordSection3']").to_xml)))
2066
+ .to be_equivalent_to xmlpp(word)
2067
+ end
1946
2068
  end
@@ -1015,7 +1015,7 @@ RSpec.describe Metanorma::ISO do
1015
1015
  <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
1016
1016
  <uri type='rss'>https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
1017
1017
  <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>
1018
+ <docidentifier type='URN'>urn:iso:std:iso:123:stage-90.93:ed-3</docidentifier>
1019
1019
  <docnumber>123</docnumber>
1020
1020
  <date type='published'><on>2001-05</on></date>
1021
1021
  <contributor>
@@ -1062,6 +1062,7 @@ RSpec.describe Metanorma::ISO do
1062
1062
  <relation type='obsoletes'>
1063
1063
  <bibitem type='standard'>
1064
1064
  <formattedref format='text/plain'>ISO 123:1985</formattedref>
1065
+ <docidentifier type='ISO' primary='true'>ISO 123:1985</docidentifier>
1065
1066
  </bibitem>
1066
1067
  </relation>
1067
1068
  <place>Geneva</place>
@@ -1088,7 +1089,7 @@ RSpec.describe Metanorma::ISO do
1088
1089
  <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:72849:en</uri>
1089
1090
  <uri type='rss'>https://www.iso.org/contents/data/standard/07/28/72849.detail.rss</uri>
1090
1091
  <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>
1092
+ <docidentifier type='URN'>urn:iso:std:iso:125:stage-60.60:ed-7</docidentifier>
1092
1093
  <docnumber>125</docnumber>
1093
1094
  <contributor>
1094
1095
  <role type='publisher'/>
@@ -1117,6 +1118,7 @@ RSpec.describe Metanorma::ISO do
1117
1118
  <relation type='obsoletes'>
1118
1119
  <bibitem type='standard'>
1119
1120
  <formattedref format='text/plain'>ISO 125:2011</formattedref>
1121
+ <docidentifier type='ISO' primary='true'>ISO 125:2011</docidentifier>
1120
1122
  </bibitem>
1121
1123
  </relation>
1122
1124
  <relation type='instance'>
@@ -1139,7 +1141,7 @@ RSpec.describe Metanorma::ISO do
1139
1141
  <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:72849:en</uri>
1140
1142
  <uri type='rss'>https://www.iso.org/contents/data/standard/07/28/72849.detail.rss</uri>
1141
1143
  <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>
1144
+ <docidentifier type='URN'>urn:iso:std:iso:125:stage-60.60:ed-7</docidentifier>
1143
1145
  <docnumber>125</docnumber>
1144
1146
  <date type='published'>
1145
1147
  <on>2020-02</on>
@@ -1192,6 +1194,7 @@ RSpec.describe Metanorma::ISO do
1192
1194
  <relation type='obsoletes'>
1193
1195
  <bibitem type='standard'>
1194
1196
  <formattedref format='text/plain'>ISO 125:2011</formattedref>
1197
+ <docidentifier type='ISO' primary='true'>ISO 125:2011</docidentifier>
1195
1198
  </bibitem>
1196
1199
  </relation>
1197
1200
  <place>Geneva</place>
@@ -1240,7 +1240,7 @@ RSpec.describe Metanorma::ISO do
1240
1240
  <title>Terms and definitions</title>
1241
1241
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1242
1242
  <p id='_'>
1243
- ISO and IEC maintain terminological databases for use in standardization
1243
+ ISO and IEC maintain terminology databases for use in standardization
1244
1244
  at the following addresses:
1245
1245
  </p>
1246
1246
  <ul id='_'>
@@ -1289,7 +1289,7 @@ RSpec.describe Metanorma::ISO do
1289
1289
  <title>Terms and definitions</title>
1290
1290
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1291
1291
  <p id='_'>
1292
- ISO and IEC maintain terminological databases for use in standardization
1292
+ ISO and IEC maintain terminology databases for use in standardization
1293
1293
  at the following addresses:
1294
1294
  </p>
1295
1295
  <ul id='_'>
@@ -1353,7 +1353,7 @@ RSpec.describe Metanorma::ISO do
1353
1353
  <title>Terms and definitions</title>
1354
1354
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1355
1355
  <p id='_'>
1356
- ISO and IEC maintain terminological databases for use in
1356
+ ISO and IEC maintain terminology databases for use in
1357
1357
  standardization at the following addresses:
1358
1358
  </p>
1359
1359
  <ul id='_'>
@@ -1420,7 +1420,7 @@ RSpec.describe Metanorma::ISO do
1420
1420
  <title>Terms and definitions</title>
1421
1421
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1422
1422
  <p id='_'>
1423
- ISO and IEC maintain terminological databases for use in
1423
+ ISO and IEC maintain terminology databases for use in
1424
1424
  standardization at the following addresses:
1425
1425
  </p>
1426
1426
  <ul id='_'>
@@ -1478,7 +1478,7 @@ RSpec.describe Metanorma::ISO do
1478
1478
  <terms id='_' obligation='normative'>
1479
1479
  <title>Terms and definitions</title>
1480
1480
  <p id='_'>
1481
- ISO and IEC maintain terminological databases for use in standardization
1481
+ ISO and IEC maintain terminology databases for use in standardization
1482
1482
  at the following addresses:
1483
1483
  </p>
1484
1484
  <ul id='_'>
@@ -410,7 +410,7 @@ RSpec.describe Metanorma::ISO do
410
410
  <uri type='src'>https://www.iso.org/standard/2405.html</uri>
411
411
  <uri type='rss'>https://www.iso.org/contents/data/standard/00/24/2405.detail.rss</uri>
412
412
  <docidentifier type='ISO' primary='true'>ISO 31-0</docidentifier>
413
- <docidentifier type='URN'>urn:iso:std:iso:31:-0:stage-95.99:ed-1:en</docidentifier>
413
+ <docidentifier type='URN'>urn:iso:std:iso:31:-0:stage-95.99:ed-1</docidentifier>
414
414
  <docnumber>31</docnumber>
415
415
  <contributor>
416
416
  <role type='publisher'/>
@@ -447,7 +447,7 @@ RSpec.describe Metanorma::ISO do
447
447
  <uri type='src'>https://www.iso.org/standard/2405.html</uri>
448
448
  <uri type='rss'>https://www.iso.org/contents/data/standard/00/24/2405.detail.rss</uri>
449
449
  <docidentifier type='ISO' primary='true'>ISO 31-0:1974</docidentifier>
450
- <docidentifier type='URN'>urn:iso:std:iso:31:-0:stage-95.99:ed-1:en</docidentifier>
450
+ <docidentifier type='URN'>urn:iso:std:iso:31:-0:stage-95.99:ed-1</docidentifier>
451
451
  <docnumber>31</docnumber>
452
452
  <date type='published'>
453
453
  <on>1974-01</on>
@@ -494,7 +494,7 @@ RSpec.describe Metanorma::ISO do
494
494
  <uri type='src'>https://www.iso.org/standard/76389.html</uri>
495
495
  <uri type='rss'>https://www.iso.org/contents/data/standard/07/63/76389.detail.rss</uri>
496
496
  <docidentifier type='ISO' primary='true'>ISO 683-3:2019</docidentifier>
497
- <docidentifier type='URN'>urn:iso:std:iso:683:-3:stage-95.99:ed-3:en</docidentifier>
497
+ <docidentifier type='URN'>urn:iso:std:iso:683:-3:stage-95.99:ed-3</docidentifier>
498
498
  <docnumber>683</docnumber>
499
499
  <date type='published'>
500
500
  <on>2019-01</on>
@@ -551,11 +551,13 @@ RSpec.describe Metanorma::ISO do
551
551
  <relation type='obsoletes'>
552
552
  <bibitem type='standard'>
553
553
  <formattedref format='text/plain'>ISO 683-3:2016</formattedref>
554
+ <docidentifier type='ISO' primary='true'>ISO 683-3:2016</docidentifier>
554
555
  </bibitem>
555
556
  </relation>
556
557
  <relation type='updates'>
557
558
  <bibitem type='standard'>
558
559
  <formattedref format='text/plain'>ISO 683-3:2022</formattedref>
560
+ <docidentifier type='ISO' primary='true'>ISO 683-3:2022</docidentifier>
559
561
  <date type='circulated'>
560
562
  <on>2022-01-21</on>
561
563
  </date>
@@ -81,7 +81,7 @@ RSpec.describe Metanorma::ISO do
81
81
  <terms id="_" obligation="normative">
82
82
  <title>Terms and definitions</title>
83
83
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
84
- <p id="_">ISO and IEC maintain terminological databases for use in standardization at the following addresses:</p>
84
+ <p id="_">ISO and IEC maintain terminology databases for use in standardization at the following addresses:</p>
85
85
  <ul id="_">
86
86
  <li>
87
87
  <p id="_">ISO Online browsing platform: available at
@@ -275,7 +275,7 @@ RSpec.describe Metanorma::ISO do
275
275
  given in <eref bibitemid="iso1234"/>
276
276
  and <eref bibitemid="iso5678"/>
277
277
  and the following apply.</p>
278
- <p id="_">ISO and IEC maintain terminological databases for use in
278
+ <p id="_">ISO and IEC maintain terminology databases for use in
279
279
  standardization at the following addresses:</p>
280
280
  <ul id="_">
281
281
  <li>
@@ -321,7 +321,7 @@ RSpec.describe Metanorma::ISO do
321
321
  <title>Terms and definitions</title>
322
322
  <p id='_'>No terms and definitions are listed in this document.</p>
323
323
  <p id='_'>
324
- ISO and IEC maintain terminological databases for use in standardization
324
+ ISO and IEC maintain terminology databases for use in standardization
325
325
  at the following addresses:
326
326
  </p>
327
327
  <ul id='_'>
@@ -373,7 +373,7 @@ RSpec.describe Metanorma::ISO do
373
373
  and <eref bibitemid="iso5678"/>
374
374
  apply.
375
375
  </p>
376
- <p id="_">ISO and IEC maintain terminological databases for use in standardization at the following addresses:</p>
376
+ <p id="_">ISO and IEC maintain terminology databases for use in standardization at the following addresses:</p>
377
377
  <ul id="_">
378
378
  <li>
379
379
  <p id="_">ISO Online browsing platform: available at
@@ -411,7 +411,7 @@ RSpec.describe Metanorma::ISO do
411
411
  <title>Terms and definitions</title>
412
412
  <p id='_'>No terms and definitions are listed in this document.</p>
413
413
  <p id='_'>
414
- ISO and IEC maintain terminological databases for use in standardization
414
+ ISO and IEC maintain terminology databases for use in standardization
415
415
  at the following addresses:
416
416
  </p>
417
417
  <ul id='_'>
@@ -461,7 +461,7 @@ RSpec.describe Metanorma::ISO do
461
461
  <terms id='_' obligation='normative'>
462
462
  <title>Terms and Definitions</title>
463
463
  <p id='_'>No terms and definitions are listed in this document.</p>
464
- <p id='_'>ISO and IEC maintain terminological databases for use in standardization
464
+ <p id='_'>ISO and IEC maintain terminology databases for use in standardization
465
465
  at the following addresses:
466
466
  </p>
467
467
  <ul id='_'>
data/spec/spec_helper.rb CHANGED
@@ -225,7 +225,7 @@ HDR
225
225
  TERM_BOILERPLATE = <<~TERM.freeze
226
226
  <p id="_">For the purposes of this document,
227
227
  the following terms and definitions apply.</p>
228
- <p id="_">ISO and IEC maintain terminological databases for use in
228
+ <p id="_">ISO and IEC maintain terminology databases for use in
229
229
  standardization at the following addresses:</p>
230
230
 
231
231
  <ul id="_">