metanorma-iso 2.0.8 → 2.1.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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/html2doc/lists.rb +37 -0
  3. data/lib/isodoc/iso/base_convert.rb +1 -1
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +5 -0
  5. data/lib/isodoc/iso/html/isodoc-dis.css +304 -242
  6. data/lib/isodoc/iso/html/isodoc-dis.scss +379 -260
  7. data/lib/isodoc/iso/html/word_iso_intro-dis.html +7 -0
  8. data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +4 -3
  9. data/lib/isodoc/iso/html/word_iso_titlepage.html +10 -4
  10. data/lib/isodoc/iso/html/wordstyle-dis.css +168 -48
  11. data/lib/isodoc/iso/html/wordstyle-dis.scss +158 -43
  12. data/lib/isodoc/iso/html_convert.rb +2 -2
  13. data/lib/isodoc/iso/i18n-en.yaml +1 -0
  14. data/lib/isodoc/iso/i18n-fr.yaml +1 -0
  15. data/lib/isodoc/iso/i18n-ru.yaml +1 -0
  16. data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -0
  17. data/lib/isodoc/iso/init.rb +17 -1
  18. data/lib/isodoc/iso/iso.amendment.xsl +1697 -426
  19. data/lib/isodoc/iso/iso.international-standard.xsl +1697 -426
  20. data/lib/isodoc/iso/metadata.rb +13 -19
  21. data/lib/isodoc/iso/presentation_inline.rb +90 -0
  22. data/lib/isodoc/iso/presentation_xml_convert.rb +41 -100
  23. data/lib/isodoc/iso/presentation_xref.rb +126 -0
  24. data/lib/isodoc/iso/sections.rb +2 -2
  25. data/lib/isodoc/iso/word_cleanup.rb +16 -2
  26. data/lib/isodoc/iso/word_convert.rb +29 -12
  27. data/lib/isodoc/iso/word_dis_convert.rb +183 -0
  28. data/lib/isodoc/iso/xref.rb +46 -25
  29. data/lib/metanorma/iso/biblio.rng +37 -8
  30. data/lib/metanorma/iso/boilerplate-fr.xml +1 -1
  31. data/lib/metanorma/iso/boilerplate-ru.xml +1 -3
  32. data/lib/metanorma/iso/boilerplate.xml +1 -3
  33. data/lib/metanorma/iso/cleanup.rb +2 -1
  34. data/lib/metanorma/iso/isodoc.rng +56 -0
  35. data/lib/metanorma/iso/version.rb +1 -1
  36. data/lib/metanorma-iso.rb +1 -0
  37. data/lib/relaton/render/config.yml +4 -0
  38. data/lib/relaton/render/general.rb +13 -0
  39. data/metanorma-iso.gemspec +1 -1
  40. data/spec/isodoc/amd_spec.rb +31 -30
  41. data/spec/isodoc/blocks_spec.rb +286 -179
  42. data/spec/isodoc/i18n_spec.rb +187 -21
  43. data/spec/isodoc/inline_spec.rb +35 -42
  44. data/spec/isodoc/iso_spec.rb +1 -1
  45. data/spec/isodoc/metadata_spec.rb +17 -17
  46. data/spec/isodoc/postproc_spec.rb +28 -3
  47. data/spec/isodoc/ref_spec.rb +66 -69
  48. data/spec/isodoc/section_spec.rb +78 -76
  49. data/spec/isodoc/table_spec.rb +2 -2
  50. data/spec/isodoc/terms_spec.rb +2 -2
  51. data/spec/isodoc/word_dis_spec.rb +760 -0
  52. data/spec/isodoc/xref_spec.rb +51 -51
  53. data/spec/metanorma/base_spec.rb +10 -10
  54. data/spec/spec_helper.rb +11 -1
  55. data/spec/vcr_cassettes/withdrawn_iso.yml +26 -26
  56. metadata +11 -5
  57. data/spec/vcr_cassettes/docrels.yml +0 -385
@@ -121,7 +121,7 @@ RSpec.describe IsoDoc do
121
121
  <annex id="annex1" displayorder='5'>
122
122
  <title>
123
123
  <strong>Annex A</strong>
124
- <br/>(informative)</title>
124
+ <br/><span class="obligation">(informative)</span></title>
125
125
  <clause id="annex1a" inline-header="true">
126
126
  <title>A.1</title>
127
127
  <note id="AN">
@@ -224,12 +224,12 @@ RSpec.describe IsoDoc do
224
224
  <preface>
225
225
  <foreword id="fwd" displayorder='1'>
226
226
  <p>
227
- <xref target="N">Figure 1</xref>
228
- <xref target="note1">Figure 2</xref>
229
- <xref target="note2">Figure 3</xref>
230
- <xref target="AN">Figure A.1</xref>
231
- <xref target="Anote1">Figure A.2</xref>
232
- <xref target="Anote2">Figure A.3</xref>
227
+ <xref target="N"><span class='citefig'>Figure 1</span></xref>
228
+ <xref target="note1"><span class='citefig'>Figure 2</span></xref>
229
+ <xref target="note2"><span class='citefig'>Figure 3</span></xref>
230
+ <xref target="AN"><span class='citefig'>Figure A.1</span></xref>
231
+ <xref target="Anote1"><span class='citefig'>Figure A.2</span></xref>
232
+ <xref target="Anote2"><span class='citefig'>Figure A.3</span></xref>
233
233
  </p>
234
234
  </foreword>
235
235
  </preface>
@@ -243,7 +243,7 @@ RSpec.describe IsoDoc do
243
243
  <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
244
244
  </figure>
245
245
  <p>
246
- <xref target="N">Figure 1</xref>
246
+ <xref target="N"><span class='citefig'>Figure 1</span></xref>
247
247
  </p>
248
248
  </clause>
249
249
  <terms id="terms" displayorder='3'>
@@ -264,8 +264,8 @@ RSpec.describe IsoDoc do
264
264
  <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
265
265
  </figure>
266
266
  <p>
267
- <xref target="note1">Figure 2</xref>
268
- <xref target="note2">Figure 3</xref>
267
+ <xref target="note1"><span class='citefig'>Figure 2</span></xref>
268
+ <xref target="note2"><span class='citefig'>Figure 3</span></xref>
269
269
  </p>
270
270
  </clause>
271
271
  </clause>
@@ -273,7 +273,7 @@ RSpec.describe IsoDoc do
273
273
  <annex id="annex1" displayorder='5'>
274
274
  <title>
275
275
  <strong>Annex A</strong>
276
- <br/>(informative)</title>
276
+ <br/><span class="obligation">(informative)</span></title>
277
277
  <clause id="annex1a" inline-header="true">
278
278
  <title>A.1</title>
279
279
  <figure id="AN">
@@ -362,12 +362,12 @@ RSpec.describe IsoDoc do
362
362
  <preface>
363
363
  <foreword id="fwd" displayorder='1'>
364
364
  <p>
365
- <xref target="N">Figure 1</xref>
366
- <xref target="note1">Figure 1 a)</xref>
367
- <xref target="note2">Figure 1 b)</xref>
368
- <xref target="AN">Figure A.1</xref>
369
- <xref target="Anote1">Figure A.1 a)</xref>
370
- <xref target="Anote2">Figure A.1 b)</xref>
365
+ <xref target="N"><span class='citefig'>Figure 1</span></xref>
366
+ <xref target="note1"><span class='citefig'>Figure 1 a)</span></xref>
367
+ <xref target="note2"><span class='citefig'>Figure 1 b)</span></xref>
368
+ <xref target="AN"><span class='citefig'>Figure A.1</span></xref>
369
+ <xref target="Anote1"><span class='citefig'>Figure A.1 a)</span></xref>
370
+ <xref target="Anote2"><span class='citefig'>Figure A.1 b)</span></xref>
371
371
  </p>
372
372
  </foreword>
373
373
  </preface>
@@ -398,8 +398,8 @@ RSpec.describe IsoDoc do
398
398
  </figure>
399
399
  </figure>
400
400
  <p>
401
- <xref target="note1">Figure 1 a)</xref>
402
- <xref target="note2">Figure 1 b)</xref>
401
+ <xref target="note1"><span class='citefig'>Figure 1 a)</span></xref>
402
+ <xref target="note2"><span class='citefig'>Figure 1 b)</span></xref>
403
403
  </p>
404
404
  </clause>
405
405
  </clause>
@@ -407,7 +407,7 @@ RSpec.describe IsoDoc do
407
407
  <annex id="annex1" displayorder='5'>
408
408
  <title>
409
409
  <strong>Annex A</strong>
410
- <br/>(informative)</title>
410
+ <br/><span class="obligation">(informative)</span></title>
411
411
  <clause id="annex1a" inline-header="true">
412
412
  <title>A.1</title>
413
413
  </clause>
@@ -546,7 +546,7 @@ RSpec.describe IsoDoc do
546
546
  <annex id="annex1" displayorder='5'>
547
547
  <title>
548
548
  <strong>Annex A</strong>
549
- <br/>(informative)</title>
549
+ <br/><span class="obligation">(informative)</span></title>
550
550
  <clause id="annex1a" inline-header="true">
551
551
  <title>A.1</title>
552
552
  <example id="AN">
@@ -700,7 +700,7 @@ RSpec.describe IsoDoc do
700
700
  <annex id="annex1" displayorder='5'>
701
701
  <title>
702
702
  <strong>Annex A</strong>
703
- <br/>(informative)</title>
703
+ <br/><span class="obligation">(informative)</span></title>
704
704
  <clause id="annex1a" inline-header="true">
705
705
  <title>A.1</title>
706
706
  <formula id="AN">
@@ -833,12 +833,12 @@ RSpec.describe IsoDoc do
833
833
  <preface>
834
834
  <foreword displayorder='1'>
835
835
  <p>
836
- <xref target="N">Table 1</xref>
837
- <xref target="note1">Table 2</xref>
838
- <xref target="note2">Table 3</xref>
839
- <xref target="AN">Table A.1</xref>
840
- <xref target="Anote1">Table A.2</xref>
841
- <xref target="Anote2">Table A.3</xref>
836
+ <xref target="N"><span class='citetbl'>Table 1</span></xref>
837
+ <xref target="note1"><span class='citetbl'>Table 2</span></xref>
838
+ <xref target="note2"><span class='citetbl'>Table 3</span></xref>
839
+ <xref target="AN"><span class='citetbl'>Table A.1</span></xref>
840
+ <xref target="Anote1"><span class='citetbl'>Table A.2</span></xref>
841
+ <xref target="Anote2"><span class='citetbl'>Table A.3</span></xref>
842
842
  </p>
843
843
  </foreword>
844
844
  </preface>
@@ -858,7 +858,7 @@ RSpec.describe IsoDoc do
858
858
  </tbody>
859
859
  </table>
860
860
  <p>
861
- <xref target="N">Table 1</xref>
861
+ <xref target="N"><span class='citetbl'>Table 1</span></xref>
862
862
  </p>
863
863
  </clause>
864
864
  <terms id="terms" displayorder='3'>
@@ -891,8 +891,8 @@ RSpec.describe IsoDoc do
891
891
  </tbody>
892
892
  </table>
893
893
  <p>
894
- <xref target="note1">Table 2</xref>
895
- <xref target="note2">Table 3</xref>
894
+ <xref target="note1"><span class='citetbl'>Table 2</span></xref>
895
+ <xref target="note2"><span class='citetbl'>Table 3</span></xref>
896
896
  </p>
897
897
  </clause>
898
898
  </clause>
@@ -900,7 +900,7 @@ RSpec.describe IsoDoc do
900
900
  <annex id="annex1" displayorder='5'>
901
901
  <title>
902
902
  <strong>Annex A</strong>
903
- <br/>(informative)</title>
903
+ <br/><span class="obligation">(informative)</span></title>
904
904
  <clause id="annex1a" inline-header="true">
905
905
  <title>A.1</title>
906
906
  <table id="AN">
@@ -1138,23 +1138,23 @@ RSpec.describe IsoDoc do
1138
1138
  <title>Foreword</title>
1139
1139
  <p id='A'>
1140
1140
  This is a preamble
1141
- <xref target='C'>0.1</xref>
1142
- <xref target='C1'>0.2</xref>
1143
- <xref target='D'>Clause 1</xref>
1144
- <xref target='H'>Clause 3</xref>
1145
- <xref target='I'>3.1</xref>
1146
- <xref target='J'>3.1.1</xref>
1147
- <xref target='K'>3.2</xref>
1148
- <xref target='L'>Clause 4</xref>
1149
- <xref target='M'>Clause 5</xref>
1150
- <xref target='N'>5.1</xref>
1151
- <xref target='O'>5.2</xref>
1152
- <xref target='P'>Annex A</xref>
1153
- <xref target='Q'>A.1</xref>
1154
- <xref target='Q1'>A.1.1</xref>
1155
- <xref target='Q2'>Annex A, Appendix 1</xref>
1141
+ <xref target='C'><span class='citesec'>0.1</span></xref>
1142
+ <xref target='C1'><span class='citesec'>0.2</span></xref>
1143
+ <xref target='D'><span class='citesec'>Clause 1</span></xref>
1144
+ <xref target='H'><span class='citesec'>Clause 3</span></xref>
1145
+ <xref target='I'><span class='citesec'>3.1</span></xref>
1146
+ <xref target='J'><span class='citesec'>3.1.1</span></xref>
1147
+ <xref target='K'><span class='citesec'>3.2</span></xref>
1148
+ <xref target='L'><span class='citesec'>Clause 4</span></xref>
1149
+ <xref target='M'><span class='citesec'>Clause 5</span></xref>
1150
+ <xref target='N'><span class='citesec'>5.1</span></xref>
1151
+ <xref target='O'><span class='citesec'>5.2</span></xref>
1152
+ <xref target='P'><span class='citeapp'>Annex A</span></xref>
1153
+ <xref target='Q'><span class='citeapp'>A.1</span></xref>
1154
+ <xref target='Q1'><span class='citeapp'>A.1.1</span></xref>
1155
+ <xref target='Q2'><span class='citeapp'>Annex A, Appendix 1</span></xref>
1156
1156
  <xref target='Q3'>Annex A, Appendix 1.1</xref>
1157
- <xref target='R'>Clause 2</xref>
1157
+ <xref target='R'><span class='citesec'>Clause 2</span></xref>
1158
1158
  </p>
1159
1159
  </foreword>
1160
1160
  <introduction id='B' obligation='informative' displayorder='2'>
@@ -1243,7 +1243,7 @@ RSpec.describe IsoDoc do
1243
1243
  <title>
1244
1244
  <strong>Annex A</strong>
1245
1245
  <br/>
1246
- (normative)
1246
+ <span class="obligation">(normative)</span>
1247
1247
  <br/>
1248
1248
  <br/>
1249
1249
  <strong>Annex</strong>
@@ -1404,7 +1404,7 @@ RSpec.describe IsoDoc do
1404
1404
  <annex id="annex1" displayorder='5'>
1405
1405
  <title>
1406
1406
  <strong>Annex A</strong>
1407
- <br/>(informative)</title>
1407
+ <br/><span class="obligation">(informative)</span></title>
1408
1408
  <clause id="annex1a" inline-header="true">
1409
1409
  <title>A.1</title>
1410
1410
  <ol id="AN" type="alphabet">
@@ -1536,7 +1536,7 @@ RSpec.describe IsoDoc do
1536
1536
  </clause>
1537
1537
  </clause>
1538
1538
  </sections>
1539
- <annex id='annex1' displayorder='5'><title><strong>Annex A</strong><br/>(informative)</title>
1539
+ <annex id='annex1' displayorder='5'><title><strong>Annex A</strong><br/><span class="obligation">(informative)</span></title>
1540
1540
  <clause inline-header="true" id='annex1a'><title>A.1</title>
1541
1541
  <ol id='ANl' type="alphabet">
1542
1542
  <li id='AN'>
@@ -150,7 +150,7 @@ RSpec.describe Metanorma::ISO do
150
150
  :language: el
151
151
  :script: Grek
152
152
  :publisher: IEC;IETF;ISO
153
- :copyright-holder: ISO;IETF
153
+ :copyright-holder: IETF;ISO
154
154
  :copyright-year: 2001
155
155
  :doctype: technical-report
156
156
  :pub-address: 1 Infinity Loop + \
@@ -167,10 +167,10 @@ RSpec.describe Metanorma::ISO do
167
167
  <?xml version="1.0" encoding="UTF-8"?>
168
168
  <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
169
169
  <bibdata type="standard">
170
- <docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
171
- <docidentifier type='iso-undated'>ISO/IEC/IETF/TR 1000-1-1</docidentifier>
172
- <docidentifier type="iso-with-lang">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
173
- <docidentifier type="iso-reference">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
170
+ <docidentifier type='ISO'>IEC/IETF/ISO/TR 1000-1-1:2001</docidentifier>
171
+ <docidentifier type='iso-undated'>IEC/IETF/ISO/TR 1000-1-1</docidentifier>
172
+ <docidentifier type='iso-with-lang'>IEC/IETF/ISO/TR 1000-1-1:2001(X)</docidentifier>
173
+ <docidentifier type='iso-reference'>IEC/IETF/ISO/TR 1000-1-1:2001(X)</docidentifier>
174
174
  <docidentifier type="iso-tc">2000</docidentifier>
175
175
  <docidentifier type="iso-tc">2003</docidentifier>
176
176
  <docnumber>1000</docnumber>
@@ -245,8 +245,7 @@ RSpec.describe Metanorma::ISO do
245
245
  <from>2001</from>
246
246
  <owner>
247
247
  <organization>
248
- <name>International Organization for Standardization</name>
249
- <abbreviation>ISO</abbreviation>
248
+ <name>IETF</name>
250
249
  <address>
251
250
  <formattedAddress>1 Infinity Loop + California</formattedAddress>
252
251
  </address>
@@ -257,11 +256,12 @@ RSpec.describe Metanorma::ISO do
257
256
  </organization>
258
257
  </owner>
259
258
  </copyright>
260
- <copyright>
259
+ <copyright>
261
260
  <from>2001</from>
262
261
  <owner>
263
262
  <organization>
264
- <name>IETF</name>
263
+ <name>International Organization for Standardization</name>
264
+ <abbreviation>ISO</abbreviation>
265
265
  <address>
266
266
  <formattedAddress>1 Infinity Loop + California</formattedAddress>
267
267
  </address>
@@ -280,7 +280,7 @@ RSpec.describe Metanorma::ISO do
280
280
  <workgroup/>
281
281
  </editorialgroup>
282
282
  <structuredidentifier>
283
- <project-number part="1" subpart="1">ISO/IEC/IETF 1000</project-number>
283
+ <project-number part="1" subpart="1">IEC/IETF/ISO 1000</project-number>
284
284
  </structuredidentifier>
285
285
  <stagename>International standard</stagename>
286
286
  </ext>
data/spec/spec_helper.rb CHANGED
@@ -47,7 +47,10 @@ RSpec.configure do |config|
47
47
  end
48
48
 
49
49
  def strip_guid(xml)
50
- xml.gsub(%r{ id="_[^"]+"}, ' id="_"').gsub(%r{ target="_[^"]+"}, ' target="_"')
50
+ xml.gsub(%r{ id="_[^"]+"}, ' id="_"')
51
+ .gsub(%r{ target="_[^"]+"}, ' target="_"')
52
+ .gsub(%r{ src="cid:[^.]+.gif"}, ' src="_.gif"')
53
+ .gsub(%r{ src='cid:[^.]+.gif'}, ' src="_.gif"')
51
54
  end
52
55
 
53
56
  def metadata(hash)
@@ -57,6 +60,13 @@ def metadata(hash)
57
60
  end
58
61
 
59
62
  def xmlpp(xml)
63
+ c = HTMLEntities.new
64
+ xml &&= xml.split(/(&\S+?;)/).map do |n|
65
+ if /^&\S+?;$/.match?(n)
66
+ c.encode(c.decode(n), :hexadecimal)
67
+ else n
68
+ end
69
+ end.join
60
70
  s = ""
61
71
  f = REXML::Formatters::Pretty.new(2)
62
72
  f.compact = true