isodoc 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/README.adoc +34 -22
- data/isodoc.gemspec +1 -1
- data/lib/isodoc.rb +3 -1
- data/lib/isodoc/blocks.rb +1 -1
- data/lib/isodoc/cleanup.rb +1 -1
- data/lib/isodoc/convert.rb +9 -8
- data/lib/isodoc/{comments.rb → htmlconvert/comments.rb} +1 -1
- data/lib/isodoc/htmlconvert/convert.rb +13 -0
- data/lib/isodoc/{footnotes.rb → htmlconvert/footnotes.rb} +1 -1
- data/lib/isodoc/{html.rb → htmlconvert/html.rb} +29 -4
- data/lib/isodoc/i18n-en.yaml +5 -5
- data/lib/isodoc/i18n.rb +6 -2
- data/lib/isodoc/inline.rb +8 -8
- data/lib/isodoc/iso/convert.rb +4 -0
- data/lib/isodoc/iso/html/style-human.scss +3 -3
- data/lib/isodoc/iso/html/style-iso.scss +2 -2
- data/lib/isodoc/iso/html/wordstyle.scss +27 -0
- data/lib/isodoc/iso/wordconvert.rb +5 -2
- data/lib/isodoc/iso2wordhtml.rb +15 -16
- data/lib/isodoc/lists.rb +1 -1
- data/lib/isodoc/metadata.rb +66 -49
- data/lib/isodoc/references.rb +21 -11
- data/lib/isodoc/section.rb +3 -3
- data/lib/isodoc/table.rb +1 -1
- data/lib/isodoc/terms.rb +1 -1
- data/lib/isodoc/utils.rb +20 -21
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/wordconvert/comments.rb +122 -117
- data/lib/isodoc/wordconvert/convert.rb +5 -2
- data/lib/isodoc/wordconvert/footnotes.rb +14 -1
- data/lib/isodoc/wordconvert/postprocess.rb +7 -2
- data/lib/isodoc/wordconvert/wordconvertmodule.rb +12 -1
- data/lib/isodoc/xref_gen.rb +12 -2
- data/lib/isodoc/xref_sect_gen.rb +5 -4
- data/spec/isodoc/blocks_spec.rb +1 -1
- data/spec/isodoc/footnotes_spec.rb +3 -3
- data/spec/isodoc/i18n_spec.rb +10 -10
- data/spec/isodoc/inline_spec.rb +2 -2
- data/spec/isodoc/iso_spec.rb +79 -0
- data/spec/isodoc/metadata_spec.rb +12 -4
- data/spec/isodoc/postproc_spec.rb +7 -7
- data/spec/isodoc/ref_spec.rb +7 -19
- data/spec/isodoc/section_spec.rb +19 -84
- data/spec/isodoc/terms_spec.rb +1 -1
- data/spec/isodoc/xref_spec.rb +14 -14
- data/spec/spec_helper.rb +3 -3
- metadata +9 -8
data/lib/isodoc/xref_sect_gen.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module IsoDoc
|
2
|
-
class
|
2
|
+
class Common
|
3
3
|
def back_anchor_names(docxml)
|
4
4
|
docxml.xpath(ns("//annex")).each_with_index do |c, i|
|
5
5
|
annex_names(c, (65 + i).chr.to_s)
|
6
6
|
end
|
7
|
-
docxml.xpath(ns("//bibitem")).each do |ref|
|
7
|
+
docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
|
8
8
|
reference_names(ref)
|
9
9
|
end
|
10
10
|
end
|
@@ -14,7 +14,7 @@ module IsoDoc
|
|
14
14
|
n = 0
|
15
15
|
n = section_names(d.at(ns("//clause[title = 'Scope']")), n, 1)
|
16
16
|
n = section_names(d.at(ns(
|
17
|
-
"//references[title = 'Normative References']")), n, 1)
|
17
|
+
"//references[title = 'Normative References' or title = 'Normative references']")), n, 1)
|
18
18
|
n = section_names(d.at(ns("//sections/terms | "\
|
19
19
|
"//sections/clause[descendant::terms]")), n, 1)
|
20
20
|
n = section_names(d.at(ns("//sections/symbols-abbrevs")), n, 1)
|
@@ -27,7 +27,8 @@ module IsoDoc
|
|
27
27
|
def middle_section_asset_names(d)
|
28
28
|
middle_sections = "//clause[title = 'Scope'] | "\
|
29
29
|
"//foreword | //introduction | "\
|
30
|
-
"//references[title = 'Normative References'
|
30
|
+
"//references[title = 'Normative References' or title = 'Normative references'] | "\
|
31
|
+
"//sections/terms | "\
|
31
32
|
"//sections/symbols-abbrevs | //clause[parent::sections]"
|
32
33
|
sequential_asset_names(d.xpath(ns(middle_sections)))
|
33
34
|
end
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -563,7 +563,7 @@ World</p>
|
|
563
563
|
INPUT
|
564
564
|
#{HTML_HDR}
|
565
565
|
<p class="zzSTDTitle1"/>
|
566
|
-
<div><h1>1.  Terms and
|
566
|
+
<div><h1>1.  Terms and definitions</h1><p>For the purposes of this document,
|
567
567
|
the following terms and definitions apply.</p>
|
568
568
|
<p>ISO and IEC maintain terminological databases for use in
|
569
569
|
standardization at the following addresses:</p>
|
@@ -114,15 +114,15 @@ RSpec.describe IsoDoc do
|
|
114
114
|
html = File.read("test.html").sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")
|
115
115
|
expect(html).to be_equivalent_to <<~"OUTPUT"
|
116
116
|
<body lang="EN-US" link="blue" vlink="#954F72" xml:lang="EN-US">
|
117
|
-
<div class="
|
117
|
+
<div class="title-section">
|
118
118
|
<p> </p>
|
119
119
|
</div>
|
120
120
|
<br />
|
121
|
-
<div class="
|
121
|
+
<div class="prefatory-section">
|
122
122
|
<p> </p>
|
123
123
|
</div>
|
124
124
|
<br />
|
125
|
-
<main class="
|
125
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
126
126
|
<br />
|
127
127
|
<div>
|
128
128
|
<h1 class="ForewordTitle">Foreword</h1>
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -92,10 +92,10 @@ RSpec.describe IsoDoc do
|
|
92
92
|
<p id="E">Text</p>
|
93
93
|
</div>
|
94
94
|
<div>
|
95
|
-
<h1>2.  Normative
|
95
|
+
<h1>2.  Normative references</h1>
|
96
96
|
<p>There are no normative references in this document.</p>
|
97
97
|
</div>
|
98
|
-
<div id="H"><h1>3.  Terms and
|
98
|
+
<div id="H"><h1>3.  Terms and definitions</h1><p>For the purposes of this document,
|
99
99
|
the following terms and definitions apply.</p>
|
100
100
|
<p>ISO and IEC maintain terminological databases for use in
|
101
101
|
standardization at the following addresses:</p>
|
@@ -111,11 +111,11 @@ RSpec.describe IsoDoc do
|
|
111
111
|
<p class="TermNum" id="J">3.1.1</p>
|
112
112
|
<p class="Terms" style="text-align:left;">Term2</p>
|
113
113
|
|
114
|
-
</div><div id="K"><h2>3.2. Symbols and
|
114
|
+
</div><div id="K"><h2>3.2. Symbols and abbreviated terms</h2>
|
115
115
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
116
116
|
</div></div>
|
117
117
|
<div id="L" class="Symbols">
|
118
|
-
<h1>4.  Symbols and
|
118
|
+
<h1>4.  Symbols and abbreviated terms</h1>
|
119
119
|
<dl>
|
120
120
|
<dt>
|
121
121
|
<p>Symbol</p>
|
@@ -249,10 +249,10 @@ RSpec.describe IsoDoc do
|
|
249
249
|
<p id="E">Text</p>
|
250
250
|
</div>
|
251
251
|
<div>
|
252
|
-
<h1>2.  Normative
|
252
|
+
<h1>2.  Normative references</h1>
|
253
253
|
<p>There are no normative references in this document.</p>
|
254
254
|
</div>
|
255
|
-
<div id="H"><h1>3.  Terms and
|
255
|
+
<div id="H"><h1>3.  Terms and definitions</h1><p>For the purposes of this document,
|
256
256
|
the following terms and definitions apply.</p>
|
257
257
|
<p>ISO and IEC maintain terminological databases for use in
|
258
258
|
standardization at the following addresses:</p>
|
@@ -268,11 +268,11 @@ RSpec.describe IsoDoc do
|
|
268
268
|
<p class="TermNum" id="J">3.1.1</p>
|
269
269
|
<p class="Terms" style="text-align:left;">Term2</p>
|
270
270
|
|
271
|
-
</div><div id="K"><h2>3.2. Symbols and
|
271
|
+
</div><div id="K"><h2>3.2. Symbols and abbreviated terms</h2>
|
272
272
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
273
273
|
</div></div>
|
274
274
|
<div id="L" class="Symbols">
|
275
|
-
<h1>4.  Symbols and
|
275
|
+
<h1>4.  Symbols and abbreviated terms</h1>
|
276
276
|
<dl>
|
277
277
|
<dt>
|
278
278
|
<p>Symbol</p>
|
@@ -424,7 +424,7 @@ RSpec.describe IsoDoc do
|
|
424
424
|
<p class="TermNum" id="J">3.1.1</p>
|
425
425
|
<p class="Terms" style="text-align:left;">Term2</p>
|
426
426
|
|
427
|
-
</div><div id="K"><h2>3.2.
|
427
|
+
</div><div id="K"><h2>3.2. Symboles et termes abrégés</h2>
|
428
428
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
429
429
|
</div></div>
|
430
430
|
<div id="L" class="Symbols">
|
@@ -592,7 +592,7 @@ RSpec.describe IsoDoc do
|
|
592
592
|
<p class="TermNum" id="J">3.1.1</p>
|
593
593
|
<p class="Terms" style="text-align:left;">Term2</p>
|
594
594
|
|
595
|
-
</div><div id="K"><h2>3.2.
|
595
|
+
</div><div id="K"><h2>3.2. 符号、代号和缩略语</h2>
|
596
596
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
597
597
|
</div></div>
|
598
598
|
<div id="L" class="Symbols">
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -180,7 +180,7 @@ RSpec.describe IsoDoc do
|
|
180
180
|
</div>
|
181
181
|
<p class="zzSTDTitle1"/>
|
182
182
|
<div>
|
183
|
-
<h1>1.  Normative
|
183
|
+
<h1>1.  Normative references</h1>
|
184
184
|
<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>
|
185
185
|
<p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
|
186
186
|
</div>
|
@@ -243,7 +243,7 @@ RSpec.describe IsoDoc do
|
|
243
243
|
</div>
|
244
244
|
<p class="zzSTDTitle1"/>
|
245
245
|
<div>
|
246
|
-
<h1>1.  Normative
|
246
|
+
<h1>1.  Normative references</h1>
|
247
247
|
<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>
|
248
248
|
<p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
|
249
249
|
</div>
|
data/spec/isodoc/iso_spec.rb
CHANGED
@@ -86,4 +86,83 @@ RSpec.describe IsoDoc do
|
|
86
86
|
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Cambria", serif;]m)
|
87
87
|
end
|
88
88
|
|
89
|
+
it "does not include IEV in references" do
|
90
|
+
expect(IsoDoc::Iso::Convert.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–2014</a>
|
153
|
+
</p>
|
154
|
+
</div>
|
155
|
+
<p class="zzSTDTitle1"/>
|
156
|
+
<div>
|
157
|
+
<h1>1.  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–2014, <i> Cereals and pulses</i></p>
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
</body>
|
163
|
+
</html>
|
164
|
+
|
165
|
+
OUTPUT
|
166
|
+
end
|
167
|
+
|
89
168
|
end
|
@@ -3,7 +3,11 @@ require "nokogiri"
|
|
3
3
|
|
4
4
|
RSpec.describe IsoDoc do
|
5
5
|
it "processes IsoXML metadata" do
|
6
|
-
|
6
|
+
c = IsoDoc::Convert.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"
|
7
11
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
8
12
|
<bibdata type="international-standard">
|
9
13
|
<title>
|
@@ -65,12 +69,16 @@ RSpec.describe IsoDoc do
|
|
65
69
|
</version>
|
66
70
|
</iso-standard>
|
67
71
|
INPUT
|
68
|
-
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :confirmeddate=>"XXX", :createddate=>"2010–2011", :docnumber=>"PreCD3 17301-1", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1: Riz", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" ( 0.4, 2016-05-01)", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stageabbr=>"PreCD3", :tc=>"TC 34", :updateddate=>"XXX", :wg=>"WG 3"}
|
72
|
+
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :confirmeddate=>"XXX", :createddate=>"2010–2011", :docnumber=>"PreCD3 17301-1", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1: Riz", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stageabbr=>"PreCD3", :tc=>"TC 34", :updateddate=>"XXX", :wg=>"WG 3"}
|
69
73
|
OUTPUT
|
70
74
|
end
|
71
75
|
|
72
76
|
it "processes IsoXML metadata" do
|
73
|
-
|
77
|
+
c = IsoDoc::Convert.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"
|
74
82
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
75
83
|
<bibdata type="international-standard">
|
76
84
|
<title>
|
@@ -135,7 +143,7 @@ OUTPUT
|
|
135
143
|
</version>
|
136
144
|
</iso-standard>
|
137
145
|
INPUT
|
138
|
-
{:accesseddate=>"XXX", :agency=>"ISO/IEC", :confirmeddate=>"XXX", :createddate=>"XXX", :docnumber=>"CD 17301-1-3", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1–3: Riz", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1–3: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" ( 12, 2016-05-01)", :editorialgroup=>["ABC 34", "DEF 4", "GHI 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", :stageabbr=>"CD", :tc=>"ABC 34", :updateddate=>"XXX", :wg=>"GHI 3"}
|
146
|
+
{:accesseddate=>"XXX", :agency=>"ISO/IEC", :confirmeddate=>"XXX", :createddate=>"XXX", :docnumber=>"CD 17301-1-3", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1–3: Riz", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1–3: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05-01)", :editorialgroup=>["ABC 34", "DEF 4", "GHI 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", :stageabbr=>"CD", :tc=>"ABC 34", :updateddate=>"XXX", :wg=>"GHI 3"}
|
139
147
|
OUTPUT
|
140
148
|
end
|
141
149
|
|
@@ -223,7 +223,7 @@ RSpec.describe IsoDoc do
|
|
223
223
|
expect(word).to be_equivalent_to <<~"OUTPUT"
|
224
224
|
<div class="WordSection3">
|
225
225
|
<p class="zzSTDTitle1"></p>
|
226
|
-
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1.<span style="mso-tab-count:1">  </span>Terms and
|
226
|
+
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1.<span style="mso-tab-count:1">  </span>Terms and definitions</h1><p class="MsoNormal">For the purposes of this document,
|
227
227
|
the following terms and definitions apply.</p>
|
228
228
|
<p class="MsoNormal">ISO and IEC maintain terminological databases for use in
|
229
229
|
standardization at the following addresses:</p>
|
@@ -261,8 +261,8 @@ Content-Location: file:///C:/Doc/test_files/header.html
|
|
261
261
|
Content-Transfer-Encoding: base64
|
262
262
|
Content-Type: text/html charset="utf-8"
|
263
263
|
|
264
|
-
|
265
|
-
|
264
|
+
Ci8qIGFuIGVtcHR5IGhlYWRlciAqLwoKU1RBUlQgRE9DIElEOiB7eyBkb2NudW1iZXIgfX06IEVO
|
265
|
+
RCBET0MgSUQKCkZJTEVOQU1FOiB7eyBmaWxlbmFtZSB9fQoK
|
266
266
|
|
267
267
|
OUTPUT
|
268
268
|
end
|
@@ -368,10 +368,10 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
|
|
368
368
|
</sections>
|
369
369
|
</iso-standard>
|
370
370
|
INPUT
|
371
|
-
html = File.read("test.html").sub(/^.*<main class="
|
371
|
+
html = File.read("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
|
372
372
|
sub(%r{</main>.*$}m, "</main>")
|
373
373
|
expect(html).to be_equivalent_to <<~"OUTPUT"
|
374
|
-
<main class="
|
374
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
375
375
|
<p class="zzSTDTitle1"></p>
|
376
376
|
<div>
|
377
377
|
<h1>1.  Clause 4</h1>
|
@@ -413,11 +413,11 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
|
|
413
413
|
</foreword></preface>
|
414
414
|
</iso-standard>
|
415
415
|
INPUT
|
416
|
-
html = File.read("test.html").sub(/^.*<main class="
|
416
|
+
html = File.read("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
|
417
417
|
sub(%r{</main>.*$}m, "</main>")
|
418
418
|
expect(`ls _images`).to match(/\.png$/)
|
419
419
|
expect(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")).to be_equivalent_to <<~"OUTPUT"
|
420
|
-
<main class="
|
420
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
421
421
|
<br />
|
422
422
|
<div>
|
423
423
|
<h1 class="ForewordTitle">Foreword</h1>
|
data/spec/isodoc/ref_spec.rb
CHANGED
@@ -24,7 +24,7 @@ RSpec.describe IsoDoc do
|
|
24
24
|
</bibitem>
|
25
25
|
<bibitem id="ISO16634" type="standard">
|
26
26
|
<title format="text/plain">Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</title>
|
27
|
-
<docidentifier>ISO 16634
|
27
|
+
<docidentifier>ISO 16634</docidentifier>
|
28
28
|
<date type="published"><on>--</on></date>
|
29
29
|
<contributor>
|
30
30
|
<role type="publisher"/>
|
@@ -33,6 +33,7 @@ RSpec.describe IsoDoc do
|
|
33
33
|
</organization>
|
34
34
|
</contributor>
|
35
35
|
<note format="text/plain" reference="1">ISO DATE: Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
|
36
|
+
<allParts>true</allParts>
|
36
37
|
</bibitem>
|
37
38
|
<bibitem id="ISO20483" type="standard">
|
38
39
|
<title format="text/plain">Cereals and pulses</title>
|
@@ -88,10 +89,10 @@ RSpec.describe IsoDoc do
|
|
88
89
|
</div>
|
89
90
|
<p class="zzSTDTitle1"/>
|
90
91
|
<div>
|
91
|
-
<h1>1.  Normative
|
92
|
+
<h1>1.  Normative references</h1>
|
92
93
|
<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>
|
93
94
|
<p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
|
94
|
-
<p id="ISO16634" class="NormRef">ISO 16634:
|
95
|
+
<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>
|
95
96
|
<p id="ISO20483" class="NormRef">ISO 20483: 2013–2014, <i> Cereals and pulses</i></p>
|
96
97
|
<p id="ref1" class="Biblio">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>
|
97
98
|
</div>
|
@@ -111,7 +112,7 @@ RSpec.describe IsoDoc do
|
|
111
112
|
OUTPUT
|
112
113
|
end
|
113
114
|
|
114
|
-
it "processes empty IsoXML Normative
|
115
|
+
it "processes empty IsoXML Normative references" do
|
115
116
|
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
116
117
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
117
118
|
<bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
|
@@ -119,23 +120,10 @@ RSpec.describe IsoDoc do
|
|
119
120
|
</bibliography>
|
120
121
|
</iso-standard>
|
121
122
|
INPUT
|
122
|
-
|
123
|
-
<head>
|
124
|
-
<title>test</title>
|
125
|
-
</head>
|
126
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
127
|
-
<div class="WordSection1">
|
128
|
-
<p> </p>
|
129
|
-
</div>
|
130
|
-
<br/>
|
131
|
-
<div class="WordSection2">
|
132
|
-
<p> </p>
|
133
|
-
</div>
|
134
|
-
<br/>
|
135
|
-
<div class="WordSection3">
|
123
|
+
#{HTML_HDR}
|
136
124
|
<p class="zzSTDTitle1"/>
|
137
125
|
<div>
|
138
|
-
<h1>1.  Normative
|
126
|
+
<h1>1.  Normative references</h1>
|
139
127
|
<p>There are no normative references in this document.</p>
|
140
128
|
</div>
|
141
129
|
</div>
|
data/spec/isodoc/section_spec.rb
CHANGED
@@ -89,10 +89,10 @@ RSpec.describe IsoDoc do
|
|
89
89
|
<p id="E">Text</p>
|
90
90
|
</div>
|
91
91
|
<div>
|
92
|
-
<h1>2.  Normative
|
92
|
+
<h1>2.  Normative references</h1>
|
93
93
|
<p>There are no normative references in this document.</p>
|
94
94
|
</div>
|
95
|
-
<div id="H"><h1>3.  Terms and
|
95
|
+
<div id="H"><h1>3.  Terms and definitions</h1><p>For the purposes of this document,
|
96
96
|
the following terms and definitions apply.</p>
|
97
97
|
<p>ISO and IEC maintain terminological databases for use in
|
98
98
|
standardization at the following addresses:</p>
|
@@ -108,11 +108,11 @@ RSpec.describe IsoDoc do
|
|
108
108
|
<p class="TermNum" id="J">3.1.1</p>
|
109
109
|
<p class="Terms" style="text-align:left;">Term2</p>
|
110
110
|
|
111
|
-
</div><div id="K"><h2>3.2. Symbols and
|
111
|
+
</div><div id="K"><h2>3.2. Symbols and abbreviated terms</h2>
|
112
112
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
113
113
|
</div></div>
|
114
114
|
<div id="L" class="Symbols">
|
115
|
-
<h1>4.  Symbols and
|
115
|
+
<h1>4.  Symbols and abbreviated terms</h1>
|
116
116
|
<dl>
|
117
117
|
<dt>
|
118
118
|
<p>Symbol</p>
|
@@ -257,10 +257,10 @@ OUTPUT
|
|
257
257
|
<p id="E">Text</p>
|
258
258
|
</div>
|
259
259
|
<div>
|
260
|
-
<h1>2.<span style="mso-tab-count:1">  </span>Normative
|
260
|
+
<h1>2.<span style="mso-tab-count:1">  </span>Normative references</h1>
|
261
261
|
<p>There are no normative references in this document.</p>
|
262
262
|
</div>
|
263
|
-
<div id="H"><h1>3.<span style="mso-tab-count:1">  </span>Terms and
|
263
|
+
<div id="H"><h1>3.<span style="mso-tab-count:1">  </span>Terms and definitions</h1><p>For the purposes of this document,
|
264
264
|
the following terms and definitions apply.</p>
|
265
265
|
<p>ISO and IEC maintain terminological databases for use in
|
266
266
|
standardization at the following addresses:</p>
|
@@ -276,11 +276,11 @@ OUTPUT
|
|
276
276
|
<p class="TermNum" id="J">3.1.1</p>
|
277
277
|
<p class="Terms" style="text-align:left;">Term2</p>
|
278
278
|
|
279
|
-
</div><div id="K"><h2>3.2. Symbols and
|
279
|
+
</div><div id="K"><h2>3.2. Symbols and abbreviated terms</h2>
|
280
280
|
<table class="dl"><tr><td valign="top" align="left"><p align="left" style="margin-left:0pt;text-align:left;">Symbol</p></td><td valign="top">Definition</td></tr></table>
|
281
281
|
</div></div>
|
282
282
|
<div id="L" class="Symbols">
|
283
|
-
<h1>4.<span style="mso-tab-count:1">  </span>Symbols and
|
283
|
+
<h1>4.<span style="mso-tab-count:1">  </span>Symbols and abbreviated terms</h1>
|
284
284
|
<table class="dl">
|
285
285
|
<tr>
|
286
286
|
<td valign="top" align="left">
|
@@ -337,22 +337,9 @@ OUTPUT
|
|
337
337
|
</sections>
|
338
338
|
</iso-standard>
|
339
339
|
INPUT
|
340
|
-
|
341
|
-
<head>
|
342
|
-
<title>test</title>
|
343
|
-
</head>
|
344
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
345
|
-
<div class="WordSection1">
|
346
|
-
<p> </p>
|
347
|
-
</div>
|
348
|
-
<br/>
|
349
|
-
<div class="WordSection2">
|
350
|
-
<p> </p>
|
351
|
-
</div>
|
352
|
-
<br/>
|
353
|
-
<div class="WordSection3">
|
340
|
+
#{HTML_HDR}
|
354
341
|
<p class="zzSTDTitle1"/>
|
355
|
-
<div id="H"><h1>1.  Terms and
|
342
|
+
<div id="H"><h1>1.  Terms and definitions</h1><p>For the purposes of this document,
|
356
343
|
the following terms and definitions apply.</p>
|
357
344
|
<p>ISO and IEC maintain terminological databases for use in
|
358
345
|
standardization at the following addresses:</p>
|
@@ -398,27 +385,14 @@ OUTPUT
|
|
398
385
|
</bibliography>
|
399
386
|
</iso-standard>
|
400
387
|
INPUT
|
401
|
-
|
402
|
-
<head>
|
403
|
-
<title>test</title>
|
404
|
-
</head>
|
405
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
406
|
-
<div class="WordSection1">
|
407
|
-
<p> </p>
|
408
|
-
</div>
|
409
|
-
<br/>
|
410
|
-
<div class="WordSection2">
|
411
|
-
<p> </p>
|
412
|
-
</div>
|
413
|
-
<br/>
|
414
|
-
<div class="WordSection3">
|
388
|
+
#{HTML_HDR}
|
415
389
|
<p class="zzSTDTitle1"/>
|
416
390
|
<div>
|
417
|
-
<h1>1.  Normative
|
391
|
+
<h1>1.  Normative references</h1>
|
418
392
|
<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>
|
419
393
|
<p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</i></p>
|
420
394
|
</div>
|
421
|
-
<div id="H"><h1>2.  Terms and
|
395
|
+
<div id="H"><h1>2.  Terms and definitions</h1><p>For the purposes of this document, the terms and definitions
|
422
396
|
given in ISO 712 and the following apply.</p>
|
423
397
|
<p>ISO and IEC maintain terminological databases for use in
|
424
398
|
standardization at the following addresses:</p>
|
@@ -463,27 +437,14 @@ OUTPUT
|
|
463
437
|
</bibliography>
|
464
438
|
</iso-standard>
|
465
439
|
INPUT
|
466
|
-
|
467
|
-
<head>
|
468
|
-
<title>test</title>
|
469
|
-
</head>
|
470
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
471
|
-
<div class="WordSection1">
|
472
|
-
<p> </p>
|
473
|
-
</div>
|
474
|
-
<br/>
|
475
|
-
<div class="WordSection2">
|
476
|
-
<p> </p>
|
477
|
-
</div>
|
478
|
-
<br/>
|
479
|
-
<div class="WordSection3">
|
440
|
+
#{HTML_HDR}
|
480
441
|
<p class="zzSTDTitle1"/>
|
481
442
|
<div>
|
482
|
-
<h1>1.  Normative
|
443
|
+
<h1>1.  Normative references</h1>
|
483
444
|
<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>
|
484
445
|
<p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products?~@~I?~@~T?~@~IDetermination of moisture content?~@~I?~@~T?~@~IReference method</i></p>
|
485
446
|
</div>
|
486
|
-
<div id="H"><h1>2.  Terms and
|
447
|
+
<div id="H"><h1>2.  Terms and definitions</h1><p>For the purposes of this document,
|
487
448
|
the terms and definitions given in ISO 712, ISO 712 and ISO 712 apply.</p>
|
488
449
|
<p>ISO and IEC maintain terminological databases for use in
|
489
450
|
standardization at the following addresses:</p>
|
@@ -511,22 +472,9 @@ OUTPUT
|
|
511
472
|
</sections>
|
512
473
|
</iso-standard>
|
513
474
|
INPUT
|
514
|
-
|
515
|
-
<head>
|
516
|
-
<title>test</title>
|
517
|
-
</head>
|
518
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
519
|
-
<div class="WordSection1">
|
520
|
-
<p> </p>
|
521
|
-
</div>
|
522
|
-
<br/>
|
523
|
-
<div class="WordSection2">
|
524
|
-
<p> </p>
|
525
|
-
</div>
|
526
|
-
<br/>
|
527
|
-
<div class="WordSection3">
|
475
|
+
#{HTML_HDR}
|
528
476
|
<p class="zzSTDTitle1"/>
|
529
|
-
<div id="H"><h1>1.  Terms and
|
477
|
+
<div id="H"><h1>1.  Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
|
530
478
|
<p>ISO and IEC maintain terminological databases for use in
|
531
479
|
standardization at the following addresses:</p>
|
532
480
|
|
@@ -557,20 +505,7 @@ OUTPUT
|
|
557
505
|
</sections>
|
558
506
|
</iso-standard>
|
559
507
|
INPUT
|
560
|
-
|
561
|
-
<head>
|
562
|
-
<title>test</title>
|
563
|
-
</head>
|
564
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
565
|
-
<div class="WordSection1">
|
566
|
-
<p> </p>
|
567
|
-
</div>
|
568
|
-
<br/>
|
569
|
-
<div class="WordSection2">
|
570
|
-
<p> </p>
|
571
|
-
</div>
|
572
|
-
<br/>
|
573
|
-
<div class="WordSection3">
|
508
|
+
#{HTML_HDR}
|
574
509
|
<p class="zzSTDTitle1"/>
|
575
510
|
<div id="M">
|
576
511
|
<h1>1.  Clause 4</h1>
|