metanorma-iso 1.3.21 → 1.3.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -7
  3. data/.github/workflows/ubuntu.yml +8 -7
  4. data/.github/workflows/windows.yml +8 -8
  5. data/Gemfile +2 -0
  6. data/lib/asciidoctor/iso/base.rb +22 -0
  7. data/lib/asciidoctor/iso/biblio.rng +142 -37
  8. data/lib/asciidoctor/iso/cleanup.rb +19 -2
  9. data/lib/asciidoctor/iso/front.rb +19 -72
  10. data/lib/asciidoctor/iso/front_id.rb +196 -0
  11. data/lib/asciidoctor/iso/isodoc.rng +48 -2
  12. data/lib/asciidoctor/iso/isostandard-amd.rng +98 -0
  13. data/lib/asciidoctor/iso/isostandard.rng +17 -1
  14. data/lib/asciidoctor/iso/macros.rb +21 -0
  15. data/lib/asciidoctor/iso/section.rb +18 -32
  16. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +87 -0
  17. data/lib/asciidoctor/iso/validate.rb +41 -21
  18. data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
  19. data/lib/asciidoctor/iso/validate_section.rb +2 -2
  20. data/lib/asciidoctor/iso/validate_style.rb +7 -6
  21. data/lib/isodoc/iso/base_convert.rb +48 -64
  22. data/lib/isodoc/iso/html/header.html +10 -6
  23. data/lib/isodoc/iso/html/html_iso_titlepage.html +27 -18
  24. data/lib/isodoc/iso/html/isodoc.scss +49 -28
  25. data/lib/isodoc/iso/html/scripts.html +23 -21
  26. data/lib/isodoc/iso/html/style-human.scss +25 -2
  27. data/lib/isodoc/iso/html/style-iso.scss +20 -2
  28. data/lib/isodoc/iso/html/word_iso_titlepage.html +23 -2
  29. data/lib/isodoc/iso/html/wordstyle.scss +80 -39
  30. data/lib/isodoc/iso/html_convert.rb +7 -9
  31. data/lib/isodoc/iso/iso.amendment.xsl +4597 -0
  32. data/lib/isodoc/iso/iso.international-standard.xsl +4597 -0
  33. data/lib/isodoc/iso/metadata.rb +74 -44
  34. data/lib/isodoc/iso/pdf_convert.rb +39 -0
  35. data/lib/isodoc/iso/sections.rb +66 -0
  36. data/lib/isodoc/iso/sts_convert.rb +29 -0
  37. data/lib/metanorma-iso.rb +2 -0
  38. data/lib/metanorma/iso/processor.rb +16 -1
  39. data/lib/metanorma/iso/version.rb +1 -1
  40. data/metanorma-iso.gemspec +4 -1
  41. data/spec/asciidoctor-iso/amd_spec.rb +726 -0
  42. data/spec/asciidoctor-iso/base_spec.rb +43 -21
  43. data/spec/asciidoctor-iso/blocks_spec.rb +21 -9
  44. data/spec/asciidoctor-iso/cleanup_spec.rb +203 -175
  45. data/spec/asciidoctor-iso/inline_spec.rb +2 -1
  46. data/spec/asciidoctor-iso/macros_spec.rb +275 -0
  47. data/spec/asciidoctor-iso/refs_spec.rb +7 -4
  48. data/spec/asciidoctor-iso/section_spec.rb +8 -8
  49. data/spec/assets/iso.xml +64 -1
  50. data/spec/isodoc/amd_spec.rb +606 -0
  51. data/spec/isodoc/i18n_spec.rb +12 -20
  52. data/spec/isodoc/inline_spec.rb +2 -2
  53. data/spec/isodoc/iso_spec.rb +1 -1
  54. data/spec/isodoc/metadata_spec.rb +12 -4
  55. data/spec/isodoc/postproc_spec.rb +20 -119
  56. data/spec/isodoc/ref_spec.rb +5 -5
  57. data/spec/isodoc/section_spec.rb +36 -13
  58. data/spec/isodoc/table_spec.rb +22 -22
  59. data/spec/isodoc/terms_spec.rb +2 -2
  60. data/spec/isodoc/xref_spec.rb +19 -19
  61. data/spec/metanorma/processor_spec.rb +2 -2
  62. data/spec/spec_helper.rb +13 -1
  63. metadata +57 -5
  64. data/asciidoctor-iso.gemspec.old +0 -50
@@ -15,16 +15,14 @@ RSpec.describe IsoDoc do
15
15
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
16
16
  <title>Introduction Subsection</title>
17
17
  </clause>
18
- <patent-notice>
19
18
  <p>This is patent boilerplate</p>
20
- </patent-notice>
21
19
  </introduction></preface><sections>
22
20
  <clause id="D" obligation="normative">
23
21
  <title>Scope</title>
24
22
  <p id="E">Text</p>
25
23
  </clause>
26
24
 
27
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
25
+ <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
28
26
  <title>Normal Terms</title>
29
27
  <term id="J">
30
28
  <preferred>Term2</preferred>
@@ -61,11 +59,11 @@ RSpec.describe IsoDoc do
61
59
  <appendix id="Q2" inline-header="false" obligation="normative">
62
60
  <title>An Appendix</title>
63
61
  </appendix>
64
- </annex><bibliography><references id="R" obligation="informative">
62
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
65
63
  <title>Normative References</title>
66
64
  </references><clause id="S" obligation="informative">
67
65
  <title>Bibliography</title>
68
- <references id="T" obligation="informative">
66
+ <references id="T" obligation="informative" normative="false">
69
67
  <title>Bibliography Subsection</title>
70
68
  </references>
71
69
  </clause>
@@ -161,16 +159,14 @@ RSpec.describe IsoDoc do
161
159
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
162
160
  <title>Introduction Subsection</title>
163
161
  </clause>
164
- <patent-notice>
165
162
  <p>This is patent boilerplate</p>
166
- </patent-notice>
167
163
  </introduction></preface><sections>
168
164
  <clause id="D" obligation="normative">
169
165
  <title>Scope</title>
170
166
  <p id="E">Text</p>
171
167
  </clause>
172
168
 
173
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
169
+ <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
174
170
  <title>Normal Terms</title>
175
171
  <term id="J">
176
172
  <preferred>Term2</preferred>
@@ -207,11 +203,11 @@ RSpec.describe IsoDoc do
207
203
  <appendix id="Q2" inline-header="false" obligation="normative">
208
204
  <title>An Appendix</title>
209
205
  </appendix>
210
- </annex><bibliography><references id="R" obligation="informative">
206
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
211
207
  <title>Normative References</title>
212
208
  </references><clause id="S" obligation="informative">
213
209
  <title>Bibliography</title>
214
- <references id="T" obligation="informative">
210
+ <references id="T" obligation="informative" normative="false">
215
211
  <title>Bibliography Subsection</title>
216
212
  </references>
217
213
  </clause>
@@ -307,16 +303,14 @@ RSpec.describe IsoDoc do
307
303
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
308
304
  <title>Introduction Subsection</title>
309
305
  </clause>
310
- <patent-notice>
311
306
  <p>This is patent boilerplate</p>
312
- </patent-notice>
313
307
  </introduction></preface><sections>
314
308
  <clause id="D" obligation="normative">
315
309
  <title>Scope</title>
316
310
  <p id="E">Text</p>
317
311
  </clause>
318
312
 
319
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
313
+ <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
320
314
  <title>Normal Terms</title>
321
315
  <term id="J">
322
316
  <preferred>Term2</preferred>
@@ -353,11 +347,11 @@ RSpec.describe IsoDoc do
353
347
  <appendix id="Q2" inline-header="false" obligation="normative">
354
348
  <title>An Appendix</title>
355
349
  </appendix>
356
- </annex><bibliography><references id="R" obligation="informative">
350
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
357
351
  <title>Normative References</title>
358
352
  </references><clause id="S" obligation="informative">
359
353
  <title>Bibliography</title>
360
- <references id="T" obligation="informative">
354
+ <references id="T" obligation="informative" normative="false">
361
355
  <title>Bibliography Subsection</title>
362
356
  </references>
363
357
  </clause>
@@ -454,16 +448,14 @@ RSpec.describe IsoDoc do
454
448
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
455
449
  <title>Introduction Subsection</title>
456
450
  </clause>
457
- <patent-notice>
458
451
  <p>This is patent boilerplate</p>
459
- </patent-notice>
460
452
  </introduction></preface><sections>
461
453
  <clause id="D" obligation="normative">
462
454
  <title>Scope</title>
463
455
  <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
464
456
  </clause>
465
457
 
466
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
458
+ <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
467
459
  <title>Normal Terms</title>
468
460
  <term id="J">
469
461
  <preferred>Term2</preferred>
@@ -500,7 +492,7 @@ RSpec.describe IsoDoc do
500
492
  <appendix id="Q2" inline-header="false" obligation="normative">
501
493
  <title>An Appendix</title>
502
494
  </appendix>
503
- </annex><bibliography><references id="R" obligation="informative">
495
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
504
496
  <title>Normative References</title>
505
497
  <bibitem id="ISO712" type="standard">
506
498
  <title format="text/plain">Cereals and cereal products</title>
@@ -514,7 +506,7 @@ RSpec.describe IsoDoc do
514
506
  </bibitem>
515
507
  </references><clause id="S" obligation="informative">
516
508
  <title>Bibliography</title>
517
- <references id="T" obligation="informative">
509
+ <references id="T" obligation="informative" normative="false">
518
510
  <title>Bibliography Subsection</title>
519
511
  </references>
520
512
  </clause>
@@ -158,7 +158,7 @@ RSpec.describe IsoDoc do
158
158
  <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</stem>
159
159
  </p>
160
160
  </foreword></preface>
161
- <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
161
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
162
162
  <bibitem id="ISO712" type="standard">
163
163
  <title format="text/plain">Cereals and cereal products</title>
164
164
  <docidentifier>ISO 712</docidentifier>
@@ -213,7 +213,7 @@ RSpec.describe IsoDoc do
213
213
  <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
214
214
  </p>
215
215
  </foreword></preface>
216
- <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
216
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
217
217
  <bibitem id="ISO712" type="standard">
218
218
  <title format="text/plain">Cereals and cereal products</title>
219
219
  <docidentifier>ISO 712</docidentifier>
@@ -96,7 +96,7 @@ RSpec.describe IsoDoc::Iso do
96
96
  <eref bibitemid="ISO20483"/>
97
97
  </p>
98
98
  </foreword></preface>
99
- <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
99
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
100
100
  <bibitem type="international-standard" id="IEV">
101
101
  <title format="text/plain" language="en" script="Latn">Electropedia:
102
102
  The World's Online Electrotechnical Vocabulary</title>
@@ -17,6 +17,8 @@ RSpec.describe IsoDoc::Iso::Metadata do
17
17
  <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
18
18
  <title type="title-part" language="fr" format="text/plain">Riz</title>
19
19
  <docidentifier type="iso">ISO/PreCD3 17301-1</docidentifier>
20
+ <docidentifier type="iso-with-lang">ISO/PreCD3 17301-1 (E)</docidentifier>
21
+ <docidentifier type="iso-reference">ISO/PreCD3 17301-1:2000 (E)</docidentifier>
20
22
  <docidentifier type="iso-tc">17301</docidentifier>
21
23
  <docidentifier type="iso-tc">17302</docidentifier>
22
24
  <docnumber>1730</docnumber>
@@ -46,7 +48,7 @@ RSpec.describe IsoDoc::Iso::Metadata do
46
48
  <language>en</language>
47
49
  <script>Latn</script>
48
50
  <status>
49
- <stage>30</stage>
51
+ <stage abbreviation="CD">30</stage>
50
52
  <substage>92</substage>
51
53
  <iteration>3</iteration>
52
54
  </status>
@@ -58,6 +60,8 @@ RSpec.describe IsoDoc::Iso::Metadata do
58
60
  </organization>
59
61
  </owner>
60
62
  </copyright>
63
+ <keyword>kw2</keyword>
64
+ <keyword>kw1</keyword>
61
65
  <ext>
62
66
  <doctype>international-standard</doctype>
63
67
  <editorialgroup>
@@ -69,11 +73,12 @@ RSpec.describe IsoDoc::Iso::Metadata do
69
73
  <structuredidentifier>
70
74
  <project-number part="1">ISO/PreCD3 17301</project-number>
71
75
  </structuredidentifier>
76
+ <stagename>Committee draft</stagename>
72
77
  </ext>
73
78
  </bibdata>
74
79
  </iso-standard>
75
80
  INPUT
76
- {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2010&ndash;2011", :docnumber=>"ISO/PreCD3 17301-1", :docnumeric=>"1730", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :publisher=>"International Organization for Standardization", :revdate=>"2016-05-01", :revdate_monthyear=>"May 2016", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stage_int=>30, :stageabbr=>"CD", :statusabbr=>"PreCD3", :tc=>"TC 34", :tc_docnumber=>["17301", "17302"], :unpublished=>true, :wg=>"WG 3"}
81
+ {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2010&ndash;2011", :docnumber=>"ISO/PreCD3 17301-1", :docnumber_lang=>"ISO/PreCD3 17301-1 (E)", :docnumber_reference=>"ISO/PreCD3 17301-1:2000 (E)", :docnumeric=>"1730", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>nil, :keywords=>["kw2", "kw1"], :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :publisher=>"International Organization for Standardization", :revdate=>"2016-05-01", :revdate_monthyear=>"May 2016", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stage_int=>30, :stageabbr=>"CD", :statusabbr=>"PreCD3", :tc=>"TC 34", :tc_docnumber=>["17301", "17302"], :unpublished=>true, :wg=>"WG 3"}
77
82
  OUTPUT
78
83
  end
79
84
 
@@ -96,6 +101,8 @@ OUTPUT
96
101
  <title type="title-part" language="fr" format="text/plain">Riz</title>
97
102
  </title>
98
103
  <docidentifier type="iso">ISO/IEC/CD 17301-1-3</docidentifier>
104
+ <docidentifier type="iso-with-lang">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
105
+ <docidentifier type="iso-reference">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
99
106
  <docidentifier type="iso-tc">17301</docidentifier>
100
107
  <contributor>
101
108
  <role type="author"/>
@@ -120,7 +127,7 @@ OUTPUT
120
127
  <language>en</language>
121
128
  <script>Latn</script>
122
129
  <status>
123
- <stage>60</stage>
130
+ <stage abbreviation="IS">60</stage>
124
131
  <substage>92</substage>
125
132
  </status>
126
133
  <copyright>
@@ -147,11 +154,12 @@ OUTPUT
147
154
  <structuredidentifier>
148
155
  <project-number part="1" subpart="3">ISO/IEC/CD 17301</project-number>
149
156
  </strucuredidentifier>
157
+ <stagename>International standard</stagename>
150
158
  </ext>
151
159
  </bibdata>
152
160
  </iso-standard>
153
161
  INPUT
154
- {:agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :docnumber=>"ISO/IEC/CD 17301-1-3", :docnumeric=>nil, :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1&ndash;3", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1&ndash;3", :doctype=>"International Standard", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisher=>"International Organization for Standardization and International Electrotechnical Commission", :revdate=>nil, :revdate_monthyear=>nil, :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"60", :stage_int=>60, :statusabbr=>"IS", :tc=>"ABC 34", :tc_docnumber=>["17301"], :unpublished=>false, :wg=>"GHI 3"}
162
+ {:agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :docnumber=>"ISO/IEC/CD 17301-1-3", :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)", :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)", :docnumeric=>nil, :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1&ndash;3", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1&ndash;3", :doctype=>"International Standard", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :keywords=>[], :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisher=>"International Organization for Standardization and International Electrotechnical Commission", :revdate=>nil, :revdate_monthyear=>nil, :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"60", :stage_int=>60, :statusabbr=>"IS", :tc=>"ABC 34", :tc_docnumber=>["17301"], :unpublished=>false, :wg=>"GHI 3"}
155
163
  OUTPUT
156
164
  end
157
165
 
@@ -91,6 +91,12 @@ RSpec.describe IsoDoc do
91
91
  expect(word).to match(/<style>/)
92
92
  end
93
93
 
94
+ it "generates Pdf output docs with null configuration from file" do
95
+ FileUtils.rm_f "spec/assets/iso.pdf"
96
+ IsoDoc::Iso::PdfConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
97
+ expect(File.exist?("spec/assets/iso.pdf")).to be true
98
+ end
99
+
94
100
  it "converts annex subheadings to h2Annex class for Word" do
95
101
  FileUtils.rm_f "test.doc"
96
102
  FileUtils.rm_f "test.html"
@@ -153,7 +159,7 @@ RSpec.describe IsoDoc do
153
159
  expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
154
160
  <div class="WordSection3">
155
161
  <p class="zzSTDTitle1"></p>
156
- <div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1<span style="mso-tab-count:1">&#xA0; </span>Terms and definitions</h1>
162
+ <div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1<span style="mso-tab-count:1">&#xA0; </span>Terms and Definitions</h1>
157
163
  <p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1</p><p class="Terms" style="text-align:left;">paddy</p>
158
164
  <p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
159
165
  <p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301:2011, 3.1</a>, modified &#x2014; The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
@@ -285,26 +291,26 @@ RSpec.describe IsoDoc do
285
291
  <main xmlns:epub="epub" class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
286
292
  <p class="zzSTDTitle1"></p>
287
293
  <div id="A">
288
- <h1>1&#xA0; Clause 4</h1>
289
- <a rel="footnote" href="#fn:3" epub:type="footnote" id="fnref:1">
294
+ <h1 id="toc0">1&#xA0; Clause 4</h1>
295
+ <a href="#fn:3" class="FootnoteRef" id="fnref:1">
290
296
  <sup>1)</sup>
291
297
  </a>
292
298
  <div id="N">
293
299
 
294
- <h2>1.1&#xA0; Introduction to this<a rel="footnote" href="#fn:2" epub:type="footnote" id="fnref:2"><sup>2)</sup></a></h2>
300
+ <h2 id="toc1">1.1&#xA0; Introduction to this<a href="#fn:2" class="FootnoteRef" id="fnref:2"><sup>2)</sup></a></h2>
295
301
  </div>
296
302
  <div id="O">
297
- <h2>1.2&#xA0; Clause 4.2</h2>
298
- <p>A<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2)</sup></a></p>
303
+ <h2 id="toc2">1.2&#xA0; Clause 4.2</h2>
304
+ <p>A<a class="FootnoteRef" href="#fn:2"><sup>2)</sup></a></p>
299
305
  </div>
300
306
  </div>
301
307
  <aside id="fn:3" class="footnote">
302
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a rel="footnote" href="#fn:3" epub:type="footnote">
308
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a class="FootnoteRef" href="#fn:3">
303
309
  <sup>1)</sup>
304
310
  </a>This is a footnote.</p>
305
311
  <a href="#fnref:1">&#x21A9;</a></aside>
306
312
  <aside id="fn:2" class="footnote">
307
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2)</sup></a>Formerly denoted as 15 % (m/m).</p>
313
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a href="#fn:2" class="FootnoteRef"><sup>2)</sup></a>Formerly denoted as 15 % (m/m).</p>
308
314
  <a href="#fnref:2">&#x21A9;</a></aside>
309
315
 
310
316
  </main>
@@ -347,7 +353,7 @@ RSpec.describe IsoDoc do
347
353
  Clause 4
348
354
  </h1>
349
355
  <span style='mso-bookmark:_Ref'>
350
- <a href='#_ftn1' epub:type='footnote' style='mso-footnote-id:ftn1' name='_ftnref1' title='' id='_ftnref1'>
356
+ <a href='#_ftn1' class='FootnoteRef' epub:type='footnote' style='mso-footnote-id:ftn1' name='_ftnref1' title='' id='_ftnref1'>
351
357
  <span class='MsoFootnoteReference'>
352
358
  <span style='mso-special-character:footnote'/>
353
359
  </span>
@@ -361,7 +367,7 @@ RSpec.describe IsoDoc do
361
367
  <span style='mso-tab-count:1'>&#xA0; </span>
362
368
  Introduction to this
363
369
  <span style='mso-bookmark:_Ref'>
364
- <a href='#_ftn2' epub:type='footnote' style='mso-footnote-id:ftn2' name='_ftnref2' title='' id='_ftnref2'>
370
+ <a href='#_ftn2' epub:type='footnote' class='FootnoteRef' style='mso-footnote-id:ftn2' name='_ftnref2' title='' id='_ftnref2'>
365
371
  <span class='MsoFootnoteReference'>
366
372
  <span style='mso-special-character:footnote'/>
367
373
  </span>
@@ -380,7 +386,7 @@ RSpec.describe IsoDoc do
380
386
  <p class='MsoNormal'>
381
387
  A
382
388
  <span style='mso-bookmark:_Ref'>
383
- <a href='#_ftn3' epub:type='footnote' style='mso-footnote-id:ftn3' name='_ftnref3' title='' id='_ftnref3'>
389
+ <a href='#_ftn3' class='FootnoteRef' epub:type='footnote' style='mso-footnote-id:ftn3' name='_ftnref3' title='' id='_ftnref3'>
384
390
  <span class='MsoFootnoteReference'>
385
391
  <span style='mso-special-character:footnote'/>
386
392
  </span>
@@ -459,7 +465,7 @@ RSpec.describe IsoDoc do
459
465
  <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
460
466
  <br />
461
467
  <div>
462
- <h1 class="ForewordTitle">Foreword</h1>
468
+ <h1 class="ForewordTitle" id="toc0">Foreword</h1>
463
469
  <div id="_" class="figure">
464
470
  <img src="test_htmlimages/_.png" height="776" width="922" />
465
471
  <img src="test_htmlimages/_.png" height="800" width="53" />
@@ -672,8 +678,8 @@ documentation.

672
678
  </iso-standard>
673
679
  INPUT
674
680
  word = File.read("test.html", encoding: "UTF-8")
675
- expect(xmlpp(word)).to include "<h1 class='IntroTitle'>Warning for Stuff</h1>"
676
- expect(xmlpp(word)).to include "I am the Walrus."
681
+ expect((word)).to include '<h1 class="IntroTitle">Warning for Stuff</h1>'
682
+ expect((word)).to include "I am the Walrus."
677
683
  end
678
684
 
679
685
  it "processes boilerplate (Word)" do
@@ -734,109 +740,4 @@ end
734
740
  expect(word).to include '<p class="zzWarning">I am the Walrus</p>'
735
741
  end
736
742
 
737
- it "skips internal hyperlinks" do
738
- FileUtils.rm_f "test.html"
739
- FileUtils.rm_f "test.doc"
740
- IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
741
- <iso-standard xmlns="http://riboseinc.com/isoxml">
742
- <preface>
743
- <foreword>
744
- <p>
745
- <xref target="scope"/>
746
- <xref target="terms"/>
747
- <xref target="_waxy_rice"/>
748
- <xref target="N"/>
749
- <xref target="N1"/>
750
- <xref target="N2"/>
751
- <xref target="N3"/>
752
- <xref target="N4"/>
753
- <xref target="N5"/>
754
- <xref target="N6"/>
755
- <xref target="N7"/>
756
- <xref target="N8"/>
757
- <xref target="N9"/>
758
- <xref target="N10"/>
759
- <eref bibitemid="ISO712"/>
760
- </p>
761
- </foreword>
762
- </preface>
763
- <sections>
764
- <clause id="scope"><title>Scope</title>
765
- <note id="N">
766
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
767
- </note>
768
- <figure id="N1">
769
- <name>Split-it-right sample divider</name>
770
- </figure>
771
- <example id="N2">
772
- <p>Hello</p>
773
- </example>
774
- <formula id="N3">
775
- <stem type="AsciiMath">r = 1 %</stem>
776
- </formula>
777
- <table id="N4">
778
- <name>Repeatability and reproducibility of husked rice yield</name>
779
- <tbody>
780
- <tr>
781
- <td align="left">Number of laboratories retained after eliminating outliers</td>
782
- <td align="center">13</td>
783
- <td align="center">11</td>
784
- </tr>
785
- </tbody>
786
- </table>
787
- <ol id="N6">
788
- <li id="N7"><p>A</p></li>
789
- </ol>
790
- <requirement id="N8">
791
- <stem type="AsciiMath">r = 1 %</stem>
792
- </requirement>
793
- <recommendation id="N9">
794
- <stem type="AsciiMath">r = 1 %</stem>
795
- </requirement>
796
- <permission id="N10">
797
- <stem type="AsciiMath">r = 1 %</stem>
798
- </requirement>
799
- </clause>
800
- <terms id="terms">
801
- <term id="_waxy_rice"><preferred>waxy rice</preferred>
802
- <termnote id="N5">
803
- <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
804
- </termnote></term>
805
- </terms>
806
- </sections>
807
- <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
808
- <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
809
- <bibitem id="ISO712" type="standard">
810
- <title format="text/plain">Cereals or cereal products</title>
811
- <title type="main" format="text/plain">Cereals and cereal products</title>
812
- <docidentifier type="ISO">ISO 712</docidentifier>
813
- <contributor>
814
- <role type="publisher"/>
815
- <organization>
816
- <name>International Organization for Standardization</name>
817
- </organization>
818
- </contributor>
819
- </bibitem>
820
- </references>
821
- </bibliography>
822
- </iso-standard>
823
- INPUT
824
- expect(File.exist?("test.html")).to be true
825
- html = File.read("test.html", encoding: "UTF-8").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
826
- sub(%r{</main>.*$}m, "</main>").sub(%r{^.*?<div>}m, "<div>").sub(%r{</div>.*$}m, "</div>")
827
- expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
828
- <div>
829
- <h1 class='ForewordTitle'>Foreword</h1>
830
- <p>
831
- <a href='#scope'>Clause 1</a>
832
- <a href='#terms'>Clause 3</a>
833
- <a href='#_waxy_rice'>3.1</a>
834
- Clause 1, Note Figure 1 Clause 1, Example Clause 1, Formula (1) Table 1
835
- 3.1, Note 1 Clause 1, List Clause 1 a) Clause 1, Requirement 1 Clause 1,
836
- Recommendation 1 Clause 1, Permission 1
837
- <a href='#ISO712'>ISO 712</a>
838
- </p>
839
- </div>
840
- OUTPUT
841
- end
842
743
  end
@@ -18,7 +18,7 @@ RSpec.describe IsoDoc do
18
18
  <eref bibitemid="ref12"/>
19
19
  </p>
20
20
  </foreword></preface>
21
- <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
21
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
22
22
  <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
23
23
  <bibitem id="ISO712" type="standard">
24
24
  <title format="text/plain">Cereals or cereal products</title>
@@ -65,7 +65,7 @@ RSpec.describe IsoDoc do
65
65
  </bibitem>
66
66
  <note><p>This is an annotation of ISO 20483:2013-2014</p></note>
67
67
 
68
- </references><references id="_bibliography" obligation="informative">
68
+ </references><references id="_bibliography" obligation="informative" normative="false">
69
69
  <title>Bibliography</title>
70
70
  <bibitem id="ISBN" type="ISBN">
71
71
  <title format="text/plain">Chemicals for analytical laboratory use</title>
@@ -131,7 +131,7 @@ RSpec.describe IsoDoc do
131
131
  <a href="#ISO16634">ISO 16634:--</a>
132
132
  <a href="#ref1">ICC 167</a>
133
133
  <a href="#ref10">[10]</a>
134
- <a href="#ref12">[Citn]</a>
134
+ <a href="#ref12">Citn</a>
135
135
  </p>
136
136
  </div>
137
137
  <p class="zzSTDTitle1"/>
@@ -139,7 +139,7 @@ RSpec.describe IsoDoc do
139
139
  <h1>1&#160; Normative references</h1>
140
140
  <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
141
141
  <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
142
- <p id="ISO16634" class="NormRef">ISO 16634:-- (all parts)<a rel="footnote" href="#fn:1" epub:type="footnote"><sup>1</sup></a>, <i>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i></p>
142
+ <p id="ISO16634" class="NormRef">ISO 16634:-- (all parts)<a class="FootnoteRef" href="#fn:1"><sup>1</sup></a>, <i>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i></p>
143
143
  <p id="ISO20483" class="NormRef">ISO 20483:2013-2014, <i>Cereals and pulses</i></p>
144
144
  <p id="ref1" class="NormRef">ICC 167, <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
145
145
  <div id="" class="Note">
@@ -160,7 +160,7 @@ RSpec.describe IsoDoc do
160
160
  <p id="ISO3696" class="Biblio">[3]&#160; ISO 3696, <i>Water for analytical laboratory use</i></p>
161
161
  <p id="ref10" class="Biblio">[10]&#160; <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
162
162
  <p id="ref11" class="Biblio">[5]&#160; IETF RFC 10, <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i></p>
163
- <p id="ref12" class="Biblio">[6]&#160; Citn, CitationWorks. 2019. <i>How to cite a reference</i>.</p>
163
+ <p id="ref12" class="Biblio">[6]&#160; Citn, IETF RFC 20, CitationWorks. 2019. <i>How to cite a reference</i>.</p>
164
164
  </div>
165
165
  <aside id="fn:1" class="footnote">
166
166
  <p>Under preparation. (Stage at the time of publication ISO/DIS 16634)</p>