metanorma-iso 2.2.1 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/iso/html/header-dis.html +111 -29
- data/lib/isodoc/iso/html/isodoc-dis.css +65 -64
- data/lib/isodoc/iso/html/isodoc-dis.scss +65 -64
- data/lib/isodoc/iso/html/style-human.css +2 -3
- data/lib/isodoc/iso/html/style-human.scss +0 -1
- data/lib/isodoc/iso/html/style-iso.css +2 -3
- data/lib/isodoc/iso/html/style-iso.scss +0 -1
- data/lib/isodoc/iso/html/wordstyle-dis.css +10 -4
- data/lib/isodoc/iso/html/wordstyle-dis.scss +10 -4
- data/lib/isodoc/iso/i18n-en.yaml +13 -8
- data/lib/isodoc/iso/i18n-fr.yaml +9 -3
- data/lib/isodoc/iso/i18n-ru.yaml +9 -2
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -2
- data/lib/isodoc/iso/iso.amendment.xsl +226 -40
- data/lib/isodoc/iso/iso.international-standard.xsl +226 -40
- data/lib/isodoc/iso/presentation_bibdata.rb +13 -9
- data/lib/isodoc/iso/presentation_xml_convert.rb +5 -3
- data/lib/isodoc/iso/presentation_xref.rb +10 -7
- data/lib/isodoc/iso/sections.rb +1 -1
- data/lib/isodoc/iso/word_convert.rb +6 -4
- data/lib/isodoc/iso/word_dis_cleanup.rb +24 -3
- data/lib/isodoc/iso/word_dis_convert.rb +4 -1
- data/lib/metanorma/iso/base.rb +2 -1
- data/lib/metanorma/iso/basicdoc.rng +0 -27
- data/lib/metanorma/iso/biblio-standoc.rng +164 -0
- data/lib/metanorma/iso/biblio.rng +50 -18
- data/lib/metanorma/iso/isodoc.rng +68 -206
- data/lib/metanorma/iso/isostandard-amd.rng +3 -54
- data/lib/metanorma/iso/isostandard-compile.rng +7 -0
- data/lib/metanorma/iso/isostandard.rng +1 -195
- data/lib/metanorma/iso/relaton-iso.rng +225 -0
- data/lib/metanorma/iso/validate.rb +6 -6
- data/lib/metanorma/iso/version.rb +1 -1
- data/lib/metanorma/requirements/modspec.rb +22 -38
- data/metanorma-iso.gemspec +5 -2
- metadata +7 -86
- data/.github/workflows/rake.yml +0 -15
- data/.github/workflows/release.yml +0 -24
- data/.github/workflows/ubuntu.yml +0 -41
- data/Rakefile +0 -8
- data/bin/rspec +0 -17
- data/spec/assets/header.html +0 -7
- data/spec/assets/html.css +0 -2
- data/spec/assets/htmlcover.html +0 -4
- data/spec/assets/htmlintro.html +0 -5
- data/spec/assets/i18n.yaml +0 -2
- data/spec/assets/iso.adoc +0 -10
- data/spec/assets/iso.headless.html +0 -33
- data/spec/assets/iso.xml +0 -71
- data/spec/assets/rice_image1.png +0 -0
- data/spec/assets/scripts.html +0 -3
- data/spec/assets/std.css +0 -2
- data/spec/assets/word.css +0 -2
- data/spec/assets/wordcover.html +0 -3
- data/spec/assets/wordintro.html +0 -4
- data/spec/examples/103_01_02.html +0 -247
- data/spec/examples/english.yaml +0 -69
- data/spec/examples/iso_123_.xml +0 -45
- data/spec/examples/iso_123_all_parts.xml +0 -45
- data/spec/examples/iso_123_no_year_note.xml +0 -46
- data/spec/examples/iso_124_.xml +0 -41
- data/spec/examples/iso_216_.xml +0 -47
- data/spec/examples/iso_iec_12382_.xml +0 -48
- data/spec/examples/rice.adoc +0 -714
- data/spec/examples/rice.preview.html +0 -1870
- data/spec/examples/rice.sh +0 -4
- data/spec/examples/rice_img/1000-1_ed2amd3fig1a.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig1b.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig2.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig3.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig4.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig5_f.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figA.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figA1.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figA2.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figTab1.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figTab2.png +0 -0
- data/spec/examples/rice_img/1001_ed2amd3fig1.png +0 -0
- data/spec/examples/rice_img/ISO_1213_1.png +0 -0
- data/spec/examples/rice_img/SL1000-1_ed2amd3fig1.png +0 -0
- data/spec/examples/rice_img/rice_image1.png +0 -0
- data/spec/examples/rice_img/rice_image2.png +0 -0
- data/spec/examples/rice_img/rice_image3_1.png +0 -0
- data/spec/examples/rice_img/rice_image3_2.png +0 -0
- data/spec/examples/rice_img/rice_image3_3.png +0 -0
- data/spec/isodoc/amd_spec.rb +0 -986
- data/spec/isodoc/blocks_spec.rb +0 -1174
- data/spec/isodoc/i18n_spec.rb +0 -1579
- data/spec/isodoc/inline_spec.rb +0 -1060
- data/spec/isodoc/iso_spec.rb +0 -255
- data/spec/isodoc/metadata_spec.rb +0 -701
- data/spec/isodoc/postproc_spec.rb +0 -1089
- data/spec/isodoc/ref_spec.rb +0 -439
- data/spec/isodoc/section_spec.rb +0 -998
- data/spec/isodoc/table_spec.rb +0 -420
- data/spec/isodoc/terms_spec.rb +0 -314
- data/spec/isodoc/word_dis_spec.rb +0 -2064
- data/spec/isodoc/xref_spec.rb +0 -1747
- data/spec/metanorma/amd_spec.rb +0 -724
- data/spec/metanorma/base_spec.rb +0 -1384
- data/spec/metanorma/blank_spec.rb +0 -38
- data/spec/metanorma/blocks_spec.rb +0 -624
- data/spec/metanorma/cleanup_spec.rb +0 -1645
- data/spec/metanorma/inline_spec.rb +0 -203
- data/spec/metanorma/lists_spec.rb +0 -197
- data/spec/metanorma/macros_spec.rb +0 -99
- data/spec/metanorma/processor_spec.rb +0 -161
- data/spec/metanorma/refs_spec.rb +0 -672
- data/spec/metanorma/section_spec.rb +0 -492
- data/spec/metanorma/table_spec.rb +0 -329
- data/spec/metanorma/validate_spec.rb +0 -2153
- data/spec/relaton/render_spec.rb +0 -568
- data/spec/requirements/requirement_components_spec.rb +0 -622
- data/spec/requirements/requirements_spec.rb +0 -1681
- data/spec/requirements/xref_spec.rb +0 -1211
- data/spec/spec_helper.rb +0 -313
- data/spec/vcr_cassettes/docrels.yml +0 -385
- data/spec/vcr_cassettes/withdrawn_iso.yml +0 -295
@@ -1,1089 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "fileutils"
|
3
|
-
|
4
|
-
WORD_HTML_CSS = {
|
5
|
-
wordstylesheet: "spec/assets/word.css",
|
6
|
-
htmlstylesheet: "spec/assets/html.css",
|
7
|
-
}.freeze
|
8
|
-
|
9
|
-
WORD_HTML_CSS_SUBDIR = {
|
10
|
-
wordstylesheet: "word.css",
|
11
|
-
htmlstylesheet: "html.css",
|
12
|
-
}.freeze
|
13
|
-
|
14
|
-
WORD_HTML_CSS_HEADER_HTML = {
|
15
|
-
wordstylesheet: "spec/assets/word.css",
|
16
|
-
htmlstylesheet: "spec/assets/html.css",
|
17
|
-
header: "spec/assets/header.html",
|
18
|
-
}.freeze
|
19
|
-
|
20
|
-
WORD_HTML_CSS_WORDINTRO = {
|
21
|
-
wordstylesheet: "spec/assets/word.css",
|
22
|
-
htmlstylesheet: "spec/assets/html.css",
|
23
|
-
wordintropage: "spec/assets/wordintro.html",
|
24
|
-
}.freeze
|
25
|
-
|
26
|
-
RSpec.describe IsoDoc do
|
27
|
-
it "generates file based on string input" do
|
28
|
-
IsoDoc::Iso::HtmlConvert
|
29
|
-
.new(WORD_HTML_CSS.merge(filename: "test"))
|
30
|
-
.convert("test", <<~"INPUT", false)
|
31
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
32
|
-
<bibdata>
|
33
|
-
<title format="text/plain" language="en" type="title-intro">Cereals and pulses</title>
|
34
|
-
<title format="text/plain" language="en" type="title-main">Specifications and test methods</title>
|
35
|
-
<title format="text/plain" language="en" type="title-part">Rice</title>
|
36
|
-
</bibdata>
|
37
|
-
<preface>
|
38
|
-
<foreword>
|
39
|
-
<note>
|
40
|
-
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
41
|
-
</note>
|
42
|
-
</foreword>
|
43
|
-
</preface>
|
44
|
-
</iso-standard>
|
45
|
-
INPUT
|
46
|
-
expect(File.exist?("test.html")).to be true
|
47
|
-
html = File.read("test.html", encoding: "UTF-8")
|
48
|
-
expect(html).to include "<title>Cereals and pulses — "\
|
49
|
-
"Specifications and test methods — Rice</title>"
|
50
|
-
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
|
51
|
-
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
|
52
|
-
end
|
53
|
-
|
54
|
-
it "generates HTML output docs with null configuration" do
|
55
|
-
IsoDoc::Iso::HtmlConvert
|
56
|
-
.new(WORD_HTML_CSS.dup)
|
57
|
-
.convert("test", <<~"INPUT", false)
|
58
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
59
|
-
<bibdata>
|
60
|
-
<title format="text/plain" language="en" type="title-intro">Cereals and pulses</title>
|
61
|
-
<title format="text/plain" language="en" type="title-main">Specifications and test methods</title>
|
62
|
-
<title format="text/plain" language="en" type="title-part">Rice</title>
|
63
|
-
</bibdata>
|
64
|
-
<preface>
|
65
|
-
<foreword>
|
66
|
-
<note>
|
67
|
-
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
68
|
-
</note>
|
69
|
-
</foreword>
|
70
|
-
</preface>
|
71
|
-
</iso-standard>
|
72
|
-
INPUT
|
73
|
-
expect(File.exist?("test.html")).to be true
|
74
|
-
html = File.read("test.html", encoding: "UTF-8")
|
75
|
-
expect(html).to include "title>Cereals and pulses — "\
|
76
|
-
"Specifications and test methods — Rice</title>"
|
77
|
-
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
|
78
|
-
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
|
79
|
-
end
|
80
|
-
|
81
|
-
it "generates Word output docs with null configuration" do
|
82
|
-
IsoDoc::Iso::WordConvert
|
83
|
-
.new(WORD_HTML_CSS.dup)
|
84
|
-
.convert("test", <<~"INPUT", false)
|
85
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
86
|
-
<preface>
|
87
|
-
<foreword>
|
88
|
-
<note>
|
89
|
-
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
90
|
-
</note>
|
91
|
-
</foreword>
|
92
|
-
</preface>
|
93
|
-
</iso-standard>
|
94
|
-
INPUT
|
95
|
-
expect(File.exist?("test.doc")).to be true
|
96
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
97
|
-
expect(word).to match(/<style>/)
|
98
|
-
end
|
99
|
-
|
100
|
-
it "generates HTML output docs with null configuration from file" do
|
101
|
-
IsoDoc::Iso::HtmlConvert
|
102
|
-
.new(WORD_HTML_CSS_SUBDIR.dup)
|
103
|
-
.convert("spec/assets/iso.xml", nil, false)
|
104
|
-
expect(File.exist?("spec/assets/iso.html")).to be true
|
105
|
-
html = File.read("spec/assets/iso.html", encoding: "UTF-8")
|
106
|
-
expect(html).to match(/<style>/)
|
107
|
-
expect(html).to match(%r{https://use.fontawesome.com})
|
108
|
-
expect(html).to match(%r{libs/jquery})
|
109
|
-
end
|
110
|
-
|
111
|
-
it "generates Word output docs with null configuration from file" do
|
112
|
-
IsoDoc::Iso::WordConvert
|
113
|
-
.new(WORD_HTML_CSS_SUBDIR.dup)
|
114
|
-
.convert("spec/assets/iso.xml", nil, false)
|
115
|
-
expect(File.exist?("spec/assets/iso.doc")).to be true
|
116
|
-
word = File.read("spec/assets/iso.doc", encoding: "UTF-8")
|
117
|
-
expect(word).to match(/<w:WordDocument>/)
|
118
|
-
expect(word).to match(/<style>/)
|
119
|
-
end
|
120
|
-
|
121
|
-
it "generates Pdf output docs with null configuration from file" do
|
122
|
-
mock_pdf
|
123
|
-
IsoDoc::Iso::PdfConvert
|
124
|
-
.new(WORD_HTML_CSS.dup)
|
125
|
-
.convert("spec/assets/iso.xml", nil, false)
|
126
|
-
expect(File.exist?("spec/assets/iso.pdf")).to be true
|
127
|
-
end
|
128
|
-
|
129
|
-
it "populates Word template with terms reference labels" do
|
130
|
-
IsoDoc::Iso::WordConvert
|
131
|
-
.new(WORD_HTML_CSS.dup)
|
132
|
-
.convert("test", <<~"INPUT", false)
|
133
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
134
|
-
<sections>
|
135
|
-
<terms id="_terms_and_definitions" obligation="normative">
|
136
|
-
<title>1
|
137
|
-
<tab/>
|
138
|
-
Terms and Definitions</title>
|
139
|
-
<term id="paddy1">
|
140
|
-
<name>1.1</name>
|
141
|
-
<preferred>paddy</preferred>
|
142
|
-
<definition>
|
143
|
-
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
|
144
|
-
</definition>
|
145
|
-
<termsource status="modified">[SOURCE:
|
146
|
-
<origin bibitemid="ISO7301" citeas="ISO 7301:2011" type="inline"><locality type="clause">
|
147
|
-
<referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>, modified –
|
148
|
-
The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]
|
149
|
-
</termsource>
|
150
|
-
</term>
|
151
|
-
</terms>
|
152
|
-
</sections>
|
153
|
-
</iso-standard>
|
154
|
-
INPUT
|
155
|
-
|
156
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
157
|
-
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
158
|
-
.sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
|
159
|
-
|
160
|
-
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
161
|
-
<div class='WordSection3'>
|
162
|
-
<p class='zzSTDTitle1'/>
|
163
|
-
<div>
|
164
|
-
<a name='_terms_and_definitions' id='_terms_and_definitions'/>
|
165
|
-
<h1>
|
166
|
-
1
|
167
|
-
<span style='mso-tab-count:1'>  </span>
|
168
|
-
Terms and Definitions
|
169
|
-
</h1>
|
170
|
-
<p class='TermNum'>
|
171
|
-
<a name='paddy1' id='paddy1'/>
|
172
|
-
1.1
|
173
|
-
</p>
|
174
|
-
<p class='Terms' style='text-align:left;'>paddy</p>
|
175
|
-
<p class='Definition'>
|
176
|
-
<a name='_eb29b35e-123e-4d1c-b50b-2714d41e747f' id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'/>
|
177
|
-
rice retaining its husk after threshing
|
178
|
-
</p>
|
179
|
-
<p class='Source'>
|
180
|
-
[SOURCE: ISO 7301:2011, 3.1, modified – The term "cargo rice" is shown as deprecated, and Note
|
181
|
-
1 to entry is not included here]
|
182
|
-
</p>
|
183
|
-
</div>
|
184
|
-
</div>
|
185
|
-
OUTPUT
|
186
|
-
end
|
187
|
-
|
188
|
-
it "populates Word header" do
|
189
|
-
IsoDoc::Iso::WordConvert
|
190
|
-
.new(WORD_HTML_CSS_HEADER_HTML.dup)
|
191
|
-
.convert("test", <<~"INPUT", false)
|
192
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
193
|
-
<bibdata type="article">
|
194
|
-
<docidentifier>
|
195
|
-
<project-number part="1">1000</project-number>
|
196
|
-
</docidentifier>
|
197
|
-
</bibdata>
|
198
|
-
</iso-standard>
|
199
|
-
INPUT
|
200
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
201
|
-
expect(word).to include('Content-Disposition: inline; filename="header.html"')
|
202
|
-
end
|
203
|
-
|
204
|
-
it "populates HTML ToC" do
|
205
|
-
IsoDoc::Iso::HtmlConvert
|
206
|
-
.new(WORD_HTML_CSS.dup)
|
207
|
-
.convert("test", <<~"INPUT", false)
|
208
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
209
|
-
<sections>
|
210
|
-
<clause id="A" inline-header="false" obligation="normative">
|
211
|
-
<title>1
|
212
|
-
<tab/>
|
213
|
-
Clause 4</title>
|
214
|
-
<clause id="N" inline-header="false" obligation="normative">
|
215
|
-
<title>1.1
|
216
|
-
<tab/>
|
217
|
-
Introduction
|
218
|
-
<bookmark id="Q"/>
|
219
|
-
to this
|
220
|
-
<fn reference="1">
|
221
|
-
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
|
222
|
-
</title>
|
223
|
-
</clause>
|
224
|
-
<clause id="O" inline-header="false" obligation="normative">
|
225
|
-
<title>1.2
|
226
|
-
<tab/>
|
227
|
-
Clause 4.2</title>
|
228
|
-
<p>A
|
229
|
-
<fn reference="1">
|
230
|
-
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
|
231
|
-
</p>
|
232
|
-
</clause>
|
233
|
-
</clause>
|
234
|
-
<clause id="P"><title>2<tab/>Clause 5</title>
|
235
|
-
<clause id="P1"><title>2.1<tab/>Clause 5.1</title></clause>
|
236
|
-
</clause>
|
237
|
-
<clause id="Q"><title>3<tab/>Clause 6</title></clause>
|
238
|
-
</sections>
|
239
|
-
</iso-standard>
|
240
|
-
INPUT
|
241
|
-
|
242
|
-
html = Nokogiri::XML(File.read("test.html", encoding: "UTF-8"))
|
243
|
-
.at("//div[@id = 'toc']").to_xml
|
244
|
-
|
245
|
-
expect(xmlpp(html))
|
246
|
-
.to be_equivalent_to xmlpp(<<~'OUTPUT')
|
247
|
-
<div id='toc'>
|
248
|
-
<ul>
|
249
|
-
<li class='h1'>
|
250
|
-
<div class='collapse-group'>
|
251
|
-
<a href='#toc0'>1   Clause 4</a>
|
252
|
-
<div class='collapse-button'/>
|
253
|
-
</div>
|
254
|
-
<ul class='content collapse'>
|
255
|
-
<li class='h2'>
|
256
|
-
<a href='#toc1'> 1.1   Introduction to this </a>
|
257
|
-
</li>
|
258
|
-
<li class='h2'>
|
259
|
-
<a href='#toc2'> 1.2   Clause 4.2</a>
|
260
|
-
</li>
|
261
|
-
</ul>
|
262
|
-
</li>
|
263
|
-
<li class='h1'>
|
264
|
-
<div class='collapse-group'>
|
265
|
-
<a href='#toc3'>2  Clause 5</a>
|
266
|
-
<div class='collapse-button'/>
|
267
|
-
</div>
|
268
|
-
<ul class='content collapse'>
|
269
|
-
<li class='h2'>
|
270
|
-
<a href='#toc4'> 2.1  Clause 5.1</a>
|
271
|
-
</li>
|
272
|
-
</ul>
|
273
|
-
</li>
|
274
|
-
<li class='h1'>
|
275
|
-
<a href='#toc5'> 3  Clause 6</a>
|
276
|
-
</li>
|
277
|
-
</ul>
|
278
|
-
</div>
|
279
|
-
OUTPUT
|
280
|
-
end
|
281
|
-
|
282
|
-
it "populates Word ToC" do
|
283
|
-
IsoDoc::Iso::WordConvert
|
284
|
-
.new(WORD_HTML_CSS_WORDINTRO.dup)
|
285
|
-
.convert("test", <<~"INPUT", false)
|
286
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
287
|
-
<sections>
|
288
|
-
<clause id="A" inline-header="false" obligation="normative">
|
289
|
-
<title>1
|
290
|
-
<tab/>
|
291
|
-
Clause 4</title>
|
292
|
-
<clause id="N" inline-header="false" obligation="normative">
|
293
|
-
<title>1.1
|
294
|
-
<tab/>
|
295
|
-
Introduction
|
296
|
-
<bookmark id="Q"/>
|
297
|
-
to this
|
298
|
-
<fn reference="1">
|
299
|
-
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
|
300
|
-
</title>
|
301
|
-
</clause>
|
302
|
-
<clause id="O" inline-header="false" obligation="normative">
|
303
|
-
<title>1.2
|
304
|
-
<tab/>
|
305
|
-
Clause 4.2</title>
|
306
|
-
<p>A
|
307
|
-
<fn reference="1">
|
308
|
-
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
|
309
|
-
</p>
|
310
|
-
</clause>
|
311
|
-
</clause>
|
312
|
-
</sections>
|
313
|
-
<annex id="AA"><title>Annex A<tab/>Annex First</title></annex>
|
314
|
-
</iso-standard>
|
315
|
-
INPUT
|
316
|
-
|
317
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
318
|
-
.sub(/^.*An empty word intro page\./m, "")
|
319
|
-
.sub(%r{</div>.*$}m, "</div>")
|
320
|
-
.gsub(/<o:p> <\/o:p>/, "")
|
321
|
-
|
322
|
-
expect(xmlpp("<div>#{word.gsub(/_Toc\d\d+/, '_Toc')}"))
|
323
|
-
.to be_equivalent_to xmlpp(<<~'OUTPUT')
|
324
|
-
<div>
|
325
|
-
<p class="MsoToc1">
|
326
|
-
<span lang="EN-GB" xml:lang="EN-GB">
|
327
|
-
<span style="mso-element:field-begin"/>
|
328
|
-
<span style='mso-spacerun:yes'> </span>
|
329
|
-
TOC \o "1-3" \h \z \t "Heading 1;1;ANNEX;1;Biblio Title;1;Foreword
|
330
|
-
Title;1;Intro Title;1"
|
331
|
-
<span style="mso-element:field-separator"/></span>
|
332
|
-
<span class="MsoHyperlink">
|
333
|
-
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
334
|
-
<a href="#_Toc">1 Clause 4
|
335
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
336
|
-
<span style="mso-tab-count:1 dotted">. </span></span>
|
337
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
338
|
-
<span style="mso-element:field-begin"/>
|
339
|
-
</span>
|
340
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
|
341
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
342
|
-
<span style="mso-element:field-separator"/>
|
343
|
-
</span>
|
344
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
|
345
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
|
346
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
347
|
-
<span style="mso-element:field-end"/>
|
348
|
-
</span>
|
349
|
-
</a>
|
350
|
-
</span>
|
351
|
-
</span>
|
352
|
-
</p>
|
353
|
-
<p class="MsoToc2">
|
354
|
-
<span class="MsoHyperlink">
|
355
|
-
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
356
|
-
<a href="#_Toc">1.1 Introduction to this
|
357
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
358
|
-
<span style="mso-tab-count:1 dotted">. </span></span>
|
359
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
360
|
-
<span style="mso-element:field-begin"/>
|
361
|
-
</span>
|
362
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
|
363
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
364
|
-
<span style="mso-element:field-separator"/>
|
365
|
-
</span>
|
366
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
|
367
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
|
368
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
369
|
-
<span style="mso-element:field-end"/>
|
370
|
-
</span>
|
371
|
-
</a>
|
372
|
-
</span>
|
373
|
-
</span>
|
374
|
-
</p>
|
375
|
-
<p class="MsoToc2">
|
376
|
-
<span class="MsoHyperlink">
|
377
|
-
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
378
|
-
<a href="#_Toc">1.2 Clause 4.2
|
379
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
380
|
-
<span style="mso-tab-count:1 dotted">. </span></span>
|
381
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
382
|
-
<span style="mso-element:field-begin"/>
|
383
|
-
</span>
|
384
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
|
385
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
386
|
-
<span style="mso-element:field-separator"/>
|
387
|
-
</span>
|
388
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
|
389
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
|
390
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
391
|
-
<span style="mso-element:field-end"/>
|
392
|
-
</span>
|
393
|
-
</a>
|
394
|
-
</span>
|
395
|
-
</span>
|
396
|
-
</p>
|
397
|
-
<p class='MsoToc1'>
|
398
|
-
<span class='MsoHyperlink'>
|
399
|
-
<span lang='EN-GB' xml:lang='EN-GB' style='mso-no-proof:yes'>
|
400
|
-
<a href='#_Toc'>
|
401
|
-
Annex A Annex First
|
402
|
-
<span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
|
403
|
-
<span style='mso-tab-count:1 dotted'>. </span>
|
404
|
-
</span>
|
405
|
-
<span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
|
406
|
-
<span style='mso-element:field-begin'/>
|
407
|
-
</span>
|
408
|
-
<span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'> PAGEREF _Toc \h </span>
|
409
|
-
<span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
|
410
|
-
<span style='mso-element:field-separator'/>
|
411
|
-
</span>
|
412
|
-
<span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>1</span>
|
413
|
-
<span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'/>
|
414
|
-
<span lang='EN-GB' xml:lang='EN-GB' class='MsoTocTextSpan'>
|
415
|
-
<span style='mso-element:field-end'/>
|
416
|
-
</span>
|
417
|
-
</a>
|
418
|
-
</span>
|
419
|
-
</span>
|
420
|
-
</p>
|
421
|
-
<p class="MsoToc1">
|
422
|
-
<span lang="EN-GB" xml:lang="EN-GB">
|
423
|
-
<span style="mso-element:field-end"/>
|
424
|
-
</span>
|
425
|
-
<span lang="EN-GB" xml:lang="EN-GB">
|
426
|
-
</span>
|
427
|
-
</p>
|
428
|
-
<p class="MsoNormal"> </p>
|
429
|
-
</div>
|
430
|
-
OUTPUT
|
431
|
-
end
|
432
|
-
|
433
|
-
it "reorders footnote numbers" do
|
434
|
-
input = <<~INPUT
|
435
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
436
|
-
<sections>
|
437
|
-
<clause id="A" inline-header="false" obligation="normative">
|
438
|
-
<title>1
|
439
|
-
<tab/>
|
440
|
-
Clause 4</title>
|
441
|
-
<fn reference="3">
|
442
|
-
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">This is a footnote.</p>
|
443
|
-
</fn>
|
444
|
-
<clause id="N" inline-header="false" obligation="normative">
|
445
|
-
<title>1.1 <tab/>
|
446
|
-
Introduction to this
|
447
|
-
<fn reference="2">
|
448
|
-
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
|
449
|
-
</title>
|
450
|
-
</clause>
|
451
|
-
<clause id="O" inline-header="false" obligation="normative">
|
452
|
-
<title>1.2 <tab/>
|
453
|
-
Clause 4.2</title>
|
454
|
-
<p>A
|
455
|
-
<fn reference="1">
|
456
|
-
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
|
457
|
-
</p>
|
458
|
-
</clause>
|
459
|
-
</clause>
|
460
|
-
</sections>
|
461
|
-
</iso-standard>
|
462
|
-
INPUT
|
463
|
-
|
464
|
-
IsoDoc::Iso::HtmlConvert
|
465
|
-
.new(WORD_HTML_CSS_WORDINTRO.dup)
|
466
|
-
.convert("test", input, false)
|
467
|
-
|
468
|
-
html = File.read("test.html", encoding: "UTF-8")
|
469
|
-
.sub(/^.*<main class="main-section">/m,
|
470
|
-
'<main xmlns:epub="epub" class="main-section">')
|
471
|
-
.sub(%r{</main>.*$}m, "</main>")
|
472
|
-
|
473
|
-
expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
474
|
-
<main class="main-section" xmlns:epub="epub">
|
475
|
-
<button id="myBtn" onclick="topFunction()" title="Go to top">Top</button>
|
476
|
-
<p class="zzSTDTitle1"/>
|
477
|
-
<div id="A">
|
478
|
-
<h1 id="toc0">1   Clause 4</h1>
|
479
|
-
<a class="FootnoteRef" href="#fn:3" id="fnref:1">
|
480
|
-
<sup>1)</sup>
|
481
|
-
</a>
|
482
|
-
<div id="N">
|
483
|
-
<h2 id="toc1">1.1   Introduction to this
|
484
|
-
<a class="FootnoteRef" href="#fn:2" id="fnref:2">
|
485
|
-
<sup>2)</sup></a>
|
486
|
-
</h2>
|
487
|
-
</div>
|
488
|
-
<div id="O">
|
489
|
-
<h2 id="toc2">1.2   Clause 4.2</h2>
|
490
|
-
<p>A
|
491
|
-
<a class="FootnoteRef" href="#fn:2">
|
492
|
-
<sup>2)</sup></a>
|
493
|
-
</p>
|
494
|
-
</div>
|
495
|
-
</div>
|
496
|
-
<aside class="footnote" id="fn:3">
|
497
|
-
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">
|
498
|
-
<a class="FootnoteRef" href="#fn:3">
|
499
|
-
<sup>1)</sup>
|
500
|
-
</a>This is a footnote.</p>
|
501
|
-
<a href="#fnref:1">↩</a>
|
502
|
-
</aside>
|
503
|
-
<aside class="footnote" id="fn:2">
|
504
|
-
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">
|
505
|
-
<a class="FootnoteRef" href="#fn:2">
|
506
|
-
<sup>2)</sup>
|
507
|
-
</a>Formerly denoted as 15 % (m/m).</p>
|
508
|
-
<a href="#fnref:2">↩</a>
|
509
|
-
</aside>
|
510
|
-
</main>
|
511
|
-
OUTPUT
|
512
|
-
|
513
|
-
IsoDoc::Iso::WordConvert
|
514
|
-
.new(WORD_HTML_CSS_WORDINTRO.dup)
|
515
|
-
.convert("test", input, false)
|
516
|
-
|
517
|
-
html = File.read("test.doc", encoding: "UTF-8")
|
518
|
-
.sub(/^.*<div class="WordSection3"/m,
|
519
|
-
'<body xmlns:epub="epub"><div class="WordSection3"')
|
520
|
-
.sub(%r{</body>.*$}m, "</body>")
|
521
|
-
.gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")
|
522
|
-
|
523
|
-
expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
524
|
-
<body xmlns:epub="epub">
|
525
|
-
<div class="WordSection3">
|
526
|
-
<p class="zzSTDTitle1"/>
|
527
|
-
<div>
|
528
|
-
<a id="A" name="A"/>
|
529
|
-
<h1>1
|
530
|
-
<span style="mso-tab-count:1"> </span>
|
531
|
-
Clause 4</h1>
|
532
|
-
<span style="mso-bookmark:_Ref">
|
533
|
-
<a class="FootnoteRef" epub:type="footnote" href="#_ftn1" id="_ftnref1" name="_ftnref1" style="mso-footnote-id:ftn1" title="">
|
534
|
-
<span class="MsoFootnoteReference">
|
535
|
-
<span style="mso-special-character:footnote"/>
|
536
|
-
</span>
|
537
|
-
<span class="MsoFootnoteReference">)</span>
|
538
|
-
</a>
|
539
|
-
</span>
|
540
|
-
<div>
|
541
|
-
<a id="N" name="N"/>
|
542
|
-
<h2>1.1
|
543
|
-
<span style="mso-tab-count:1"> </span>
|
544
|
-
Introduction to this
|
545
|
-
<span style="mso-bookmark:_Ref">
|
546
|
-
<a class="FootnoteRef" epub:type="footnote" href="#_ftn2" id="_ftnref2" name="_ftnref2" style="mso-footnote-id:ftn2" title="">
|
547
|
-
<span class="MsoFootnoteReference">
|
548
|
-
<span style="mso-special-character:footnote"/></span>
|
549
|
-
<span class="MsoFootnoteReference">)</span>
|
550
|
-
</a>
|
551
|
-
</span>
|
552
|
-
</h2>
|
553
|
-
</div>
|
554
|
-
<div>
|
555
|
-
<a id="O" name="O"/>
|
556
|
-
<h2>1.2
|
557
|
-
<span style="mso-tab-count:1"> </span>
|
558
|
-
Clause 4.2</h2>
|
559
|
-
<p class="MsoNormal">A
|
560
|
-
<span style="mso-bookmark:_Ref">
|
561
|
-
<a class="FootnoteRef" epub:type="footnote" href="#_ftn3" id="_ftnref3" name="_ftnref3" style="mso-footnote-id:ftn3" title="">
|
562
|
-
<span class="MsoFootnoteReference">
|
563
|
-
<span style="mso-special-character:footnote"/></span>
|
564
|
-
<span class="MsoFootnoteReference">)</span>
|
565
|
-
</a>
|
566
|
-
</span>
|
567
|
-
</p>
|
568
|
-
</div>
|
569
|
-
</div>
|
570
|
-
</div>
|
571
|
-
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
572
|
-
<div class="colophon"/>
|
573
|
-
<div style="mso-element:footnote-list">
|
574
|
-
<div id="ftn1" style="mso-element:footnote">
|
575
|
-
<p class="MsoFootnoteText">
|
576
|
-
<a id="_ff27c067-2785-4551-96cf-0a73530ff1e6" name="_ff27c067-2785-4551-96cf-0a73530ff1e6"/>
|
577
|
-
<a href="#_ftn1" id="_ftnref1" name="_ftnref1" style="mso-footnote-id:ftn1" title="">
|
578
|
-
<span class="MsoFootnoteReference">
|
579
|
-
<span style="mso-special-character:footnote"/>
|
580
|
-
</span>
|
581
|
-
<span class="MsoFootnoteReference">)</span>
|
582
|
-
</a>This is a footnote.</p>
|
583
|
-
</div>
|
584
|
-
<div id="ftn2" style="mso-element:footnote">
|
585
|
-
<p class="MsoFootnoteText">
|
586
|
-
<a id="_ff27c067-2785-4551-96cf-0a73530ff1e6" name="_ff27c067-2785-4551-96cf-0a73530ff1e6"/>
|
587
|
-
<a href="#_ftn2" id="_ftnref2" name="_ftnref2" style="mso-footnote-id:ftn2" title="">
|
588
|
-
<span class="MsoFootnoteReference">
|
589
|
-
<span style="mso-special-character:footnote"/>
|
590
|
-
</span>
|
591
|
-
<span class="MsoFootnoteReference">)</span>
|
592
|
-
</a>Formerly denoted as 15 % (m/m).</p>
|
593
|
-
</div>
|
594
|
-
<div id="ftn3" style="mso-element:footnote">
|
595
|
-
<p class="MsoFootnoteText">
|
596
|
-
<a id="_ff27c067-2785-4551-96cf-0a73530ff1e6" name="_ff27c067-2785-4551-96cf-0a73530ff1e6"/>
|
597
|
-
<a href="#_ftn3" id="_ftnref3" name="_ftnref3" style="mso-footnote-id:ftn3" title="">
|
598
|
-
<span class="MsoFootnoteReference">
|
599
|
-
<span style="mso-special-character:footnote"/>
|
600
|
-
</span>
|
601
|
-
<span class="MsoFootnoteReference">)</span>
|
602
|
-
</a>Formerly denoted as 15 % (m/m).</p>
|
603
|
-
</div>
|
604
|
-
</div>
|
605
|
-
</body>
|
606
|
-
OUTPUT
|
607
|
-
end
|
608
|
-
|
609
|
-
it "processes IsoXML terms for HTML" do
|
610
|
-
IsoDoc::Iso::HtmlConvert
|
611
|
-
.new(WORD_HTML_CSS.dup)
|
612
|
-
.convert("test", <<~"INPUT", false)
|
613
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
614
|
-
<sections>
|
615
|
-
<terms id="_terms_and_definitions" obligation="normative">
|
616
|
-
<title>Terms and Definitions</title>
|
617
|
-
<term id="paddy1">
|
618
|
-
<name>1.1</name>
|
619
|
-
<preferred>paddy</preferred>
|
620
|
-
<domain>rice</domain>
|
621
|
-
<definition>
|
622
|
-
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
|
623
|
-
</definition>
|
624
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
625
|
-
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
626
|
-
<ul>
|
627
|
-
<li>A</li>
|
628
|
-
</ul>
|
629
|
-
</termexample>
|
630
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
631
|
-
<ul>
|
632
|
-
<li>A</li>
|
633
|
-
</ul>
|
634
|
-
</termexample>
|
635
|
-
<termsource status="modified">
|
636
|
-
<origin bibitemid="ISO7301" citeas="ISO 7301:2011" type="inline">
|
637
|
-
<locality type="clause">
|
638
|
-
<referenceFrom>3.1</referenceFrom>
|
639
|
-
</locality>
|
640
|
-
</origin>
|
641
|
-
<modification>
|
642
|
-
<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>
|
643
|
-
</modification>
|
644
|
-
</termsource>
|
645
|
-
</term>
|
646
|
-
<term id="paddy">
|
647
|
-
<name>1.2</name>
|
648
|
-
<preferred>paddy</preferred>
|
649
|
-
<admitted>paddy rice</admitted>
|
650
|
-
<admitted>rough rice</admitted>
|
651
|
-
<deprecates>cargo rice</deprecates>
|
652
|
-
<definition>
|
653
|
-
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
|
654
|
-
</definition>
|
655
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
656
|
-
<ul>
|
657
|
-
<li>A</li>
|
658
|
-
</ul>
|
659
|
-
</termexample>
|
660
|
-
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
661
|
-
<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>
|
662
|
-
</termnote>
|
663
|
-
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
664
|
-
<ul>
|
665
|
-
<li>A</li>
|
666
|
-
</ul>
|
667
|
-
<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>
|
668
|
-
</termnote>
|
669
|
-
<termsource status="identical">
|
670
|
-
<origin bibitemid="ISO7301" citeas="ISO 7301:2011" type="inline">
|
671
|
-
<locality type="clause">
|
672
|
-
<referenceFrom>3.1</referenceFrom>
|
673
|
-
</locality>
|
674
|
-
</origin>
|
675
|
-
</termsource>
|
676
|
-
</term>
|
677
|
-
</terms>
|
678
|
-
</sections>
|
679
|
-
</iso-standard>
|
680
|
-
INPUT
|
681
|
-
expect(File.exist?("test.html")).to be true
|
682
|
-
html = File.read("test.html", encoding: "UTF-8")
|
683
|
-
expect(html).to match(%r{<h2 class="TermNum" id="paddy1">1\.1</h2>})
|
684
|
-
expect(html).to match(%r{<h2 class="TermNum" id="paddy">1\.2</h2>})
|
685
|
-
end
|
686
|
-
|
687
|
-
it "inserts default paragraph between two tables for Word" do
|
688
|
-
IsoDoc::Iso::WordConvert
|
689
|
-
.new(WORD_HTML_CSS.dup)
|
690
|
-
.convert("test", <<~"INPUT", false)
|
691
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
692
|
-
<annex id="P" inline-header="false" obligation="normative">
|
693
|
-
<example id="_63112cbc-cde0-435f-9553-e0b8c4f5851c">
|
694
|
-
<p id="_158d4efa-b1c9-4aec-b325-756de8e4c968">'1M', '01M', and '0001M' all describe the calendar month January.</p>
|
695
|
-
</example>
|
696
|
-
<example id="_63112cbc-cde0-435f-9553-e0b8c4f5851d">
|
697
|
-
<p id="_158d4efa-b1c9-4aec-b325-756de8e4c969">'2M', '02M', and '0002M' all describe the calendar month February.</p>
|
698
|
-
</example>
|
699
|
-
</annex>
|
700
|
-
</iso-standard>
|
701
|
-
INPUT
|
702
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
703
|
-
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
704
|
-
.sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
|
705
|
-
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
706
|
-
<div class="WordSection3">
|
707
|
-
<p class="zzSTDTitle1"/>
|
708
|
-
<p class="MsoNormal">
|
709
|
-
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
710
|
-
</p>
|
711
|
-
<div class="Section3">
|
712
|
-
<a id="P" name="P"/>
|
713
|
-
<div class="Example">
|
714
|
-
<a id="_63112cbc-cde0-435f-9553-e0b8c4f5851c" name="_63112cbc-cde0-435f-9553-e0b8c4f5851c"/>
|
715
|
-
<p class="Example">
|
716
|
-
<span style="mso-tab-count:1"> </span>'1M', '01M', and '0001M' all describe the calendar month January.</p>
|
717
|
-
</div>
|
718
|
-
<div class="Example">
|
719
|
-
<a id="_63112cbc-cde0-435f-9553-e0b8c4f5851d" name="_63112cbc-cde0-435f-9553-e0b8c4f5851d"/>
|
720
|
-
<p class="Example">
|
721
|
-
<span style="mso-tab-count:1"> </span>'2M', '02M', and '0002M' all describe the calendar month February.</p>
|
722
|
-
</div>
|
723
|
-
</div>
|
724
|
-
</div>
|
725
|
-
OUTPUT
|
726
|
-
end
|
727
|
-
|
728
|
-
it "processes figure keys (Word)" do
|
729
|
-
IsoDoc::Iso::WordConvert
|
730
|
-
.new(WORD_HTML_CSS.dup)
|
731
|
-
.convert("test", <<~"INPUT", false)
|
732
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
733
|
-
<annex id="P" inline-header="false" obligation="normative">
|
734
|
-
<figure id="samplecode">
|
735
|
-
<p>Hello</p>
|
736
|
-
<p>Key</p>
|
737
|
-
<dl>
|
738
|
-
<dt>
|
739
|
-
<p>A</p>
|
740
|
-
</dt>
|
741
|
-
<dd>
|
742
|
-
<p>B</p>
|
743
|
-
</dd>
|
744
|
-
</dl>
|
745
|
-
</figure>
|
746
|
-
</annex>
|
747
|
-
</iso-standard>
|
748
|
-
INPUT
|
749
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
750
|
-
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
751
|
-
.sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
|
752
|
-
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
753
|
-
<div class="WordSection3">
|
754
|
-
<p class="zzSTDTitle1"/>
|
755
|
-
<p class="MsoNormal">
|
756
|
-
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
757
|
-
</p>
|
758
|
-
<div class="Section3">
|
759
|
-
<a id="P" name="P"/>
|
760
|
-
<div class="MsoNormal" style='text-align:center;'>
|
761
|
-
<a id="samplecode" name="samplecode"/>
|
762
|
-
<p class="MsoNormal">Hello</p>
|
763
|
-
<p class="MsoNormal">Key</p>
|
764
|
-
<p class="MsoNormal" style="page-break-after:avoid;">
|
765
|
-
<b>Key</b>
|
766
|
-
</p>
|
767
|
-
<div class="figdl" style="page-break-after:avoid;">
|
768
|
-
<table class="figdl">
|
769
|
-
<tr>
|
770
|
-
<td align="left" valign="top">
|
771
|
-
<p align="left" class="MsoNormal" style="margin-left:0pt;text-align:left;">
|
772
|
-
<p class="MsoNormal">A</p>
|
773
|
-
</p>
|
774
|
-
</td>
|
775
|
-
<td valign="top">
|
776
|
-
<p class="MsoNormal">B</p>
|
777
|
-
</td>
|
778
|
-
</tr>
|
779
|
-
</table>
|
780
|
-
</div>
|
781
|
-
</div>
|
782
|
-
</div>
|
783
|
-
</div>
|
784
|
-
OUTPUT
|
785
|
-
end
|
786
|
-
|
787
|
-
it "processes editorial notes (Word)" do
|
788
|
-
IsoDoc::Iso::WordConvert
|
789
|
-
.new(WORD_HTML_CSS.dup)
|
790
|
-
.convert("test", <<~"INPUT", false)
|
791
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
792
|
-
<annex id="P" inline-header="false" obligation="normative">
|
793
|
-
<admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="editorial">
|
794
|
-
<p id='_e94663cc-2473-4ccc-9a72-983a74d989f2'>
|
795
|
-
Only use paddy or parboiled rice for the
|
796
|
-
determination of husked rice yield.
|
797
|
-
</p>
|
798
|
-
<p id="_e94663cc-2473-4ccc-9a72-983a74d989f3">Para 2.</p>
|
799
|
-
</admonition>
|
800
|
-
</annex>
|
801
|
-
</iso-standard>
|
802
|
-
INPUT
|
803
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
804
|
-
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
805
|
-
.sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
|
806
|
-
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
807
|
-
<div class='WordSection3'>
|
808
|
-
<p class='zzSTDTitle1'/>
|
809
|
-
<p class='MsoNormal'>
|
810
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
811
|
-
</p>
|
812
|
-
<div class='Section3'>
|
813
|
-
<a name='P' id='P'/>
|
814
|
-
<div class='zzHelp'>
|
815
|
-
<a name='_70234f78-64e5-4dfc-8b6f-f3f037348b6a' id='_70234f78-64e5-4dfc-8b6f-f3f037348b6a'/>
|
816
|
-
<p class='zzHelp'> Only use paddy or parboiled rice for the determination of husked rice yield. </p>
|
817
|
-
<p class='zzHelp'>
|
818
|
-
<a name='_e94663cc-2473-4ccc-9a72-983a74d989f3' id='_e94663cc-2473-4ccc-9a72-983a74d989f3'/>
|
819
|
-
Para 2.
|
820
|
-
</p>
|
821
|
-
</div>
|
822
|
-
</div>
|
823
|
-
</div>
|
824
|
-
OUTPUT
|
825
|
-
end
|
826
|
-
|
827
|
-
it "processes boilerplate" do
|
828
|
-
input = <<~INPUT
|
829
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
830
|
-
<bibdata type="standard">
|
831
|
-
<status>
|
832
|
-
<stage>30</stage>
|
833
|
-
</status>
|
834
|
-
</bibdata>
|
835
|
-
<boilerplate>
|
836
|
-
<copyright-statement>
|
837
|
-
<clause>
|
838
|
-
<p id="boilerplate-year">© ISO 2019, Published in Switzerland</p>
|
839
|
-
<p id="boilerplate-message">I am the Walrus.</p>
|
840
|
-
<p id="boilerplate-name">ISO copyright office</p>
|
841
|
-
<p align="left" id="boilerplate-address">ISO copyright office
|
842
|
-
<br/>
|
843
|
-
Ch. de Blandonnet 8 ?~@? CP 401
|
844
|
-
<br/>
|
845
|
-
CH-1214 Vernier, Geneva, Switzerland
|
846
|
-
<br/>
|
847
|
-
Phone: +41 22 749 01 11
|
848
|
-
<br/>
|
849
|
-
Email: copyright@iso.org
|
850
|
-
<br/>
|
851
|
-
www.iso.org</p>
|
852
|
-
</clause>
|
853
|
-
</copyright-statement>
|
854
|
-
<license-statement>
|
855
|
-
<clause>
|
856
|
-
<title>Warning for Stuff</title>
|
857
|
-
<p>This document is not an ISO International Standard. It is distributed for review and
|
858
|
-
comment. It is subject to change without notice and may not be referred to as
|
859
|
-
an International Standard.</p>
|
860
|
-
<p>Recipients
|
861
|
-
of this draft are invited to submit, with their comments, notification of any
|
862
|
-
relevant patent rights of which they are aware and to provide supporting
|
863
|
-
documentation.</p>
|
864
|
-
</clause>
|
865
|
-
</license-statement>
|
866
|
-
</boilerplate>
|
867
|
-
</iso-standard>
|
868
|
-
INPUT
|
869
|
-
|
870
|
-
presxml = <<~OUTPUT
|
871
|
-
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
872
|
-
<bibdata type="standard">
|
873
|
-
<status>
|
874
|
-
<stage language="">30</stage>
|
875
|
-
<stage language='en'>Committee draft</stage>
|
876
|
-
</status>
|
877
|
-
</bibdata>
|
878
|
-
<boilerplate>
|
879
|
-
<copyright-statement>
|
880
|
-
<clause inline-header="true">
|
881
|
-
<p id="boilerplate-year">© ISO 2019, Published in Switzerland
|
882
|
-
</p>
|
883
|
-
<p id="boilerplate-message">I am the Walrus.
|
884
|
-
</p>
|
885
|
-
<p id="boilerplate-name">ISO copyright office</p>
|
886
|
-
<p align="left" id="boilerplate-address">ISO copyright office
|
887
|
-
<br/>
|
888
|
-
Ch. de Blandonnet 8 ?~@? CP 401
|
889
|
-
<br/>
|
890
|
-
CH-1214 Vernier, Geneva, Switzerland
|
891
|
-
<br/>
|
892
|
-
Phone: +41 22 749 01 11
|
893
|
-
<br/>
|
894
|
-
Email: copyright@iso.org
|
895
|
-
<br/>
|
896
|
-
www.iso.org</p>
|
897
|
-
</clause>
|
898
|
-
</copyright-statement>
|
899
|
-
<license-statement>
|
900
|
-
<clause>
|
901
|
-
<title depth="1">Warning for Stuff</title>
|
902
|
-
<p>This document is not an ISO International Standard. It is distributed for review and
|
903
|
-
comment. It is subject to change without notice and may not be referred to as
|
904
|
-
an International Standard.</p>
|
905
|
-
<p>Recipients
|
906
|
-
of this draft are invited to submit, with their comments, notification of any
|
907
|
-
relevant patent rights of which they are aware and to provide supporting
|
908
|
-
documentation.</p>
|
909
|
-
</clause>
|
910
|
-
</license-statement>
|
911
|
-
</boilerplate>
|
912
|
-
</iso-standard>
|
913
|
-
OUTPUT
|
914
|
-
|
915
|
-
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new(WORD_HTML_CSS.dup)
|
916
|
-
.convert("test", input, true))
|
917
|
-
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
918
|
-
.to be_equivalent_to xmlpp(presxml)
|
919
|
-
|
920
|
-
IsoDoc::Iso::HtmlConvert
|
921
|
-
.new(WORD_HTML_CSS.dup)
|
922
|
-
.convert("test", presxml, false)
|
923
|
-
|
924
|
-
word = File.read("test.html", encoding: "UTF-8")
|
925
|
-
expect((word)).to include '<h1 class="IntroTitle">Warning for Stuff</h1>'
|
926
|
-
expect((word)).to include "I am the Walrus."
|
927
|
-
|
928
|
-
IsoDoc::Iso::WordConvert.new(WORD_HTML_CSS.dup)
|
929
|
-
.convert("test", presxml, false)
|
930
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
931
|
-
expect(xmlpp(word
|
932
|
-
.sub(%r{^.*<div class="boilerplate-copyright">}m,
|
933
|
-
'<div class="boilerplate-copyright">')
|
934
|
-
.sub(%r{</div>.*$}m, "</div></div>")))
|
935
|
-
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
936
|
-
<div class="boilerplate-copyright">
|
937
|
-
<div>
|
938
|
-
<p class="zzCopyright">
|
939
|
-
<a id="boilerplate-year" name="boilerplate-year"/>© ISO 2019, Published in Switzerland#{' '}</p>
|
940
|
-
<p class="zzCopyright1">
|
941
|
-
<a id="boilerplate-message" name="boilerplate-message"/>I am the Walrus.#{' '}</p>
|
942
|
-
<p class="zzCopyright">
|
943
|
-
<a id="boilerplate-name" name="boilerplate-name"/>ISO copyright office</p>
|
944
|
-
<p align="left" class="zzAddress" style="text-align:left;">
|
945
|
-
<a id="boilerplate-address" name="boilerplate-address"/>ISO copyright office
|
946
|
-
|
947
|
-
<br/>
|
948
|
-
Ch. de Blandonnet 8 ?~@? CP 401
|
949
|
-
|
950
|
-
<br/>
|
951
|
-
CH-1214 Vernier, Geneva, Switzerland
|
952
|
-
|
953
|
-
<br/>
|
954
|
-
Phone: +41 22 749 01 11
|
955
|
-
|
956
|
-
<br/>
|
957
|
-
Email: copyright@iso.org
|
958
|
-
|
959
|
-
<br/>
|
960
|
-
www.iso.org#{' '}</p>
|
961
|
-
</div>
|
962
|
-
</div>
|
963
|
-
OUTPUT
|
964
|
-
expect(word).to include '<p class="zzWarning">This document is not '\
|
965
|
-
"an ISO International Standard"
|
966
|
-
end
|
967
|
-
|
968
|
-
it "populates Word ToC" do
|
969
|
-
IsoDoc::WordConvert.new(WORD_HTML_CSS_WORDINTRO.dup)
|
970
|
-
.convert("test", <<~"INPUT", false)
|
971
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
972
|
-
<sections>
|
973
|
-
<clause id="A" inline-header="false" obligation="normative">
|
974
|
-
<title>Clause 4</title>
|
975
|
-
<clause id="N" inline-header="false" obligation="normative">
|
976
|
-
<title>Introduction
|
977
|
-
<bookmark id="Q"/>
|
978
|
-
to this
|
979
|
-
<fn reference="1">
|
980
|
-
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
|
981
|
-
</title>
|
982
|
-
</clause>
|
983
|
-
<clause id="O" inline-header="false" obligation="normative">
|
984
|
-
<title>Clause 4.2</title>
|
985
|
-
<p>A
|
986
|
-
<fn reference="1">
|
987
|
-
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
|
988
|
-
</p>
|
989
|
-
<clause id="P" inline-header="false" obligation="normative">
|
990
|
-
<title>Clause 4.2.1</title>
|
991
|
-
</clause>
|
992
|
-
</clause>
|
993
|
-
</clause>
|
994
|
-
</sections>
|
995
|
-
</iso-standard>
|
996
|
-
INPUT
|
997
|
-
word = File.read("test.doc")
|
998
|
-
.sub(/^.*<div class="WordSection2">/m,
|
999
|
-
'<div class="WordSection2">')
|
1000
|
-
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
|
1001
|
-
|
1002
|
-
expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc")
|
1003
|
-
.gsub(/<o:p> <\/o:p>/, "")))
|
1004
|
-
.to be_equivalent_to xmlpp(<<~'OUTPUT')
|
1005
|
-
<div class="WordSection2">An empty word intro page.
|
1006
|
-
<p class="MsoToc1">
|
1007
|
-
<span lang="EN-GB" xml:lang="EN-GB">
|
1008
|
-
<span style="mso-element:field-begin"/>
|
1009
|
-
<span style="mso-spacerun:yes"> </span>
|
1010
|
-
TOC
|
1011
|
-
\o "1-2" \h \z \u
|
1012
|
-
<span style="mso-element:field-separator"/></span>
|
1013
|
-
<span class="MsoHyperlink">
|
1014
|
-
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
1015
|
-
<a href="#_Toc">Clause 4
|
1016
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
1017
|
-
<span style="mso-tab-count:1 dotted">. </span></span>
|
1018
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
1019
|
-
<span style="mso-element:field-begin"/>
|
1020
|
-
</span>
|
1021
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
|
1022
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
1023
|
-
<span style="mso-element:field-separator"/>
|
1024
|
-
</span>
|
1025
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
|
1026
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
|
1027
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
1028
|
-
<span style="mso-element:field-end"/>
|
1029
|
-
</span>
|
1030
|
-
</a>
|
1031
|
-
</span>
|
1032
|
-
</span>
|
1033
|
-
</p>
|
1034
|
-
<p class="MsoToc2">
|
1035
|
-
<span class="MsoHyperlink">
|
1036
|
-
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
1037
|
-
<a href="#_Toc">Introduction to this
|
1038
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
1039
|
-
<span style="mso-tab-count:1 dotted">. </span></span>
|
1040
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
1041
|
-
<span style="mso-element:field-begin"/>
|
1042
|
-
</span>
|
1043
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
|
1044
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
1045
|
-
<span style="mso-element:field-separator"/>
|
1046
|
-
</span>
|
1047
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
|
1048
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
|
1049
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
1050
|
-
<span style="mso-element:field-end"/>
|
1051
|
-
</span>
|
1052
|
-
</a>
|
1053
|
-
</span>
|
1054
|
-
</span>
|
1055
|
-
</p>
|
1056
|
-
<p class="MsoToc2">
|
1057
|
-
<span class="MsoHyperlink">
|
1058
|
-
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
1059
|
-
<a href="#_Toc">Clause 4.2
|
1060
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
1061
|
-
<span style="mso-tab-count:1 dotted">. </span></span>
|
1062
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
1063
|
-
<span style="mso-element:field-begin"/>
|
1064
|
-
</span>
|
1065
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">PAGEREF _Toc \h </span>
|
1066
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
1067
|
-
<span style="mso-element:field-separator"/>
|
1068
|
-
</span>
|
1069
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">1</span>
|
1070
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB"/>
|
1071
|
-
<span class="MsoTocTextSpan" lang="EN-GB" xml:lang="EN-GB">
|
1072
|
-
<span style="mso-element:field-end"/>
|
1073
|
-
</span>
|
1074
|
-
</a>
|
1075
|
-
</span>
|
1076
|
-
</span>
|
1077
|
-
</p>
|
1078
|
-
<p class="MsoToc1">
|
1079
|
-
<span lang="EN-GB" xml:lang="EN-GB">
|
1080
|
-
<span style="mso-element:field-end"/>
|
1081
|
-
</span>
|
1082
|
-
<span lang="EN-GB" xml:lang="EN-GB">
|
1083
|
-
</span>
|
1084
|
-
</p>
|
1085
|
-
<p class="MsoNormal"> </p>
|
1086
|
-
</div>
|
1087
|
-
OUTPUT
|
1088
|
-
end
|
1089
|
-
end
|