metanorma-iso 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +4 -0
  3. data/.gitignore +11 -0
  4. data/.hound.yml +3 -0
  5. data/.oss-guides.rubocop.yml +1077 -0
  6. data/.rubocop.ribose.yml +66 -0
  7. data/.rubocop.tb.yml +650 -0
  8. data/.rubocop.yml +15 -0
  9. data/.travis.yml +21 -0
  10. data/CODE_OF_CONDUCT.md +46 -0
  11. data/Gemfile +7 -0
  12. data/LICENSE +25 -0
  13. data/Makefile +39 -0
  14. data/README.adoc +882 -0
  15. data/Rakefile +6 -0
  16. data/asciidoctor-iso.gemspec.old +50 -0
  17. data/bin/rspec +18 -0
  18. data/docs/customisation.adoc +186 -0
  19. data/docs/guidance.adoc +436 -0
  20. data/docs/htmloutput.adoc +115 -0
  21. data/docs/quickstart.adoc +375 -0
  22. data/lib/asciidoctor-iso.rb +11 -0
  23. data/lib/asciidoctor/iso/base.rb +48 -0
  24. data/lib/asciidoctor/iso/biblio.rng +836 -0
  25. data/lib/asciidoctor/iso/cleanup.rb +39 -0
  26. data/lib/asciidoctor/iso/converter.rb +19 -0
  27. data/lib/asciidoctor/iso/front.rb +131 -0
  28. data/lib/asciidoctor/iso/isodoc.rng +1059 -0
  29. data/lib/asciidoctor/iso/isostandard.rnc +176 -0
  30. data/lib/asciidoctor/iso/isostandard.rng +1001 -0
  31. data/lib/asciidoctor/iso/section.rb +72 -0
  32. data/lib/asciidoctor/iso/validate.rb +190 -0
  33. data/lib/asciidoctor/iso/validate_requirements.rb +105 -0
  34. data/lib/asciidoctor/iso/validate_section.rb +214 -0
  35. data/lib/asciidoctor/iso/validate_style.rb +134 -0
  36. data/lib/asciidoctor/iso/version.rb +5 -0
  37. data/lib/isodoc/iso/html/header.html +206 -0
  38. data/lib/isodoc/iso/html/html_iso_intro.html +34 -0
  39. data/lib/isodoc/iso/html/html_iso_titlepage.html +34 -0
  40. data/lib/isodoc/iso/html/htmlstyle.scss +46 -0
  41. data/lib/isodoc/iso/html/isodoc.scss +696 -0
  42. data/lib/isodoc/iso/html/scripts.html +174 -0
  43. data/lib/isodoc/iso/html/style-human.scss +1277 -0
  44. data/lib/isodoc/iso/html/style-iso.scss +1257 -0
  45. data/lib/isodoc/iso/html/word_iso_intro.html +72 -0
  46. data/lib/isodoc/iso/html/word_iso_titlepage.html +62 -0
  47. data/lib/isodoc/iso/html/wordstyle.scss +1175 -0
  48. data/lib/isodoc/iso/html_convert.rb +118 -0
  49. data/lib/isodoc/iso/metadata.rb +107 -0
  50. data/lib/isodoc/iso/word_convert.rb +141 -0
  51. data/lib/metanorma/iso.rb +7 -0
  52. data/lib/metanorma/iso/processor.rb +44 -0
  53. data/spec/asciidoctor-iso/base_spec.rb +350 -0
  54. data/spec/asciidoctor-iso/blocks_spec.rb +469 -0
  55. data/spec/asciidoctor-iso/cleanup_spec.rb +765 -0
  56. data/spec/asciidoctor-iso/inline_spec.rb +162 -0
  57. data/spec/asciidoctor-iso/isobib_cache_spec.rb +332 -0
  58. data/spec/asciidoctor-iso/lists_spec.rb +190 -0
  59. data/spec/asciidoctor-iso/macros_spec.rb +111 -0
  60. data/spec/asciidoctor-iso/refs_spec.rb +643 -0
  61. data/spec/asciidoctor-iso/section_spec.rb +334 -0
  62. data/spec/asciidoctor-iso/table_spec.rb +307 -0
  63. data/spec/asciidoctor-iso/validate_spec.rb +907 -0
  64. data/spec/assets/header.html +7 -0
  65. data/spec/assets/html.css +2 -0
  66. data/spec/assets/htmlcover.html +4 -0
  67. data/spec/assets/htmlintro.html +5 -0
  68. data/spec/assets/i18n.yaml +2 -0
  69. data/spec/assets/iso.doc +1093 -0
  70. data/spec/assets/iso.headless.html +33 -0
  71. data/spec/assets/iso.html +278 -0
  72. data/spec/assets/iso.xml +8 -0
  73. data/spec/assets/rice_image1.png +0 -0
  74. data/spec/assets/scripts.html +3 -0
  75. data/spec/assets/std.css +2 -0
  76. data/spec/assets/word.css +2 -0
  77. data/spec/assets/wordcover.html +3 -0
  78. data/spec/assets/wordintro.html +4 -0
  79. data/spec/examples/103_01_02.html +247 -0
  80. data/spec/examples/english.yaml +69 -0
  81. data/spec/examples/iso_123_.xml +45 -0
  82. data/spec/examples/iso_123_all_parts.xml +45 -0
  83. data/spec/examples/iso_123_no_year_note.xml +46 -0
  84. data/spec/examples/iso_124_.xml +41 -0
  85. data/spec/examples/iso_216_.xml +47 -0
  86. data/spec/examples/iso_iec_12382_.xml +48 -0
  87. data/spec/examples/rice.adoc +715 -0
  88. data/spec/examples/rice.preview.html +1877 -0
  89. data/spec/examples/rice.sh +4 -0
  90. data/spec/examples/rice_images/rice_image1.png +0 -0
  91. data/spec/examples/rice_images/rice_image2.png +0 -0
  92. data/spec/examples/rice_images/rice_image3_1.png +0 -0
  93. data/spec/examples/rice_images/rice_image3_2.png +0 -0
  94. data/spec/examples/rice_images/rice_image3_3.png +0 -0
  95. data/spec/isodoc/i18n_spec.rb +642 -0
  96. data/spec/isodoc/iso_spec.rb +168 -0
  97. data/spec/isodoc/metadata_spec.rb +152 -0
  98. data/spec/isodoc/postproc_spec.rb +405 -0
  99. data/spec/isodoc/section_spec.rb +522 -0
  100. data/spec/isodoc/xref_spec.rb +1337 -0
  101. data/spec/metanorma/processor_spec.rb +70 -0
  102. data/spec/spec_helper.rb +227 -0
  103. metadata +402 -0
@@ -0,0 +1,168 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc::Iso do
4
+ system "rm -f test.html"
5
+ it "processes isodoc as ISO: HTML output" do
6
+ IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", false)
7
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
8
+ <preface><foreword>
9
+ <note>
10
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
11
+ </note>
12
+ </foreword></preface>
13
+ </iso-standard>
14
+ INPUT
15
+ html = File.read("test.html", encoding: "utf-8")
16
+ expect(html).to match(%r[\.Sourcecode[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
17
+ expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Cambria", serif;]m)
18
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Cambria", serif;]m)
19
+ end
20
+
21
+ it "processes isodoc as ISO: alt HTML output" do
22
+ system "rm -f test.html"
23
+ IsoDoc::Iso::HtmlConvert.new({alt: true}).convert("test", <<~"INPUT", false)
24
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
25
+ <preface><foreword>
26
+ <note>
27
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
28
+ </note>
29
+ </foreword></preface>
30
+ </iso-standard>
31
+ INPUT
32
+ html = File.read("test.html", encoding: "utf-8")
33
+ expect(html).to match(%r[\.Sourcecode[^{]+\{[^{]+font-family: "Space Mono", monospace;]m)
34
+ expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
35
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Lato", sans-serif;]m)
36
+ end
37
+
38
+ it "processes isodoc as ISO: Chinese HTML output" do
39
+ system "rm -f test.html"
40
+ IsoDoc::Iso::HtmlConvert.new({script: "Hans"}).convert("test", <<~"INPUT", false)
41
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
42
+ <preface><foreword>
43
+ <note>
44
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
45
+ </note>
46
+ </foreword></preface>
47
+ </iso-standard>
48
+ INPUT
49
+ html = File.read("test.html", encoding: "utf-8")
50
+ expect(html).to match(%r[\.Sourcecode[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
51
+ expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "SimSun", serif;]m)
52
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "SimHei", sans-serif;]m)
53
+ end
54
+
55
+ it "processes isodoc as ISO: user nominated fonts" do
56
+ system "rm -f test.html"
57
+ IsoDoc::Iso::HtmlConvert.new({bodyfont: "Zapf Chancery", headerfont: "Comic Sans", monospacefont: "Andale Mono"}).convert("test", <<~"INPUT", false)
58
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
59
+ <preface><foreword>
60
+ <note>
61
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
62
+ </note>
63
+ </foreword></preface>
64
+ </iso-standard>
65
+ INPUT
66
+ html = File.read("test.html", encoding: "utf-8")
67
+ expect(html).to match(%r[\.Sourcecode[^{]+\{[^{]+font-family: Andale Mono;]m)
68
+ expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: Zapf Chancery;]m)
69
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: Comic Sans;]m)
70
+ end
71
+
72
+ it "processes isodoc as ISO: Word output" do
73
+ system "rm -f test.doc"
74
+ IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", false)
75
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
76
+ <preface><foreword>
77
+ <note>
78
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
79
+ </note>
80
+ </foreword></preface>
81
+ </iso-standard>
82
+ INPUT
83
+ html = File.read("test.doc", encoding: "utf-8")
84
+ expect(html).to match(%r[\.Sourcecode[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
85
+ expect(html).to match(%r[Quote[^{]+\{[^{]+font-family: "Cambria", serif;]m)
86
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Cambria", serif;]m)
87
+ end
88
+
89
+ it "does not include IEV in references" do
90
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
91
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
92
+ <preface><foreword>
93
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
94
+ <eref bibitemid="IEV"/>
95
+ <eref bibitemid="ISO20483"/>
96
+ </p>
97
+ </foreword></preface>
98
+ <bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
99
+ <bibitem type="international-standard" id="IEV">
100
+ <title format="text/plain" language="en" script="Latn">Electropedia:
101
+ The World's Online Electrotechnical Vocabulary</title>
102
+ <source type="src">http://www.electropedia.org</source>
103
+ <docidentifier>IEV</docidentifier>
104
+ <date type="published"> <on>2018</on> </date>
105
+ <contributor>
106
+ <role type="publisher"/>
107
+ <organization>
108
+ <name>International Electrotechnical Commission</name>
109
+ <abbreviation>IEC</abbreviation>
110
+ <uri>www.iec.ch</uri>
111
+ </organization>
112
+ </contributor>
113
+ <language>en</language> <language>fr</language>
114
+ <script>Latn</script>
115
+ <copyright>
116
+ <from>2018</from>
117
+ <owner>
118
+ <organization>
119
+ <name>International Electrotechnical Commission</name>
120
+ <abbreviation>IEC</abbreviation>
121
+ <uri>www.iec.ch</uri>
122
+ </organization>
123
+ </owner>
124
+ </copyright>
125
+ <relation type="updates">
126
+ <bibitem>
127
+ <formattedref>IEC 60050</formattedref>
128
+ </bibitem>
129
+ </relation>
130
+ </bibitem>
131
+ <bibitem id="ISO20483" type="standard">
132
+ <title format="text/plain">Cereals and pulses</title>
133
+ <docidentifier>ISO 20483</docidentifier>
134
+ <date type="published"><from>2013</from><to>2014</to></date>
135
+ <contributor>
136
+ <role type="publisher"/>
137
+ <organization>
138
+ <name>International Organization for Standardization</name>
139
+ </organization>
140
+ </contributor>
141
+ </bibitem>
142
+ </references>
143
+ </bibliography>
144
+ </iso-standard>
145
+ INPUT
146
+ #{HTML_HDR}
147
+ <br/>
148
+ <div>
149
+ <h1 class="ForewordTitle">Foreword</h1>
150
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
151
+ <a href="#IEV">IEV:2018</a>
152
+ <a href="#ISO20483">ISO 20483:2013&#8211;2014</a>
153
+ </p>
154
+ </div>
155
+ <p class="zzSTDTitle1"/>
156
+ <div>
157
+ <h1>1.&#160; Normative references</h1>
158
+ <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>
159
+ <p id="ISO20483" class="NormRef">ISO 20483:2013&#8211;2014, <i> Cereals and pulses</i></p>
160
+ </div>
161
+ </div>
162
+ </body>
163
+ </html>
164
+
165
+ OUTPUT
166
+ end
167
+
168
+ end
@@ -0,0 +1,152 @@
1
+ require "spec_helper"
2
+ require "nokogiri"
3
+
4
+ RSpec.describe IsoDoc::Iso::Metadata do
5
+ it "processes IsoXML metadata" do
6
+ c = IsoDoc::Iso::HtmlConvert.new({})
7
+ arr = c.convert_init(<<~"INPUT", "test", false)
8
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
9
+ INPUT
10
+ expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT"
11
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
12
+ <bibdata type="international-standard">
13
+ <title>
14
+ <title-intro language="en" format="text/plain">Cereals and pulses</title-intro>
15
+ <title-main language="en" format="text/plain">Specifications and test methods</title-main>
16
+ <title-part language="en" format="text/plain">Rice</title-part>
17
+ </title>
18
+ <title>
19
+ <title-intro language="fr" format="text/plain">Céréales et légumineuses</title-intro>
20
+ <title-main language="fr" format="text/plain">Spécification et méthodes d'essai</title-main>
21
+ <title-part language="fr" format="text/plain">Riz</title-part>
22
+ </title>
23
+ <docidentifier>
24
+ <project-number part="1">17301</project-number>
25
+ <tc-document-number>17301</tc-document-number>
26
+ </docidentifier>
27
+ <date type="published"><on>2011</on></date>
28
+ <date type="accessed"><on>2012</on></date>
29
+ <date type="created"><from>2010</from><to>2011</to></date>
30
+ <date type="activated"><on>2013</on></date>
31
+ <date type="obsoleted"><on>2014</on></date>
32
+ <contributor>
33
+ <role type="author"/>
34
+ <organization>
35
+ <abbreviation>ISO</abbreviation>
36
+ </organization>
37
+ </contributor>
38
+ <contributor>
39
+ <role type="publisher"/>
40
+ <organization>
41
+ <abbreviation>ISO</abbreviation>
42
+ </organization>
43
+ </contributor>
44
+ <language>en</language>
45
+ <script>Latn</script>
46
+ <status>
47
+ <stage>30</stage>
48
+ <substage>92</substage>
49
+ <iteration>3</iteration>
50
+ </status>
51
+ <copyright>
52
+ <from>2016</from>
53
+ <owner>
54
+ <organization>
55
+ <abbreviation>ISO</abbreviation>
56
+ </organization>
57
+ </owner>
58
+ </copyright>
59
+ <editorialgroup>
60
+ <technical-committee number="34">Food products</technical-committee>
61
+ <subcommittee number="4">Cereals and pulses</subcommittee>
62
+ <workgroup number="3">Rice Group</workgroup>
63
+ <secretariat>GB</secretariat>
64
+ </editorialgroup>
65
+ </bibdata><version>
66
+ <edition>2</edition>
67
+ <revision-date>2016-05-01</revision-date>
68
+ <draft>0.4</draft>
69
+ </version>
70
+ </iso-standard>
71
+ INPUT
72
+ {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :confirmeddate=>"XXX", :createddate=>"2010&ndash;2011", :docnumber=>"PreCD3 17301-1", :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=>"Partie&nbsp;1: Riz", :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=>"Part&nbsp;1: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>"XXX", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stage_int=>30, :stageabbr=>"PreCD3", :tc=>"TC 34", :updateddate=>"XXX", :wg=>"WG 3"}
73
+ OUTPUT
74
+ end
75
+
76
+ it "processes IsoXML metadata" do
77
+ c = IsoDoc::Iso::HtmlConvert.new({})
78
+ arr = c.convert_init(<<~"INPUT", "test", false)
79
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
80
+ INPUT
81
+ expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT"
82
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
83
+ <bibdata type="international-standard">
84
+ <title>
85
+ <title-intro language="en" format="text/plain">Cereals and pulses</title-intro>
86
+ <title-main language="en" format="text/plain">Specifications and test methods</title-main>
87
+ <title-part language="en" format="text/plain">Rice</title-part>
88
+ </title>
89
+ <title>
90
+ <title-intro language="fr" format="text/plain">Céréales et légumineuses</title-intro>
91
+ <title-main language="fr" format="text/plain">Spécification et méthodes d'essai</title-main>
92
+ <title-part language="fr" format="text/plain">Riz</title-part>
93
+ </title>
94
+ <docidentifier>
95
+ <project-number part="1" subpart="3">17301</project-number>
96
+ <tc-document-number>17301</tc-document-number>
97
+ </docidentifier>
98
+ <contributor>
99
+ <role type="author"/>
100
+ <organization>
101
+ <name>ISO</name>
102
+ </organization>
103
+ </contributor>
104
+ <contributor>
105
+ <role type="publisher"/>
106
+ <organization>
107
+ <abbreviation>ISO</abbreviation>
108
+ </organization>
109
+ </contributor>
110
+ <contributor>
111
+ <role type="publisher"/>
112
+ <organization>
113
+ <abbreviation>IEC</abbreviation>
114
+ </organization>
115
+ </contributor>
116
+ <language>en</language>
117
+ <script>Latn</script>
118
+ <status>
119
+ <stage>30</stage>
120
+ <substage>92</substage>
121
+ </status>
122
+ <copyright>
123
+ <from>2016</from>
124
+ <owner>
125
+ <organization>
126
+ <name>International Organization for Standardization</name>
127
+ </organization>
128
+ </owner>
129
+ </copyright>
130
+ <relation type="obsoletes">
131
+ <locality type="clause"><referenceFrom>3.1</referenceFrom></locality>
132
+ <docidentifier>IEC 8121</docidentifier>
133
+ </relation>
134
+ <editorialgroup>
135
+ <technical-committee number="34" type="ABC">Food products</technical-committee>
136
+ <subcommittee number="4" type="DEF">Cereals and pulses</subcommittee>
137
+ <workgroup number="3" type="GHI">Rice Group</workgroup>
138
+ </editorialgroup>
139
+ <ics><code>1.2.3</code></ics>
140
+ <ics><code>1.2.3</code></ics>
141
+ </bibdata><version>
142
+ <edition>2</edition>
143
+ <revision-date>2016-05-01</revision-date>
144
+ <draft>12</draft>
145
+ </version>
146
+ </iso-standard>
147
+ INPUT
148
+ {:accesseddate=>"XXX", :agency=>"ISO/IEC", :confirmeddate=>"XXX", :createddate=>"XXX", :docnumber=>"CD 17301-1-3", :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=>"Partie&nbsp;1&ndash;3: Riz", :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=>"Part&nbsp;1&ndash;3: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05-01)", :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisheddate=>"XXX", :revdate=>"2016-05-01", :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"30", :stage_int=>30, :stageabbr=>"CD", :tc=>"ABC 34", :updateddate=>"XXX", :wg=>"GHI 3"}
149
+ OUTPUT
150
+ end
151
+
152
+ end
@@ -0,0 +1,405 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "generates file based on string input" do
5
+ system "rm -f test.doc"
6
+ system "rm -f test.html"
7
+ IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).convert("test", <<~"INPUT", false)
8
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
9
+ <preface><foreword>
10
+ <note>
11
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
12
+ </note>
13
+ </foreword></preface>
14
+ </iso-standard>
15
+ INPUT
16
+ expect(File.exist?("test.html")).to be true
17
+ html = File.read("test.html")
18
+ expect(html).to match(%r{<title>test</title><style>})
19
+ expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/2\.7\.1/MathJax\.js})
20
+ expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
21
+ end
22
+
23
+ it "generates HTML output docs with null configuration" do
24
+ system "rm -f test.doc"
25
+ system "rm -f test.html"
26
+ IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
27
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
28
+ <preface><foreword>
29
+ <note>
30
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
31
+ </note>
32
+ </foreword></preface>
33
+ </iso-standard>
34
+ INPUT
35
+ expect(File.exist?("test.html")).to be true
36
+ html = File.read("test.html")
37
+ expect(html).to match(%r{<title>test</title><style>})
38
+ expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/2\.7\.1/MathJax\.js})
39
+ expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
40
+ end
41
+
42
+ it "generates Word output docs with null configuration" do
43
+ system "rm -f test.doc"
44
+ system "rm -f test.html"
45
+ IsoDoc::Iso::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
46
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
47
+ <preface><foreword>
48
+ <note>
49
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
50
+ </note>
51
+ </foreword></preface>
52
+ </iso-standard>
53
+ INPUT
54
+ expect(File.exist?("test.doc")).to be true
55
+ word = File.read("test.doc")
56
+ expect(word).to match(/<style>/)
57
+ end
58
+
59
+ it "generates HTML output docs with null configuration from file" do
60
+ system "rm -f spec/assets/iso.doc"
61
+ system "rm -f spec/assets/iso.html"
62
+ IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
63
+ expect(File.exist?("spec/assets/iso.html")).to be true
64
+ html = File.read("spec/assets/iso.html")
65
+ expect(html).to match(/<style>/)
66
+ expect(html).to match(%r{https://use.fontawesome.com})
67
+ expect(html).to match(%r{libs/jquery})
68
+ end
69
+
70
+ it "generates Word output docs with null configuration from file" do
71
+ system "rm -f spec/assets/iso.doc"
72
+ IsoDoc::Iso::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
73
+ expect(File.exist?("spec/assets/iso.doc")).to be true
74
+ word = File.read("spec/assets/iso.doc")
75
+ expect(word).to match(/<w:WordDocument>/)
76
+ expect(word).to match(/<style>/)
77
+ end
78
+
79
+ it "converts annex subheadings to h2Annex class for Word" do
80
+ system "rm -f test.doc"
81
+ system "rm -f test.html"
82
+ IsoDoc::Iso::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
83
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
84
+ <annex id="P" inline-header="false" obligation="normative">
85
+ <title>Annex</title>
86
+ <clause id="Q" inline-header="false" obligation="normative">
87
+ <title>Annex A.1</title>
88
+ </clause>
89
+ <appendix id="Q2" inline-header="false" obligation="normative">
90
+ <title>An Appendix</title>
91
+ </appendix>
92
+ </annex>
93
+ </iso-standard>
94
+ INPUT
95
+ word = File.read("test.doc").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
96
+ sub(%r{<div style="mso-element:footnote-list"/>.*$}m, "")
97
+ expect(word).to be_equivalent_to <<~"OUTPUT"
98
+ <div class="WordSection3">
99
+ <p class="zzSTDTitle1"></p>
100
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
101
+ <div class="Section3"><a name="P" id="P"></a>
102
+ <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
103
+ <div><a name="Q" id="Q"></a>
104
+ <p class="h2Annex">A.1. Annex A.1</p>
105
+ </div>
106
+ <div><a name="Q2" id="Q2"></a>
107
+ <p class="h2Annex">Appendix 1. An Appendix</p>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
112
+ <div class="colophon"></div>
113
+ OUTPUT
114
+ end
115
+
116
+ it "populates Word template with terms reference labels" do
117
+ system "rm -f test.doc"
118
+ system "rm -f test.html"
119
+ IsoDoc::Iso::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
120
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
121
+ <sections>
122
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
123
+
124
+ <term id="paddy1"><preferred>paddy</preferred>
125
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
126
+ <termsource status="modified">
127
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
128
+ <modification>
129
+ <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
130
+ </modification>
131
+ </termsource></term>
132
+
133
+ </terms>
134
+ </sections>
135
+ </iso-standard>
136
+
137
+ INPUT
138
+ word = File.read("test.doc").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
139
+ sub(%r{<div style="mso-element:footnote-list"/>.*$}m, "")
140
+ expect(word).to be_equivalent_to <<~"OUTPUT"
141
+ <div class="WordSection3">
142
+ <p class="zzSTDTitle1"></p>
143
+ <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><p class="MsoNormal">For the purposes of this document,
144
+ the following terms and definitions apply.</p>
145
+ <p class="MsoNormal">ISO and IEC maintain terminological databases for use in
146
+ standardization at the following addresses:</p>
147
+
148
+ <ul>
149
+ <li style="mso-list:l3 level1 lfo1;" class="MsoNormal"> <p class="MsoNormal">ISO Online browsing platform: available at
150
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
151
+ <li style="mso-list:l3 level1 lfo1;" class="MsoNormal"> <p class="MsoNormal">IEC Electropedia: available at
152
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
153
+ </p> </li> </ul>
154
+ <p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1</p><p class="Terms" style="text-align:left;">paddy</p>
155
+ <p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
156
+ <p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301:2011, 3.1</a>, modified &mdash; The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
157
+ </div>
158
+ <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
159
+ <div class="colophon"></div>
160
+ OUTPUT
161
+ end
162
+
163
+ it "populates Word header" do
164
+ system "rm -f test.doc"
165
+ IsoDoc::Iso::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", header: "spec/assets/header.html"}).convert("test", <<~"INPUT", false)
166
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
167
+ <bibdata type="article">
168
+ <docidentifier>
169
+ <project-number part="1">1000</project-number>
170
+ </docidentifier>
171
+ </bibdata>
172
+ </iso-standard>
173
+
174
+ INPUT
175
+ word = File.read("test.doc").sub(%r{^.*Content-Location: file:///C:/Doc/test_files/header.html}m, "Content-Location: file:///C:/Doc/test_files/header.html").
176
+ sub(/------=_NextPart.*$/m, "")
177
+ #expect(word).to include(%{Content-Location: file:///C:/Doc/test_files/header.html\nContent-Transfer-Encoding: base64\nContent-Type: text/html charset="utf-8" })
178
+ expect(word).to include(%{Content-Location: file:///C:/Doc/test_files/header.html})
179
+ end
180
+
181
+ it "populates Word ToC" do
182
+ system "rm -f test.doc"
183
+ IsoDoc::Iso::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
184
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
185
+ <sections>
186
+ <clause inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
187
+
188
+ <title>Introduction<bookmark id="Q"/> to this<fn reference="1">
189
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
190
+ </fn></title>
191
+ </clause>
192
+ <clause id="O" inline-header="false" obligation="normative">
193
+ <title>Clause 4.2</title>
194
+ <p>A<fn reference="1">
195
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
196
+ </fn></p>
197
+ </clause></clause>
198
+ </sections>
199
+ </iso-standard>
200
+
201
+ INPUT
202
+ word = File.read("test.doc").sub(/^.*An empty word intro page\./m, '').
203
+ sub(%r{<br clear="all" class="section"/>\s*<div class="WordSection3">.*$}m, "")
204
+ expect(word.gsub(/_Toc\d\d+/, "_Toc")).to be_equivalent_to <<~'OUTPUT'
205
+ <p class="MsoToc1"><span lang="EN-GB" xml:lang="EN-GB"><span style="mso-element:field-begin"></span><span style="mso-spacerun:yes">&#xA0;</span>TOC
206
+ \o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
207
+ <span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
208
+ <a href="#_Toc">1.<span style="mso-tab-count:1">&#xA0; </span>Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
209
+ <span style="mso-tab-count:1 dotted">. </span>
210
+ </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
211
+ <span style="mso-element:field-begin"></span></span>
212
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
213
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
214
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span></span></p>
215
+
216
+ <p class="MsoToc2">
217
+ <span class="MsoHyperlink">
218
+ <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
219
+ <a href="#_Toc">1.1. Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
220
+ <span style="mso-tab-count:1 dotted">. </span>
221
+ </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
222
+ <span style="mso-element:field-begin"></span></span>
223
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
224
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
225
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
226
+ </span>
227
+ </p>
228
+
229
+ <p class="MsoToc2">
230
+ <span class="MsoHyperlink">
231
+ <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
232
+ <a href="#_Toc">1.2. Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
233
+ <span style="mso-tab-count:1 dotted">. </span>
234
+ </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
235
+ <span style="mso-element:field-begin"></span></span>
236
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
237
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
238
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
239
+ </span>
240
+ </p>
241
+
242
+ <p class="MsoToc1">
243
+ <span lang="EN-GB" xml:lang="EN-GB">
244
+ <span style="mso-element:field-end"></span>
245
+ </span>
246
+ <span lang="EN-GB" xml:lang="EN-GB">
247
+ <p class="MsoNormal">&#xA0;</p>
248
+ </span>
249
+ </p>
250
+
251
+
252
+ <p class="MsoNormal">&#xA0;</p>
253
+ </div>
254
+ OUTPUT
255
+ end
256
+
257
+ it "reorders footnote numbers in HTML" do
258
+ system "rm -f test.html"
259
+ IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
260
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
261
+ <sections>
262
+ <clause inline-header="false" obligation="normative"><title>Clause 4</title><fn reference="3">
263
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">This is a footnote.</p>
264
+ </fn><clause id="N" inline-header="false" obligation="normative">
265
+
266
+ <title>Introduction to this<fn reference="2">
267
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
268
+ </fn></title>
269
+ </clause>
270
+ <clause id="O" inline-header="false" obligation="normative">
271
+ <title>Clause 4.2</title>
272
+ <p>A<fn reference="1">
273
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
274
+ </fn></p>
275
+ </clause></clause>
276
+ </sections>
277
+ </iso-standard>
278
+ INPUT
279
+ html = File.read("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
280
+ sub(%r{</main>.*$}m, "</main>")
281
+ expect(html).to be_equivalent_to <<~"OUTPUT"
282
+ <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
283
+ <p class="zzSTDTitle1"></p>
284
+ <div>
285
+ <h1>1.&#xA0; Clause 4</h1>
286
+ <a rel="footnote" href="#fn:3" epub:type="footnote" id="fnref:1">
287
+ <sup>1</sup>
288
+ </a>
289
+ <div id="N">
290
+
291
+ <h2>1.1. Introduction to this<a rel="footnote" href="#fn:2" epub:type="footnote" id="fnref:2"><sup>2</sup></a></h2>
292
+ </div>
293
+ <div id="O">
294
+ <h2>1.2. Clause 4.2</h2>
295
+ <p>A<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
296
+ </div>
297
+ </div>
298
+ <aside id="fn:3" class="footnote">
299
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a rel="footnote" href="#fn:3" epub:type="footnote" id="fnref:1">
300
+ <sup>1</sup>
301
+ </a>This is a footnote.</p>
302
+ <a href="#fnref:1">&#x21A9;</a></aside>
303
+ <aside id="fn:2" class="footnote">
304
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a rel="footnote" href="#fn:2" epub:type="footnote" id="fnref:2"><sup>2</sup></a>Formerly denoted as 15 % (m/m).</p>
305
+ <a href="#fnref:2">&#x21A9;</a></aside>
306
+
307
+ </main>
308
+ OUTPUT
309
+ end
310
+
311
+ it "moves images in HTML" do
312
+ system "rm -f test.html"
313
+ system "rm -rf _images"
314
+ IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
315
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
316
+ <preface><foreword>
317
+ <figure id="_">
318
+ <name>Split-it-right sample divider</name>
319
+ <image src="spec/assets/rice_image1.png" id="_" imagetype="PNG"/>
320
+ <image src="spec/assets/rice_image1.png" id="_" width="20000" height="300000" imagetype="PNG"/>
321
+ <image src="spec/assets/rice_image1.png" id="_" width="99" height="auto" imagetype="PNG"/>
322
+ </figure>
323
+ </foreword></preface>
324
+ </iso-standard>
325
+ INPUT
326
+ html = File.read("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
327
+ sub(%r{</main>.*$}m, "</main>")
328
+ expect(`ls _images`).to match(/\.png$/)
329
+ expect(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")).to be_equivalent_to <<~"OUTPUT"
330
+ <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
331
+ <br />
332
+ <div>
333
+ <h1 class="ForewordTitle">Foreword</h1>
334
+ <div id="_" class="figure">
335
+ <img src="_images/_.png" height="776" width="922" />
336
+ <img src="_images/_.png" height="800" width="53" />
337
+ <img src="_images/_.png" height="83" width="99" />
338
+ <p class="FigureTitle" align="center">Figure 1&#xA0;&#x2014; Split-it-right sample divider</p></div>
339
+ </div>
340
+ <p class="zzSTDTitle1"></p>
341
+ </main>
342
+ OUTPUT
343
+
344
+ end
345
+
346
+ it "processes IsoXML terms for HTML" do
347
+ system "rm -f test.doc"
348
+ system "rm -f test.html"
349
+ IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
350
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
351
+ <sections>
352
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
353
+
354
+ <term id="paddy1"><preferred>paddy</preferred>
355
+ <domain>rice</domain>
356
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
357
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
358
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
359
+ <ul>
360
+ <li>A</li>
361
+ </ul>
362
+ </termexample>
363
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
364
+ <ul>
365
+ <li>A</li>
366
+ </ul>
367
+ </termexample>
368
+
369
+ <termsource status="modified">
370
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
371
+ <modification>
372
+ <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
373
+ </modification>
374
+ </termsource></term>
375
+
376
+ <term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
377
+ <admitted>rough rice</admitted>
378
+ <deprecates>cargo rice</deprecates>
379
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
380
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
381
+ <ul>
382
+ <li>A</li>
383
+ </ul>
384
+ </termexample>
385
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
386
+ <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
387
+ </termnote>
388
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
389
+ <ul><li>A</li></ul>
390
+ <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
391
+ </termnote>
392
+ <termsource status="identical">
393
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
394
+ </termsource></term>
395
+ </terms>
396
+ </sections>
397
+ </iso-standard>
398
+ INPUT
399
+ expect(File.exist?("test.html")).to be true
400
+ html = File.read("test.html")
401
+ expect(html).to match(%r{<h2 class="TermNum" id="paddy1">1\.1</h2>})
402
+ expect(html).to match(%r{<h2 class="TermNum" id="paddy">1\.2</h2>})
403
+ end
404
+
405
+ end