isodoc 1.0.27 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +4 -8
- data/.github/workflows/ubuntu.yml +18 -16
- data/.github/workflows/windows.yml +4 -8
- data/Rakefile +3 -1
- data/isodoc.gemspec +2 -2
- data/lib/isodoc.rb +2 -0
- data/lib/isodoc/base_style/metanorma_word.scss +0 -1
- data/lib/isodoc/base_style/reset.scss +3 -3
- data/lib/isodoc/common.rb +0 -4
- data/lib/isodoc/convert.rb +121 -58
- data/lib/isodoc/function/blocks.rb +42 -53
- data/lib/isodoc/function/blocks_example_note.rb +108 -0
- data/lib/isodoc/function/cleanup.rb +8 -4
- data/lib/isodoc/function/i18n.rb +1 -0
- data/lib/isodoc/function/inline.rb +70 -90
- data/lib/isodoc/function/inline_simple.rb +72 -0
- data/lib/isodoc/function/lists.rb +12 -6
- data/lib/isodoc/function/references.rb +33 -38
- data/lib/isodoc/function/reqt.rb +14 -5
- data/lib/isodoc/function/section.rb +8 -11
- data/lib/isodoc/function/table.rb +4 -4
- data/lib/isodoc/function/terms.rb +3 -3
- data/lib/isodoc/function/to_word_html.rb +21 -13
- data/lib/isodoc/function/utils.rb +57 -50
- data/lib/isodoc/gem_tasks.rb +104 -0
- data/lib/isodoc/headlesshtml_convert.rb +7 -6
- data/lib/isodoc/html_convert.rb +2 -1
- data/lib/isodoc/html_function/footnotes.rb +1 -1
- data/lib/isodoc/html_function/html.rb +13 -1
- data/lib/isodoc/html_function/postprocess.rb +4 -4
- data/lib/isodoc/metadata.rb +74 -62
- data/lib/isodoc/pdf_convert.rb +8 -6
- data/lib/isodoc/presentation_xml_convert.rb +29 -0
- data/lib/isodoc/sassc_importer.rb +11 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_convert.rb +2 -1
- data/lib/isodoc/word_function/body.rb +14 -48
- data/lib/isodoc/word_function/footnotes.rb +1 -1
- data/lib/isodoc/word_function/inline.rb +75 -0
- data/lib/isodoc/word_function/postprocess.rb +1 -0
- data/lib/isodoc/word_function/table.rb +3 -3
- data/lib/isodoc/xref.rb +59 -0
- data/lib/isodoc/{function → xref}/xref_anchor.rb +10 -21
- data/lib/isodoc/xref/xref_counter.rb +74 -0
- data/lib/isodoc/{function → xref}/xref_gen.rb +9 -22
- data/lib/isodoc/{function → xref}/xref_gen_seq.rb +41 -32
- data/lib/isodoc/{function → xref}/xref_sect_gen.rb +33 -23
- data/lib/isodoc/xslfo_convert.rb +16 -4
- data/spec/assets/{html.css → html.scss} +0 -0
- data/spec/assets/i18n.yaml +4 -1
- data/spec/assets/odf.emf +0 -0
- data/spec/assets/odf.svg +4 -0
- data/spec/assets/odf1.svg +4 -0
- data/spec/isodoc/blocks_spec.rb +219 -47
- data/spec/isodoc/cleanup_spec.rb +135 -6
- data/spec/isodoc/footnotes_spec.rb +22 -7
- data/spec/isodoc/inline_spec.rb +262 -2
- data/spec/isodoc/lists_spec.rb +8 -8
- data/spec/isodoc/metadata_spec.rb +110 -3
- data/spec/isodoc/postproc_spec.rb +1321 -1351
- data/spec/isodoc/presentation_xml_spec.rb +20 -0
- data/spec/isodoc/ref_spec.rb +119 -50
- data/spec/isodoc/section_spec.rb +84 -18
- data/spec/isodoc/table_spec.rb +6 -6
- data/spec/isodoc/terms_spec.rb +7 -7
- data/spec/isodoc/xref_spec.rb +165 -45
- metadata +36 -27
- data/lib/isodoc/function/blocks_example.rb +0 -53
- data/lib/isodoc/function/xref_counter.rb +0 -50
data/spec/isodoc/lists_spec.rb
CHANGED
@@ -5,7 +5,7 @@ RSpec.describe IsoDoc do
|
|
5
5
|
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface><foreword>
|
8
|
-
<ul id="_61961034-0fb1-436b-b281-828857a59ddb">
|
8
|
+
<ul id="_61961034-0fb1-436b-b281-828857a59ddb" keep-with-next="true" keep-lines-together="true">
|
9
9
|
<li>
|
10
10
|
<p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
|
11
11
|
</li>
|
@@ -20,7 +20,7 @@ RSpec.describe IsoDoc do
|
|
20
20
|
<br/>
|
21
21
|
<div>
|
22
22
|
<h1 class="ForewordTitle">Foreword</h1>
|
23
|
-
<ul id="_61961034-0fb1-436b-b281-828857a59ddb">
|
23
|
+
<ul id="_61961034-0fb1-436b-b281-828857a59ddb" style="page-break-after: avoid;page-break-inside: avoid;">
|
24
24
|
<li>
|
25
25
|
<p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
|
26
26
|
</li>
|
@@ -136,7 +136,7 @@ RSpec.describe IsoDoc do
|
|
136
136
|
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
137
137
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
138
138
|
<preface><foreword>
|
139
|
-
<ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="alphabet">
|
139
|
+
<ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="alphabet" keep-with-next="true" keep-lines-together="true">
|
140
140
|
<li>
|
141
141
|
<p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
|
142
142
|
</li>
|
@@ -158,7 +158,7 @@ RSpec.describe IsoDoc do
|
|
158
158
|
<br/>
|
159
159
|
<div>
|
160
160
|
<h1 class="ForewordTitle">Foreword</h1>
|
161
|
-
<ol type="a" id="_ae34a226-aab4-496d-987b-1aa7b6314026">
|
161
|
+
<ol type="a" id="_ae34a226-aab4-496d-987b-1aa7b6314026" style="page-break-after: avoid;page-break-inside: avoid;">
|
162
162
|
<li>
|
163
163
|
<p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
|
164
164
|
</li>
|
@@ -226,7 +226,7 @@ RSpec.describe IsoDoc do
|
|
226
226
|
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
227
227
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
228
228
|
<preface><foreword>
|
229
|
-
<dl id="_732d3f57-4f88-40bf-9ae9-633891edc395">
|
229
|
+
<dl id="_732d3f57-4f88-40bf-9ae9-633891edc395" keep-with-next="true" keep-lines-together="true">
|
230
230
|
<dt>
|
231
231
|
W
|
232
232
|
</dt>
|
@@ -244,7 +244,7 @@ RSpec.describe IsoDoc do
|
|
244
244
|
<br/>
|
245
245
|
<div>
|
246
246
|
<h1 class="ForewordTitle">Foreword</h1>
|
247
|
-
<dl id="_732d3f57-4f88-40bf-9ae9-633891edc395">
|
247
|
+
<dl id="_732d3f57-4f88-40bf-9ae9-633891edc395" style="page-break-after: avoid;page-break-inside: avoid;">
|
248
248
|
<dt>
|
249
249
|
<p>
|
250
250
|
W
|
@@ -260,7 +260,7 @@ RSpec.describe IsoDoc do
|
|
260
260
|
<p>??</p>
|
261
261
|
</dd>
|
262
262
|
</dl>
|
263
|
-
<div
|
263
|
+
<div class="Note">
|
264
264
|
<p><span class="note_label">NOTE</span>  This is a note</p>
|
265
265
|
</div>
|
266
266
|
</div>
|
@@ -323,7 +323,7 @@ RSpec.describe IsoDoc do
|
|
323
323
|
</tr>
|
324
324
|
<tr>
|
325
325
|
<td colspan="2">
|
326
|
-
<div
|
326
|
+
<div class="Note">
|
327
327
|
<p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">  </span>This is a note</p>
|
328
328
|
</div>
|
329
329
|
</td>
|
@@ -88,13 +88,56 @@ RSpec.describe IsoDoc do
|
|
88
88
|
</organization>
|
89
89
|
</owner>
|
90
90
|
</copyright>
|
91
|
+
<keyword>KW2</keyword>
|
92
|
+
<keyword>KW1</keyword>
|
93
|
+
<keyword>KW3</keyword>
|
91
94
|
<ext>
|
92
95
|
<doctype>international-standard</doctype>
|
93
96
|
</ext>
|
94
97
|
</bibdata>
|
95
98
|
</iso-standard>
|
96
99
|
INPUT
|
97
|
-
{:accesseddate=>"2012",
|
100
|
+
{:accesseddate=>"2012",
|
101
|
+
:activateddate=>"2013",
|
102
|
+
:agency=>"ISO",
|
103
|
+
:authors=>["Barney Rubble", "Fred Flintstone"],
|
104
|
+
:authors_affiliations=>{"Slate Inc., Bedrock"=>["Barney Rubble"], ""=>["Fred Flintstone"]},
|
105
|
+
:circulateddate=>"2015",
|
106
|
+
:confirmeddate=>"2017",
|
107
|
+
:copieddate=>"2016",
|
108
|
+
:createddate=>"2010–2011",
|
109
|
+
:doc=>"URL E",
|
110
|
+
:docnumber=>"17301-1",
|
111
|
+
:docnumeric=>"17301",
|
112
|
+
:doctitle=>"Cereals and pulses",
|
113
|
+
:doctype=>"International Standard",
|
114
|
+
:docyear=>"2016",
|
115
|
+
:draft=>"0.4",
|
116
|
+
:draftinfo=>" (draft 0.4, 2016-05-01)",
|
117
|
+
:edition=>"2",
|
118
|
+
:html=>"URL B",
|
119
|
+
:implementeddate=>"XXX",
|
120
|
+
:issueddate=>"XXX",
|
121
|
+
:iteration=>"2",
|
122
|
+
:keywords=>["KW2", "KW1", "KW3"],
|
123
|
+
:obsoleteddate=>"2014",
|
124
|
+
:pdf=>"URL D",
|
125
|
+
:publisheddate=>"2011",
|
126
|
+
:publisher=>"",
|
127
|
+
:receiveddate=>"XXX",
|
128
|
+
:revdate=>"2016-05-01",
|
129
|
+
:revdate_monthyear=>"May 2016",
|
130
|
+
:stage=>"Committee draft",
|
131
|
+
:stageabbr=>"CD",
|
132
|
+
:substage=>"Withdrawn",
|
133
|
+
:transmitteddate=>"2020",
|
134
|
+
:unchangeddate=>"2019",
|
135
|
+
:unpublished=>true,
|
136
|
+
:updateddate=>"2018",
|
137
|
+
:url=>"URL A",
|
138
|
+
:vote_endeddate=>"2022",
|
139
|
+
:vote_starteddate=>"2021",
|
140
|
+
:xml=>"URL C"}
|
98
141
|
OUTPUT
|
99
142
|
end
|
100
143
|
|
@@ -168,7 +211,41 @@ OUTPUT
|
|
168
211
|
</version>
|
169
212
|
</iso-standard>
|
170
213
|
INPUT
|
171
|
-
{:accesseddate=>"XXX",
|
214
|
+
{:accesseddate=>"XXX",
|
215
|
+
:agency=>"ISO/IEC/IEEE",
|
216
|
+
:authors=>[],
|
217
|
+
:authors_affiliations=>{},
|
218
|
+
:circulateddate=>"XXX",
|
219
|
+
:confirmeddate=>"XXX",
|
220
|
+
:copieddate=>"XXX",
|
221
|
+
:createddate=>"XXX",
|
222
|
+
:docnumber=>"17301-1-3",
|
223
|
+
:docnumeric=>"17301",
|
224
|
+
:doctitle=>"Cereals and pulses",
|
225
|
+
:doctype=>"International Standard",
|
226
|
+
:docyear=>"2016",
|
227
|
+
:draft=>"12",
|
228
|
+
:draftinfo=>" (draft 12, 2016-05)",
|
229
|
+
:edition=>nil,
|
230
|
+
:implementeddate=>"XXX",
|
231
|
+
:issueddate=>"XXX",
|
232
|
+
:keywords=>[],
|
233
|
+
:obsoleteddate=>"XXX",
|
234
|
+
:obsoletes=>"IEC 8121",
|
235
|
+
:obsoletes_part=>"3.1",
|
236
|
+
:partof=>"IEC 8122",
|
237
|
+
:publisheddate=>"2011-01",
|
238
|
+
:publisher=>"International Organization for Standardization, International Electrotechnical Commission and Institute of Electrical and Electronics Engineers",
|
239
|
+
:receiveddate=>"XXX",
|
240
|
+
:revdate=>"2016-05",
|
241
|
+
:revdate_monthyear=>"May 2016",
|
242
|
+
:stage=>"Published",
|
243
|
+
:transmitteddate=>"XXX",
|
244
|
+
:unchangeddate=>"XXX",
|
245
|
+
:unpublished=>false,
|
246
|
+
:updateddate=>"XXX",
|
247
|
+
:vote_endeddate=>"XXX",
|
248
|
+
:vote_starteddate=>"XXX"}
|
172
249
|
OUTPUT
|
173
250
|
end
|
174
251
|
|
@@ -227,7 +304,37 @@ OUTPUT
|
|
227
304
|
</bibdata>
|
228
305
|
</iso-standard>
|
229
306
|
INPUT
|
230
|
-
{:accesseddate=>"XXX",
|
307
|
+
{:accesseddate=>"XXX",
|
308
|
+
:agency=>"ISO/IEC",
|
309
|
+
:authors=>[],
|
310
|
+
:authors_affiliations=>{},
|
311
|
+
:circulateddate=>"XXX",
|
312
|
+
:confirmeddate=>"XXX",
|
313
|
+
:copieddate=>"XXX",
|
314
|
+
:createddate=>"XXX",
|
315
|
+
:docnumber=>"17301-1-3",
|
316
|
+
:docnumeric=>"17301",
|
317
|
+
:doctitle=>"Cereals and pulses",
|
318
|
+
:docyear=>"2016",
|
319
|
+
:draft=>nil,
|
320
|
+
:draftinfo=>"",
|
321
|
+
:edition=>nil,
|
322
|
+
:implementeddate=>"XXX",
|
323
|
+
:issueddate=>"XXX",
|
324
|
+
:keywords=>[],
|
325
|
+
:obsoleteddate=>"XXX",
|
326
|
+
:publisheddate=>"2011-01",
|
327
|
+
:publisher=>"International Organization for Standardization et International Electrotechnical Commission",
|
328
|
+
:receiveddate=>"XXX",
|
329
|
+
:revdate=>"2016-05",
|
330
|
+
:revdate_monthyear=>"Mai 2016",
|
331
|
+
:stage=>"Published",
|
332
|
+
:transmitteddate=>"XXX",
|
333
|
+
:unchangeddate=>"XXX",
|
334
|
+
:unpublished=>false,
|
335
|
+
:updateddate=>"XXX",
|
336
|
+
:vote_endeddate=>"XXX",
|
337
|
+
:vote_starteddate=>"XXX"}
|
231
338
|
OUTPUT
|
232
339
|
end
|
233
340
|
|
@@ -1,122 +1,124 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'fileutils'
|
3
5
|
|
4
6
|
RSpec.describe IsoDoc do
|
5
|
-
it
|
6
|
-
FileUtils.rm_f
|
7
|
-
FileUtils.rm_f
|
8
|
-
IsoDoc::HtmlConvert.new(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
</note>
|
17
|
-
|
18
|
-
|
7
|
+
it 'generates file based on string input' do
|
8
|
+
FileUtils.rm_f 'test.doc'
|
9
|
+
FileUtils.rm_f 'test.html'
|
10
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', filename: 'test').convert('test', <<~"INPUT", false)
|
11
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
12
|
+
<bibdata>
|
13
|
+
<title language="en">test</title>
|
14
|
+
</bibdata>
|
15
|
+
<preface><foreword>
|
16
|
+
<note>
|
17
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
18
|
+
</note>
|
19
|
+
</foreword></preface>
|
20
|
+
</iso-standard>
|
19
21
|
INPUT
|
20
|
-
expect(File.exist?(
|
21
|
-
html = File.read(
|
22
|
+
expect(File.exist?('test.html')).to be true
|
23
|
+
html = File.read('test.html')
|
22
24
|
expect(html).to match(%r{<title>test</title>})
|
23
25
|
expect(html).to match(/another empty stylesheet/)
|
24
26
|
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
|
25
27
|
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
|
26
28
|
end
|
27
29
|
|
28
|
-
it
|
29
|
-
FileUtils.rm_f
|
30
|
-
FileUtils.rm_f
|
31
|
-
IsoDoc::HtmlConvert.new(
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
</note>
|
40
|
-
|
41
|
-
|
30
|
+
it 'ignores Liquid markup in the document body' do
|
31
|
+
FileUtils.rm_f 'test.doc'
|
32
|
+
FileUtils.rm_f 'test.html'
|
33
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css').convert('test', <<~"INPUT", false)
|
34
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
35
|
+
<bibdata>
|
36
|
+
<title language="en">test</title>
|
37
|
+
</bibdata>
|
38
|
+
<preface><foreword>
|
39
|
+
<note>
|
40
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">{% elif %}These results are based on a study carried out on three different types of kernel.</p>
|
41
|
+
</note>
|
42
|
+
</foreword></preface>
|
43
|
+
</iso-standard>
|
42
44
|
INPUT
|
43
|
-
expect(File.exist?(
|
44
|
-
html = File.read(
|
45
|
+
expect(File.exist?('test.html')).to be true
|
46
|
+
html = File.read('test.html')
|
45
47
|
end
|
46
48
|
|
47
|
-
|
48
|
-
FileUtils.rm_f
|
49
|
-
FileUtils.rm_f
|
50
|
-
IsoDoc::WordConvert.new(
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
</note>
|
59
|
-
|
60
|
-
|
49
|
+
it 'ignores Liquid markup in the document body (Word)' do
|
50
|
+
FileUtils.rm_f 'test.doc'
|
51
|
+
FileUtils.rm_f 'test.html'
|
52
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css').convert('test', <<~"INPUT", false)
|
53
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
54
|
+
<bibdata>
|
55
|
+
<title language="en">test</title>
|
56
|
+
</bibdata>
|
57
|
+
<preface><foreword>
|
58
|
+
<note>
|
59
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">{% elif %}These results are based on a study carried out on three different types of kernel.</p>
|
60
|
+
</note>
|
61
|
+
</foreword></preface>
|
62
|
+
</iso-standard>
|
61
63
|
INPUT
|
62
|
-
expect(File.exist?(
|
63
|
-
html = File.read(
|
64
|
+
expect(File.exist?('test.doc')).to be true
|
65
|
+
html = File.read('test.doc')
|
64
66
|
end
|
65
67
|
|
66
|
-
it
|
67
|
-
FileUtils.rm_f
|
68
|
-
FileUtils.rm_f
|
69
|
-
IsoDoc::HtmlConvert.new(
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
</note>
|
75
|
-
|
76
|
-
|
68
|
+
it 'generates HTML output docs with null configuration' do
|
69
|
+
FileUtils.rm_f 'test.doc'
|
70
|
+
FileUtils.rm_f 'test.html'
|
71
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css').convert('test', <<~"INPUT", false)
|
72
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
73
|
+
<preface><foreword>
|
74
|
+
<note>
|
75
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
76
|
+
</note>
|
77
|
+
</foreword></preface>
|
78
|
+
</iso-standard>
|
77
79
|
INPUT
|
78
|
-
expect(File.exist?(
|
79
|
-
html = File.read(
|
80
|
+
expect(File.exist?('test.html')).to be true
|
81
|
+
html = File.read('test.html')
|
80
82
|
expect(html).not_to match(%r{<title>test</title>})
|
81
83
|
expect(html).not_to match(/another empty stylesheet/)
|
82
84
|
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
|
83
85
|
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
|
84
86
|
end
|
85
87
|
|
86
|
-
it
|
87
|
-
FileUtils.rm_f
|
88
|
-
FileUtils.rm_f
|
89
|
-
IsoDoc::WordConvert.new(
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
</note>
|
95
|
-
|
96
|
-
|
88
|
+
it 'generates Word output docs with null configuration' do
|
89
|
+
FileUtils.rm_f 'test.doc'
|
90
|
+
FileUtils.rm_f 'test.html'
|
91
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
92
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
93
|
+
<preface><foreword>
|
94
|
+
<note>
|
95
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
96
|
+
</note>
|
97
|
+
</foreword></preface>
|
98
|
+
</iso-standard>
|
97
99
|
INPUT
|
98
|
-
expect(File.exist?(
|
99
|
-
word = File.read(
|
100
|
+
expect(File.exist?('test.doc')).to be true
|
101
|
+
word = File.read('test.doc')
|
100
102
|
expect(word).to match(/one empty stylesheet/)
|
101
103
|
expect(word).to match(/div\.table_container/)
|
102
104
|
end
|
103
105
|
|
104
|
-
it
|
105
|
-
FileUtils.rm_f
|
106
|
-
FileUtils.rm_f
|
107
|
-
IsoDoc::HtmlConvert.new(
|
108
|
-
expect(File.exist?(
|
109
|
-
html = File.read(
|
106
|
+
it 'generates HTML output docs with null configuration from file' do
|
107
|
+
FileUtils.rm_f 'spec/assets/iso.doc'
|
108
|
+
FileUtils.rm_f 'spec/assets/iso.html'
|
109
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('spec/assets/iso.xml', nil, false)
|
110
|
+
expect(File.exist?('spec/assets/iso.html')).to be true
|
111
|
+
html = File.read('spec/assets/iso.html')
|
110
112
|
expect(html).to match(/another empty stylesheet/)
|
111
113
|
expect(html).to match(%r{https://use.fontawesome.com})
|
112
114
|
expect(html).to match(%r{libs/jquery})
|
113
115
|
end
|
114
116
|
|
115
|
-
it
|
116
|
-
FileUtils.rm_f
|
117
|
-
IsoDoc::HeadlessHtmlConvert.new(
|
118
|
-
expect(File.exist?(
|
119
|
-
html = File.read(
|
117
|
+
it 'generates Headless HTML output docs with null configuration from file' do
|
118
|
+
FileUtils.rm_f 'spec/assets/iso.html'
|
119
|
+
IsoDoc::HeadlessHtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('spec/assets/iso.xml', nil, false)
|
120
|
+
expect(File.exist?('spec/assets/iso.headless.html')).to be true
|
121
|
+
html = File.read('spec/assets/iso.headless.html')
|
120
122
|
expect(html).not_to match(/another empty stylesheet/)
|
121
123
|
expect(html).not_to match(%r{https://use.fontawesome.com})
|
122
124
|
expect(html).not_to match(%r{libs/jquery})
|
@@ -126,33 +128,27 @@ expect(File.exist?("test.doc")).to be true
|
|
126
128
|
expect(html).to match(%r{<div})
|
127
129
|
end
|
128
130
|
|
129
|
-
it
|
130
|
-
FileUtils.rm_f
|
131
|
-
IsoDoc::WordConvert.new(
|
132
|
-
expect(File.exist?(
|
133
|
-
word = File.read(
|
131
|
+
it 'generates Word output docs with null configuration from file' do
|
132
|
+
FileUtils.rm_f 'spec/assets/iso.doc'
|
133
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('spec/assets/iso.xml', nil, false)
|
134
|
+
expect(File.exist?('spec/assets/iso.doc')).to be true
|
135
|
+
word = File.read('spec/assets/iso.doc')
|
134
136
|
expect(word).to match(/one empty stylesheet/)
|
135
137
|
end
|
136
138
|
|
137
|
-
it
|
138
|
-
FileUtils.rm_f
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
<preface><foreword>
|
149
|
-
<note>
|
150
|
-
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
151
|
-
</note>
|
152
|
-
</foreword></preface>
|
153
|
-
</iso-standard>
|
139
|
+
it 'generates HTML output docs with complete configuration' do
|
140
|
+
FileUtils.rm_f 'test.doc'
|
141
|
+
FileUtils.rm_f 'test.html'
|
142
|
+
IsoDoc::HtmlConvert.new(bodyfont: 'Zapf', htmlstylesheet: 'spec/assets/html.scss', htmlcoverpage: 'spec/assets/htmlcover.html', htmlintropage: 'spec/assets/htmlintro.html', scripts: 'spec/assets/scripts.html', i18nyaml: 'spec/assets/i18n.yaml', ulstyle: 'l1', olstyle: 'l2').convert('test', <<~"INPUT", false)
|
143
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
144
|
+
<preface><foreword>
|
145
|
+
<note>
|
146
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
147
|
+
</note>
|
148
|
+
</foreword></preface>
|
149
|
+
</iso-standard>
|
154
150
|
INPUT
|
155
|
-
html = File.read(
|
151
|
+
html = File.read('test.html')
|
156
152
|
expect(html).to match(/another empty stylesheet/)
|
157
153
|
expect(html).to match(/font-family: Zapf/)
|
158
154
|
expect(html).to match(/an empty html cover page/)
|
@@ -162,19 +158,19 @@ expect(File.exist?("test.doc")).to be true
|
|
162
158
|
expect(html).to match(%r{Enkonduko</h1>})
|
163
159
|
end
|
164
160
|
|
165
|
-
it
|
166
|
-
FileUtils.rm_f
|
167
|
-
FileUtils.rm_f
|
168
|
-
IsoDoc::HtmlConvert.new(
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
</note>
|
174
|
-
|
175
|
-
|
161
|
+
it 'generates HTML output docs with default fonts' do
|
162
|
+
FileUtils.rm_f 'test.doc'
|
163
|
+
FileUtils.rm_f 'test.html'
|
164
|
+
IsoDoc::HtmlConvert.new(htmlstylesheet: 'spec/assets/html.scss', htmlcoverpage: 'spec/assets/htmlcover.html', htmlintropage: 'spec/assets/htmlintro.html', scripts: 'spec/assets/scripts.html', i18nyaml: 'spec/assets/i18n.yaml', ulstyle: 'l1', olstyle: 'l2').convert('test', <<~"INPUT", false)
|
165
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
166
|
+
<preface><foreword>
|
167
|
+
<note>
|
168
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
169
|
+
</note>
|
170
|
+
</foreword></preface>
|
171
|
+
</iso-standard>
|
176
172
|
INPUT
|
177
|
-
html = File.read(
|
173
|
+
html = File.read('test.html')
|
178
174
|
expect(html).to match(/another empty stylesheet/)
|
179
175
|
expect(html).to match(/font-family: Arial/)
|
180
176
|
expect(html).to match(/an empty html cover page/)
|
@@ -184,1405 +180,1379 @@ expect(File.exist?("test.doc")).to be true
|
|
184
180
|
expect(html).to match(%r{Enkonduko</h1>})
|
185
181
|
end
|
186
182
|
|
187
|
-
it
|
188
|
-
FileUtils.rm_f
|
189
|
-
FileUtils.rm_f
|
190
|
-
IsoDoc::WordConvert.new(
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
</note>
|
196
|
-
|
197
|
-
|
183
|
+
it 'generates Word output docs with complete configuration' do
|
184
|
+
FileUtils.rm_f 'test.doc'
|
185
|
+
FileUtils.rm_f 'test.html'
|
186
|
+
IsoDoc::WordConvert.new(bodyfont: 'Zapf', wordstylesheet: 'spec/assets/html.scss', standardstylesheet: 'spec/assets/std.css', header: 'spec/assets/header.html', wordcoverpage: 'spec/assets/wordcover.html', wordintropage: 'spec/assets/wordintro.html', i18nyaml: 'spec/assets/i18n.yaml', ulstyle: 'l1', olstyle: 'l2').convert('test', <<~"INPUT", false)
|
187
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
188
|
+
<preface><foreword>
|
189
|
+
<note>
|
190
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
191
|
+
</note>
|
192
|
+
</foreword></preface>
|
193
|
+
</iso-standard>
|
198
194
|
INPUT
|
199
|
-
word = File.read(
|
195
|
+
word = File.read('test.doc')
|
200
196
|
expect(word).to match(/another empty stylesheet/)
|
201
197
|
expect(word).to match(/font-family: Zapf/)
|
202
198
|
expect(word).to match(/a third empty stylesheet/)
|
203
|
-
#expect(word).to match(/<title>test<\/title>/)
|
199
|
+
# expect(word).to match(/<title>test<\/title>/)
|
204
200
|
expect(word).to match(/test_files\/header.html/)
|
205
201
|
expect(word).to match(/an empty word cover page/)
|
206
202
|
expect(word).to match(/an empty word intro page/)
|
207
203
|
expect(word).to match(%r{Enkonduko</h1>})
|
208
204
|
end
|
209
205
|
|
210
|
-
it
|
211
|
-
FileUtils.rm_f
|
212
|
-
FileUtils.rm_f
|
213
|
-
IsoDoc::WordConvert.new(
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
</note>
|
219
|
-
|
220
|
-
|
206
|
+
it 'generates Word output docs with default fonts' do
|
207
|
+
FileUtils.rm_f 'test.doc'
|
208
|
+
FileUtils.rm_f 'test.html'
|
209
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/html.scss', standardstylesheet: 'spec/assets/std.css', header: 'spec/assets/header.html', wordcoverpage: 'spec/assets/wordcover.html', wordintropage: 'spec/assets/wordintro.html', i18nyaml: 'spec/assets/i18n.yaml', ulstyle: 'l1', olstyle: 'l2').convert('test', <<~"INPUT", false)
|
210
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
211
|
+
<preface><foreword>
|
212
|
+
<note>
|
213
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
214
|
+
</note>
|
215
|
+
</foreword></preface>
|
216
|
+
</iso-standard>
|
221
217
|
INPUT
|
222
|
-
word = File.read(
|
218
|
+
word = File.read('test.doc')
|
223
219
|
expect(word).to match(/another empty stylesheet/)
|
224
220
|
expect(word).to match(/font-family: Arial/)
|
225
221
|
expect(word).to match(/a third empty stylesheet/)
|
226
|
-
#expect(word).to match(/<title>test<\/title>/)
|
222
|
+
# expect(word).to match(/<title>test<\/title>/)
|
227
223
|
expect(word).to match(/test_files\/header.html/)
|
228
224
|
expect(word).to match(/an empty word cover page/)
|
229
225
|
expect(word).to match(/an empty word intro page/)
|
230
226
|
expect(word).to match(%r{Enkonduko</h1>})
|
231
227
|
end
|
232
228
|
|
233
|
-
it
|
234
|
-
FileUtils.rm_f
|
235
|
-
FileUtils.rm_f
|
236
|
-
IsoDoc::WordConvert.new(
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
229
|
+
it 'converts definition lists to tables for Word' do
|
230
|
+
FileUtils.rm_f 'test.doc'
|
231
|
+
FileUtils.rm_f 'test.html'
|
232
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
233
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
234
|
+
<preface><foreword>
|
235
|
+
<dl>
|
236
|
+
<dt>Term</dt>
|
237
|
+
<dd>Definition</dd>
|
238
|
+
<dt>Term 2</dt>
|
239
|
+
<dd>Definition 2</dd>
|
240
|
+
</dl>
|
241
|
+
</foreword></preface>
|
242
|
+
</iso-standard>
|
247
243
|
INPUT
|
248
|
-
word = File.read(
|
249
|
-
|
244
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
|
245
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
250
246
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
</div>
|
270
|
-
<p class="MsoNormal"> </p>
|
247
|
+
<div class="WordSection2">
|
248
|
+
<p class="MsoNormal"><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
|
249
|
+
<div>
|
250
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
251
|
+
<table class="dl">
|
252
|
+
<tr>
|
253
|
+
<td valign="top" align="left">
|
254
|
+
<p align="left" style="margin-left:0pt;text-align:left;" class="MsoNormal">Term</p>
|
255
|
+
</td>
|
256
|
+
<td valign="top">Definition</td>
|
257
|
+
</tr>
|
258
|
+
<tr>
|
259
|
+
<td valign="top" align="left">
|
260
|
+
<p align="left" style="margin-left:0pt;text-align:left;" class="MsoNormal">Term 2</p>
|
261
|
+
</td>
|
262
|
+
<td valign="top">Definition 2</td>
|
263
|
+
</tr>
|
264
|
+
</table>
|
271
265
|
</div>
|
266
|
+
<p class="MsoNormal"> </p>
|
267
|
+
</div>
|
272
268
|
OUTPUT
|
273
269
|
end
|
274
270
|
|
275
|
-
it
|
276
|
-
FileUtils.rm_f
|
277
|
-
FileUtils.rm_f
|
278
|
-
IsoDoc::WordConvert.new(
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
<term id="paddy1"><preferred>paddy</preferred>
|
284
|
-
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
285
|
-
<termsource status="modified">
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
</termsource></term>
|
291
|
-
|
292
|
-
</terms>
|
293
|
-
</sections>
|
294
|
-
</iso-standard>
|
271
|
+
it 'populates Word template with terms reference labels' do
|
272
|
+
FileUtils.rm_f 'test.doc'
|
273
|
+
FileUtils.rm_f 'test.html'
|
274
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
275
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
276
|
+
<sections>
|
277
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
278
|
+
|
279
|
+
<term id="paddy1"><preferred>paddy</preferred>
|
280
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
281
|
+
<termsource status="modified">
|
282
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
283
|
+
<modification>
|
284
|
+
<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>
|
285
|
+
</modification>
|
286
|
+
</termsource></term>
|
287
|
+
|
288
|
+
</terms>
|
289
|
+
</sections>
|
290
|
+
</iso-standard>
|
295
291
|
|
296
292
|
INPUT
|
297
|
-
word = File.read(
|
298
|
-
|
293
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
294
|
+
.sub(%r{<div style="mso-element:footnote-list"/>.*$}m, '')
|
299
295
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
296
|
+
<div class="WordSection3">
|
297
|
+
<p class="zzSTDTitle1"></p>
|
298
|
+
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1.<span style="mso-tab-count:1">  </span>Terms and Definitions</h1>
|
299
|
+
<p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
|
300
|
+
<p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
|
301
|
+
<p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
|
302
|
+
</div>
|
307
303
|
OUTPUT
|
308
304
|
end
|
309
305
|
|
310
|
-
it
|
311
|
-
FileUtils.rm_f
|
312
|
-
IsoDoc::WordConvert.new(
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
</iso-standard>
|
306
|
+
it 'populates Word header' do
|
307
|
+
FileUtils.rm_f 'test.doc'
|
308
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', header: 'spec/assets/header.html').convert('test', <<~"INPUT", false)
|
309
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
310
|
+
<bibdata type="article">
|
311
|
+
<docidentifier>
|
312
|
+
<project-number part="1">1000</project-number>
|
313
|
+
</docidentifier>
|
314
|
+
</bibdata>
|
315
|
+
</iso-standard>
|
320
316
|
|
321
317
|
INPUT
|
322
|
-
word = File.read(
|
323
|
-
|
318
|
+
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')
|
319
|
+
.sub(/------=_NextPart.*$/m, '')
|
324
320
|
expect(word).to be_equivalent_to <<~"OUTPUT"
|
325
321
|
|
326
|
-
Content-Location: file:///C:/Doc/test_files/header.html
|
327
|
-
Content-Transfer-Encoding: base64
|
328
|
-
Content-Type: text/html charset="utf-8"
|
322
|
+
Content-Location: file:///C:/Doc/test_files/header.html
|
323
|
+
Content-Transfer-Encoding: base64
|
324
|
+
Content-Type: text/html charset="utf-8"
|
329
325
|
|
330
|
-
Ci8qIGFuIGVtcHR5IGhlYWRlciAqLwoKU1RBUlQgRE9DIElEOiAKICAgICAgICAgICAxMDAwCiAg
|
331
|
-
ICAgICAgIDogRU5EIERPQyBJRAoKRklMRU5BTUU6IHRlc3QKCg==
|
326
|
+
Ci8qIGFuIGVtcHR5IGhlYWRlciAqLwoKU1RBUlQgRE9DIElEOiAKICAgICAgICAgICAxMDAwCiAg
|
327
|
+
ICAgICAgIDogRU5EIERPQyBJRAoKRklMRU5BTUU6IHRlc3QKCg==
|
332
328
|
|
333
329
|
OUTPUT
|
334
330
|
end
|
335
331
|
|
336
|
-
it
|
337
|
-
FileUtils.rm_f
|
338
|
-
IsoDoc::WordConvert.new(
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
</fn></title>
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
</fn></p>
|
352
|
-
<clause id="P" inline-header="false" obligation="normative">
|
353
|
-
<title>Clause 4.2.1</title>
|
354
|
-
</clause>
|
355
|
-
|
356
|
-
|
357
|
-
|
332
|
+
it 'populates Word ToC' do
|
333
|
+
FileUtils.rm_f 'test.doc'
|
334
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', wordintropage: 'spec/assets/wordintro.html').convert('test', <<~"INPUT", false)
|
335
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
336
|
+
<sections>
|
337
|
+
<clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
338
|
+
|
339
|
+
<title>Introduction<bookmark id="Q"/> to this<fn reference="1">
|
340
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
341
|
+
</fn></title>
|
342
|
+
</clause>
|
343
|
+
<clause id="O" inline-header="false" obligation="normative">
|
344
|
+
<title>Clause 4.2</title>
|
345
|
+
<p>A<fn reference="1">
|
346
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
347
|
+
</fn></p>
|
348
|
+
<clause id="P" inline-header="false" obligation="normative">
|
349
|
+
<title>Clause 4.2.1</title>
|
350
|
+
</clause>
|
351
|
+
</clause></clause>
|
352
|
+
</sections>
|
353
|
+
</iso-standard>
|
358
354
|
|
359
355
|
INPUT
|
360
|
-
word = File.read(
|
361
|
-
|
362
|
-
expect(xmlpp(word.gsub(/_Toc\d\d+/,
|
363
|
-
|
364
|
-
|
365
|
-
|
356
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
|
357
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
358
|
+
expect(xmlpp(word.gsub(/_Toc\d\d+/, '_Toc'))).to be_equivalent_to xmlpp(<<~'OUTPUT')
|
359
|
+
<div class="WordSection2">
|
360
|
+
/* an empty word intro page */
|
366
361
|
<p class="MsoToc1"><span lang="EN-GB" xml:lang="EN-GB"><span style="mso-element:field-begin"></span><span style="mso-spacerun:yes"> </span>TOC
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
362
|
+
\o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
|
363
|
+
<span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
364
|
+
<a href="#_Toc">1. Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
365
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
366
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
367
|
+
<span style="mso-element:field-begin"></span></span>
|
368
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
369
|
+
<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>
|
370
|
+
<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>
|
377
371
|
<p class="MsoToc2">
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
372
|
+
<span class="MsoHyperlink">
|
373
|
+
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
374
|
+
<a href="#_Toc">1.1. Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
375
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
376
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
377
|
+
<span style="mso-element:field-begin"></span></span>
|
378
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
379
|
+
<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>
|
380
|
+
<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>
|
381
|
+
</span>
|
382
|
+
</p>
|
390
383
|
<p class="MsoToc2">
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
384
|
+
<span class="MsoHyperlink">
|
385
|
+
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
386
|
+
<a href="#_Toc">1.2. Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
387
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
388
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
389
|
+
<span style="mso-element:field-begin"></span></span>
|
390
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
391
|
+
<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>
|
392
|
+
<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>
|
393
|
+
</span>
|
394
|
+
</p>
|
403
395
|
<p class="MsoToc1">
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
<p class="MsoNormal"> </p>
|
414
|
-
</div>
|
396
|
+
<span lang="EN-GB" xml:lang="EN-GB">
|
397
|
+
<span style="mso-element:field-end"></span>
|
398
|
+
</span>
|
399
|
+
<span lang="EN-GB" xml:lang="EN-GB">
|
400
|
+
<p class="MsoNormal"> </p>
|
401
|
+
</span>
|
402
|
+
</p>
|
403
|
+
<p class="MsoNormal"> </p>
|
404
|
+
</div>
|
415
405
|
OUTPUT
|
416
406
|
end
|
417
407
|
|
418
|
-
|
419
|
-
FileUtils.rm_f
|
420
|
-
IsoDoc::WordConvert.new(
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
</fn></title>
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
</fn></p>
|
434
|
-
<clause id="P" inline-header="false" obligation="normative">
|
435
|
-
<title>Clause 4.2.1</title>
|
436
|
-
</clause>
|
437
|
-
|
438
|
-
|
439
|
-
|
408
|
+
it 'populates Word ToC with custom levels' do
|
409
|
+
FileUtils.rm_f 'test.doc'
|
410
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', wordintropage: 'spec/assets/wordintro.html', doctoclevels: 3).convert('test', <<~"INPUT", false)
|
411
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
412
|
+
<sections>
|
413
|
+
<clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
414
|
+
|
415
|
+
<title>Introduction<bookmark id="Q"/> to this<fn reference="1">
|
416
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
417
|
+
</fn></title>
|
418
|
+
</clause>
|
419
|
+
<clause id="O" inline-header="false" obligation="normative">
|
420
|
+
<title>Clause 4.2</title>
|
421
|
+
<p>A<fn reference="1">
|
422
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
423
|
+
</fn></p>
|
424
|
+
<clause id="P" inline-header="false" obligation="normative">
|
425
|
+
<title>Clause 4.2.1</title>
|
426
|
+
</clause>
|
427
|
+
</clause></clause>
|
428
|
+
</sections>
|
429
|
+
</iso-standard>
|
440
430
|
|
441
431
|
INPUT
|
442
|
-
word = File.read(
|
443
|
-
|
444
|
-
expect(xmlpp(word.gsub(/_Toc\d\d+/,
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
432
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
|
433
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
434
|
+
expect(xmlpp(word.gsub(/_Toc\d\d+/, '_Toc'))).to be_equivalent_to xmlpp(<<~'OUTPUT')
|
435
|
+
<div class="WordSection2">
|
436
|
+
/* an empty word intro page */
|
437
|
+
|
438
|
+
<p class="MsoToc1"><span lang="EN-GB" xml:lang="EN-GB"><span style="mso-element:field-begin"></span><span style="mso-spacerun:yes"> </span>TOC
|
439
|
+
\o "1-3" \h \z \u <span style="mso-element:field-separator"></span></span>
|
440
|
+
<span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
441
|
+
<a href="#_Toc">1. Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
442
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
443
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
444
|
+
<span style="mso-element:field-begin"></span></span>
|
445
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
446
|
+
<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>
|
447
|
+
<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>
|
448
|
+
|
449
|
+
<p class="MsoToc2">
|
450
|
+
<span class="MsoHyperlink">
|
451
|
+
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
452
|
+
<a href="#_Toc">1.1. Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
453
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
454
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
455
|
+
<span style="mso-element:field-begin"></span></span>
|
456
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
457
|
+
<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>
|
458
|
+
<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>
|
459
|
+
</span>
|
460
|
+
</p>
|
458
461
|
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
462
|
+
<p class="MsoToc2">
|
463
|
+
<span class="MsoHyperlink">
|
464
|
+
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
465
|
+
<a href="#_Toc">1.2. Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
466
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
467
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
468
|
+
<span style="mso-element:field-begin"></span></span>
|
469
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
470
|
+
<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>
|
471
|
+
<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>
|
472
|
+
</span>
|
473
|
+
</p>
|
471
474
|
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
<p class="MsoToc3">
|
486
|
-
<span class="MsoHyperlink">
|
487
|
-
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
488
|
-
<a href="#_Toc">1.2.1. Clause 4.2.1<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
489
|
-
<span style="mso-tab-count:1 dotted">. </span>
|
490
|
-
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
491
|
-
<span style="mso-element:field-begin"></span></span>
|
492
|
-
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
493
|
-
<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>
|
494
|
-
<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>
|
495
|
-
</span>
|
496
|
-
</p>
|
475
|
+
<p class="MsoToc3">
|
476
|
+
<span class="MsoHyperlink">
|
477
|
+
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
478
|
+
<a href="#_Toc">1.2.1. Clause 4.2.1<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
479
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
480
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
481
|
+
<span style="mso-element:field-begin"></span></span>
|
482
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
483
|
+
<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>
|
484
|
+
<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>
|
485
|
+
</span>
|
486
|
+
</p>
|
497
487
|
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
488
|
+
<p class="MsoToc1">
|
489
|
+
<span lang="EN-GB" xml:lang="EN-GB">
|
490
|
+
<span style="mso-element:field-end"></span>
|
491
|
+
</span>
|
492
|
+
<span lang="EN-GB" xml:lang="EN-GB">
|
493
|
+
<p class="MsoNormal"> </p>
|
494
|
+
</span>
|
495
|
+
</p>
|
506
496
|
|
507
497
|
|
508
|
-
|
509
|
-
|
498
|
+
<p class="MsoNormal"> </p>
|
499
|
+
</div>
|
510
500
|
OUTPUT
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
FileUtils.rm_f
|
515
|
-
FileUtils.rm_f
|
516
|
-
IsoDoc::HtmlConvert.new(
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
</note>
|
522
|
-
|
523
|
-
|
501
|
+
end
|
502
|
+
|
503
|
+
it 'generates HTML output with custom ToC levels function' do
|
504
|
+
FileUtils.rm_f 'test.doc'
|
505
|
+
FileUtils.rm_f 'test.html'
|
506
|
+
IsoDoc::HtmlConvert.new(htmltoclevels: 3).convert('test', <<~"INPUT", false)
|
507
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
508
|
+
<preface><foreword>
|
509
|
+
<note>
|
510
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
511
|
+
</note>
|
512
|
+
</foreword></preface>
|
513
|
+
</iso-standard>
|
524
514
|
INPUT
|
525
|
-
html = File.read(
|
515
|
+
html = File.read('test.html')
|
526
516
|
toclevel = <<~"TOCLEVEL"
|
527
|
-
function toclevel() { return "h1:not(:empty):not(.TermNum):not(.noTOC),h2:not(:empty):not(.TermNum):not(.noTOC),h3:not(:empty):not(.TermNum):not(.noTOC)";}
|
517
|
+
function toclevel() { return "h1:not(:empty):not(.TermNum):not(.noTOC),h2:not(:empty):not(.TermNum):not(.noTOC),h3:not(:empty):not(.TermNum):not(.noTOC)";}
|
528
518
|
TOCLEVEL
|
529
519
|
expect(html).to include toclevel
|
530
520
|
end
|
531
521
|
|
532
|
-
it
|
533
|
-
FileUtils.rm_f
|
534
|
-
IsoDoc::HtmlConvert.new(
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
</fn><clause id="N" inline-header="false" obligation="normative">
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
</fn></title>
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
</fn></p>
|
550
|
-
|
551
|
-
|
552
|
-
|
522
|
+
it 'reorders footnote numbers in HTML' do
|
523
|
+
FileUtils.rm_f 'test.html'
|
524
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', wordintropage: 'spec/assets/wordintro.html').convert('test', <<~"INPUT", false)
|
525
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
526
|
+
<sections>
|
527
|
+
<clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><fn reference="3">
|
528
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">This is a footnote.</p>
|
529
|
+
</fn><clause id="N" inline-header="false" obligation="normative">
|
530
|
+
|
531
|
+
<title>Introduction to this<fn reference="2">
|
532
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
533
|
+
</fn></title>
|
534
|
+
</clause>
|
535
|
+
<clause id="O" inline-header="false" obligation="normative">
|
536
|
+
<title>Clause 4.2</title>
|
537
|
+
<p>A<fn reference="1">
|
538
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
539
|
+
</fn></p>
|
540
|
+
</clause></clause>
|
541
|
+
</sections>
|
542
|
+
</iso-standard>
|
553
543
|
INPUT
|
554
|
-
html = File.read(
|
555
|
-
|
544
|
+
html = File.read('test.html').sub(/^.*<main class="main-section">/m, '<main xmlns:epub="epub" class="main-section">')
|
545
|
+
.sub(%r{</main>.*$}m, '</main>')
|
556
546
|
expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
<h2>1.1.  Introduction to this<a rel="footnote" href="#fn:2" epub:type="footnote" id="fnref:2"><sup>2</sup></a></h2>
|
567
|
-
</div>
|
568
|
-
<div id="O">
|
569
|
-
<h2>1.2.  Clause 4.2</h2>
|
570
|
-
<p>A<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
|
571
|
-
</div>
|
547
|
+
<main xmlns:epub="epub" class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
548
|
+
<p class="zzSTDTitle1"></p>
|
549
|
+
<div id="A">
|
550
|
+
<h1>1.  Clause 4</h1>
|
551
|
+
<a class='FootnoteRef' href='#fn:3' id='fnref:1'>
|
552
|
+
<sup>1</sup>
|
553
|
+
</a>
|
554
|
+
<div id="N">
|
555
|
+
<h2>1.1.  Introduction to this<a class='FootnoteRef' href='#fn:2' id='fnref:2'><sup>2</sup></a></h2>
|
572
556
|
</div>
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
557
|
+
<div id="O">
|
558
|
+
<h2>1.2.  Clause 4.2</h2>
|
559
|
+
<p>A<a class='FootnoteRef' href='#fn:2'><sup>2</sup></a></p>
|
560
|
+
</div>
|
561
|
+
</div>
|
562
|
+
<aside id="fn:3" class="footnote">
|
563
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a class='FootnoteRef' href='#fn:3'>
|
564
|
+
<sup>1</sup>
|
565
|
+
</a>This is a footnote.</p>
|
566
|
+
<a href="#fnref:1">↩</a></aside>
|
567
|
+
<aside id="fn:2" class="footnote">
|
568
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a class='FootnoteRef' href='#fn:2'><sup>2</sup></a>Formerly denoted as 15 % (m/m).</p>
|
569
|
+
<a href="#fnref:2">↩</a></aside>
|
582
570
|
</main>
|
583
571
|
OUTPUT
|
584
572
|
end
|
585
573
|
|
586
|
-
it
|
587
|
-
FileUtils.rm_f
|
588
|
-
FileUtils.rm_rf
|
589
|
-
IsoDoc::HtmlConvert.new(
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
574
|
+
it 'moves images in HTML' do
|
575
|
+
FileUtils.rm_f 'test.html'
|
576
|
+
FileUtils.rm_rf 'test_htmlimages'
|
577
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
578
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
579
|
+
<preface><foreword>
|
580
|
+
<figure id="_">
|
581
|
+
<name>Split-it-right sample divider</name>
|
582
|
+
<image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
|
583
|
+
<image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
|
584
|
+
<image src="spec/assets/rice_image1.png" id="_" width="20000" height="300000" mimetype="image/png"/>
|
585
|
+
<image src="spec/assets/rice_image1.png" id="_" width="99" height="auto" mimetype="image/png"/>
|
586
|
+
|
587
|
+
</figure>
|
588
|
+
</foreword></preface>
|
589
|
+
</iso-standard>
|
602
590
|
INPUT
|
603
|
-
html = File.read(
|
604
|
-
|
591
|
+
html = File.read('test.html').sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
592
|
+
.sub(%r{</main>.*$}m, '</main>')
|
605
593
|
expect(`ls test_htmlimages`).to match(/\.png$/)
|
606
|
-
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/,
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
<img src="test_htmlimages/_.png" height="800" width="53" />
|
615
|
-
<img src="test_htmlimages/_.png" height="83" width="99" />
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
594
|
+
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, '/_.png'))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
595
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
596
|
+
<br />
|
597
|
+
<div>
|
598
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
599
|
+
<div id="_" class="figure">
|
600
|
+
<img src="test_htmlimages/_.png" height="776" width="922" />
|
601
|
+
<img src="test_htmlimages/_.png" height="776" width="922" />
|
602
|
+
<img src="test_htmlimages/_.png" height="800" width="53" />
|
603
|
+
<img src="test_htmlimages/_.png" height="83" width="99" />
|
604
|
+
|
605
|
+
<p class="FigureTitle" style="text-align:center;">Figure 1 — Split-it-right sample divider</p></div>
|
606
|
+
</div>
|
607
|
+
<p class="zzSTDTitle1"></p>
|
608
|
+
</main>
|
621
609
|
OUTPUT
|
622
|
-
|
623
610
|
end
|
624
611
|
|
625
|
-
|
626
|
-
|
627
|
-
FileUtils.
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
</iso-standard>
|
612
|
+
it 'moves images in HTML with no file suffix' do
|
613
|
+
FileUtils.rm_f 'test.html'
|
614
|
+
FileUtils.rm_rf 'test_htmlimages'
|
615
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
616
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
617
|
+
<preface><foreword>
|
618
|
+
<figure id="_">
|
619
|
+
<name>Split-it-right sample divider</name>
|
620
|
+
<image src="spec/assets/rice_image1" id="_" mimetype="image/png"/>
|
621
|
+
<image src="spec/assets/rice_image1" id="_" mimetype="image/*"/>
|
622
|
+
|
623
|
+
|
624
|
+
</foreword></preface>
|
625
|
+
</iso-standard>
|
640
626
|
INPUT
|
641
|
-
html = File.read(
|
642
|
-
|
627
|
+
html = File.read('test.html').sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
628
|
+
.sub(%r{</main>.*$}m, '</main>')
|
643
629
|
expect(`ls test_htmlimages`).to match(/\.png$/)
|
644
|
-
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/,
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
630
|
+
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, '/_.png'))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
631
|
+
<main class='main-section'>
|
632
|
+
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
633
|
+
<br/>
|
634
|
+
<div>
|
635
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
636
|
+
<div id='_' class='figure'>
|
637
|
+
<img src='test_htmlimages/_.png' height='776' width='922'/>
|
638
|
+
<img src='test_htmlimages/_.png' height='776' width='922'/>
|
639
|
+
|
640
|
+
<p class='FigureTitle' style='text-align:center;'>Figure 1 — Split-it-right sample divider</p>
|
641
|
+
</div>
|
655
642
|
</div>
|
656
|
-
|
657
|
-
|
658
|
-
</main>
|
643
|
+
<p class='zzSTDTitle1'/>
|
644
|
+
</main>
|
659
645
|
OUTPUT
|
660
646
|
end
|
661
647
|
|
662
|
-
it
|
663
|
-
FileUtils.rm_f
|
664
|
-
FileUtils.rm_rf
|
665
|
-
IsoDoc::HtmlConvert.new(
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
648
|
+
it 'moves images in HTML, using relative file location' do
|
649
|
+
FileUtils.rm_f 'spec/test.html'
|
650
|
+
FileUtils.rm_rf 'spec/test_htmlimages'
|
651
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('spec/test', <<~"INPUT", false)
|
652
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
653
|
+
<preface><foreword>
|
654
|
+
<figure id="_">
|
655
|
+
<name>Split-it-right sample divider</name>
|
656
|
+
<image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
|
657
|
+
<image src="assets/rice_image1.png" id="_" mimetype="image/png"/>
|
658
|
+
<image src="assets/rice_image1.png" id="_" width="20000" height="300000" mimetype="image/png"/>
|
659
|
+
<image src="assets/rice_image1.png" id="_" width="99" height="auto" mimetype="image/png"/>
|
660
|
+
</figure>
|
661
|
+
</foreword></preface>
|
662
|
+
</iso-standard>
|
677
663
|
INPUT
|
678
|
-
html = File.read(
|
679
|
-
|
664
|
+
html = File.read('spec/test.html').sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
665
|
+
.sub(%r{</main>.*$}m, '</main>')
|
680
666
|
expect(`ls test_htmlimages`).to match(/\.png$/)
|
681
|
-
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/,
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
<img src="test_htmlimages/_.png" height="800" width="53" />
|
690
|
-
<img src="test_htmlimages/_.png" height="83" width="99" />
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
667
|
+
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, '/_.png'))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
668
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
669
|
+
<br />
|
670
|
+
<div>
|
671
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
672
|
+
<div id="_" class="figure">
|
673
|
+
<img src="test_htmlimages/_.png" height="776" width="922" />
|
674
|
+
<img src="test_htmlimages/_.png" height="776" width="922" />
|
675
|
+
<img src="test_htmlimages/_.png" height="800" width="53" />
|
676
|
+
<img src="test_htmlimages/_.png" height="83" width="99" />
|
677
|
+
<p class="FigureTitle" style="text-align:center;">Figure 1 — Split-it-right sample divider</p></div>
|
678
|
+
</div>
|
679
|
+
<p class="zzSTDTitle1"></p>
|
680
|
+
</main>
|
695
681
|
OUTPUT
|
696
682
|
end
|
697
683
|
|
698
|
-
|
699
|
-
|
700
|
-
FileUtils.
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
<
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
</
|
711
|
-
</iso-standard>
|
684
|
+
it 'encodes images in HTML as data URIs' do
|
685
|
+
FileUtils.rm_f 'test.html'
|
686
|
+
FileUtils.rm_rf 'test_htmlimages'
|
687
|
+
IsoDoc::HtmlConvert.new(htmlstylesheet: 'spec/assets/html.scss', datauriimage: true).convert('test', <<~"INPUT", false)
|
688
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
689
|
+
<preface><foreword>
|
690
|
+
<figure id="_">
|
691
|
+
<name>Split-it-right sample divider</name>
|
692
|
+
<image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
|
693
|
+
<image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
|
694
|
+
</figure>
|
695
|
+
</foreword></preface>
|
696
|
+
</iso-standard>
|
712
697
|
INPUT
|
713
|
-
html = File.read(
|
714
|
-
|
698
|
+
html = File.read('test.html').sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
699
|
+
.sub(%r{</main>.*$}m, '</main>')
|
715
700
|
expect(xmlpp(html.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"}))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
701
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
702
|
+
<br />
|
703
|
+
<div>
|
704
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
705
|
+
<div id="_" class="figure">
|
706
|
+
<img src="data:image/png;base64,_" height="776" width="922" />
|
707
|
+
<img src="data:image/png;base64,_" height="776" width="922" />
|
708
|
+
<p class="FigureTitle" style="text-align:center;">Figure 1 — Split-it-right sample divider</p></div>
|
709
|
+
</div>
|
710
|
+
<p class="zzSTDTitle1"></p>
|
711
|
+
</main>
|
727
712
|
OUTPUT
|
728
|
-
|
729
713
|
end
|
730
714
|
|
731
|
-
|
732
|
-
FileUtils.rm_f
|
733
|
-
FileUtils.rm_rf
|
734
|
-
IsoDoc::HtmlConvert.new(
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
715
|
+
it 'encodes images in HTML as data URIs, using relative file location' do
|
716
|
+
FileUtils.rm_f 'spec/test.html'
|
717
|
+
FileUtils.rm_rf 'spec/test_htmlimages'
|
718
|
+
IsoDoc::HtmlConvert.new(htmlstylesheet: 'spec/assets/html.scss', datauriimage: true).convert('spec/test', <<~"INPUT", false)
|
719
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
720
|
+
<preface><foreword>
|
721
|
+
<figure id="_">
|
722
|
+
<name>Split-it-right sample divider</name>
|
723
|
+
<image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
|
724
|
+
<image src="assets/rice_image1.png" id="_" mimetype="image/png"/>
|
725
|
+
</figure>
|
726
|
+
</foreword></preface>
|
727
|
+
</iso-standard>
|
744
728
|
INPUT
|
745
|
-
html = File.read(
|
746
|
-
|
729
|
+
html = File.read('spec/test.html').sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
730
|
+
.sub(%r{</main>.*$}m, '</main>')
|
747
731
|
expect(xmlpp(html.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"}))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
732
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
733
|
+
<br />
|
734
|
+
<div>
|
735
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
736
|
+
<div id="_" class="figure">
|
737
|
+
<img src="data:image/png;base64,_" height="776" width="922" />
|
738
|
+
<img src="data:image/png;base64,_" height="776" width="922" />
|
739
|
+
<p class="FigureTitle" style="text-align:center;">Figure 1 — Split-it-right sample divider</p></div>
|
740
|
+
</div>
|
741
|
+
<p class="zzSTDTitle1"></p>
|
742
|
+
</main>
|
759
743
|
OUTPUT
|
760
|
-
|
761
744
|
end
|
762
745
|
|
763
|
-
|
764
|
-
|
765
|
-
FileUtils.rm_f
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
<
|
773
|
-
<
|
774
|
-
<
|
775
|
-
<
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
<
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
<
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
<
|
795
|
-
<
|
796
|
-
<
|
797
|
-
<
|
798
|
-
<
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
<
|
804
|
-
|
805
|
-
|
806
|
-
<
|
807
|
-
<
|
808
|
-
|
809
|
-
|
810
|
-
<
|
811
|
-
|
812
|
-
</
|
813
|
-
</
|
814
|
-
</
|
815
|
-
</iso-standard>
|
746
|
+
it 'processes IsoXML terms for HTML' do
|
747
|
+
FileUtils.rm_f 'test.html'
|
748
|
+
FileUtils.rm_f 'test.doc'
|
749
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
750
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
751
|
+
<sections>
|
752
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
753
|
+
|
754
|
+
<term id="paddy1"><preferred>paddy</preferred>
|
755
|
+
<domain>rice</domain>
|
756
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
757
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
758
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
759
|
+
<ul>
|
760
|
+
<li>A</li>
|
761
|
+
</ul>
|
762
|
+
</termexample>
|
763
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
764
|
+
<ul>
|
765
|
+
<li>A</li>
|
766
|
+
</ul>
|
767
|
+
</termexample>
|
768
|
+
|
769
|
+
<termsource status="modified">
|
770
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
771
|
+
<modification>
|
772
|
+
<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>
|
773
|
+
</modification>
|
774
|
+
</termsource></term>
|
775
|
+
|
776
|
+
<term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
|
777
|
+
<admitted>rough rice</admitted>
|
778
|
+
<deprecates>cargo rice</deprecates>
|
779
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
780
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
781
|
+
<ul>
|
782
|
+
<li>A</li>
|
783
|
+
</ul>
|
784
|
+
</termexample>
|
785
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
786
|
+
<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>
|
787
|
+
</termnote>
|
788
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
789
|
+
<ul><li>A</li></ul>
|
790
|
+
<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>
|
791
|
+
</termnote>
|
792
|
+
<termsource status="identical">
|
793
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
794
|
+
</termsource></term>
|
795
|
+
</terms>
|
796
|
+
</sections>
|
797
|
+
</iso-standard>
|
816
798
|
INPUT
|
817
|
-
expect(File.exist?(
|
818
|
-
html = File.read(
|
799
|
+
expect(File.exist?('test.html')).to be true
|
800
|
+
html = File.read('test.html')
|
819
801
|
expect(html).to match(%r{<h2 class="TermNum" id="paddy1">1\.1\.</h2>})
|
820
802
|
expect(html).to match(%r{<h2 class="TermNum" id="paddy">1\.2\.</h2>})
|
821
803
|
end
|
822
804
|
|
823
|
-
|
824
|
-
FileUtils.rm_f
|
825
|
-
FileUtils.rm_f
|
826
|
-
IsoDoc::HtmlConvert.new(
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
<
|
832
|
-
<
|
833
|
-
<
|
834
|
-
<
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
<
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
<
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
</
|
852
|
-
|
853
|
-
</terms>
|
854
|
-
</sections>
|
855
|
-
</iso-standard>
|
805
|
+
it 'processes empty term modifications' do
|
806
|
+
FileUtils.rm_f 'test.html'
|
807
|
+
FileUtils.rm_f 'test.doc'
|
808
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
809
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
810
|
+
<sections>
|
811
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
812
|
+
<term id="paddy1"><preferred>paddy</preferred>
|
813
|
+
<domain>rice</domain>
|
814
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
815
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
816
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
817
|
+
<ul>
|
818
|
+
<li>A</li>
|
819
|
+
</ul>
|
820
|
+
</termexample>
|
821
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
822
|
+
<ul>
|
823
|
+
<li>A</li>
|
824
|
+
</ul>
|
825
|
+
</termexample>
|
826
|
+
<termsource status="modified">
|
827
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
828
|
+
<modification>
|
829
|
+
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489"/>
|
830
|
+
</modification>
|
831
|
+
</termsource></term>
|
832
|
+
</terms>
|
833
|
+
</sections>
|
834
|
+
</iso-standard>
|
856
835
|
INPUT
|
857
|
-
expect(File.exist?(
|
858
|
-
html = File.read(
|
836
|
+
expect(File.exist?('test.html')).to be true
|
837
|
+
html = File.read('test.html')
|
859
838
|
expect(html).to include '[SOURCE: <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>, modified]'
|
860
839
|
end
|
861
840
|
|
862
|
-
|
863
|
-
|
864
|
-
FileUtils.rm_f
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
</iso-standard>
|
841
|
+
it 'creates continuation styles for multiparagraph list items in Word' do
|
842
|
+
FileUtils.rm_f 'test.doc'
|
843
|
+
FileUtils.rm_f 'test.html'
|
844
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
845
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
846
|
+
<preface><foreword>
|
847
|
+
<ul>
|
848
|
+
<li><p>A</p>
|
849
|
+
<p>B</p></li>
|
850
|
+
<li><ol><li><p>C</p>
|
851
|
+
<p>D</p>
|
852
|
+
<sourcecode>E</sourcecode></li>
|
853
|
+
</ol></li>
|
854
|
+
</ul>
|
855
|
+
<ol>
|
856
|
+
<li><p>A1</p>
|
857
|
+
<p>B1</p></li>
|
858
|
+
<li><ul><li><p>C1</p>
|
859
|
+
<formula id="_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62">
|
860
|
+
<stem type="AsciiMath">D1</stem>
|
861
|
+
</formula>
|
862
|
+
</ul></li>
|
863
|
+
</ol>
|
864
|
+
</foreword></preface>
|
865
|
+
</iso-standard>
|
888
866
|
INPUT
|
889
|
-
word = File.read(
|
890
|
-
|
867
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">')
|
868
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
891
869
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
</p>
|
896
|
-
<div>
|
897
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
898
|
-
<p class='MsoListParagraphCxSpFirst'>
|
899
|
-
A
|
900
|
-
<div class='ListContLevel1'>
|
901
|
-
<p class='MsoNormal'>B</p>
|
902
|
-
</div>
|
870
|
+
<div class='WordSection2' xmlns:m='m'>
|
871
|
+
<p class='MsoNormal'>
|
872
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
903
873
|
</p>
|
904
|
-
<
|
874
|
+
<div>
|
875
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
905
876
|
<p class='MsoListParagraphCxSpFirst'>
|
906
|
-
|
907
|
-
<div class='
|
908
|
-
<p class='MsoNormal'>
|
877
|
+
A
|
878
|
+
<div class='ListContLevel1'>
|
879
|
+
<p class='MsoNormal'>B</p>
|
909
880
|
</div>
|
910
|
-
|
911
|
-
|
881
|
+
</p>
|
882
|
+
<p class='MsoListParagraphCxSpLast'>
|
883
|
+
<p class='MsoListParagraphCxSpFirst'>
|
884
|
+
C
|
885
|
+
<div class='ListContLevel2'>
|
886
|
+
<p class='MsoNormal'>D</p>
|
887
|
+
</div>
|
888
|
+
<div class='ListContLevel2'>
|
889
|
+
<p class='Sourcecode'>E</p>
|
890
|
+
</div>
|
891
|
+
</p>
|
892
|
+
</p>
|
893
|
+
<p class='MsoListParagraphCxSpFirst'>
|
894
|
+
A1
|
895
|
+
<div class='ListContLevel1'>
|
896
|
+
<p class='MsoNormal'>B1</p>
|
912
897
|
</div>
|
913
898
|
</p>
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
<
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
</span>
|
934
|
-
<span style='mso-tab-count:1'>  </span>
|
935
|
-
(1)
|
936
|
-
</p>
|
899
|
+
<p class='MsoListParagraphCxSpLast'>
|
900
|
+
C1
|
901
|
+
<div class='ListContLevel2'>
|
902
|
+
<div>
|
903
|
+
<a name='_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62' id='_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62'/>
|
904
|
+
<div class='formula'>
|
905
|
+
<p class='MsoNormal'>
|
906
|
+
<span class='stem'>
|
907
|
+
<m:oMath>
|
908
|
+
<m:r>
|
909
|
+
<m:t>D1</m:t>
|
910
|
+
</m:r>
|
911
|
+
</m:oMath>
|
912
|
+
</span>
|
913
|
+
<span style='mso-tab-count:1'>  </span>
|
914
|
+
(1)
|
915
|
+
</p>
|
916
|
+
</div>
|
917
|
+
</div>
|
937
918
|
</div>
|
938
|
-
</
|
939
|
-
</
|
919
|
+
</p>
|
920
|
+
</div>
|
921
|
+
<p class='MsoNormal'> </p>
|
940
922
|
</div>
|
941
|
-
<p class='MsoNormal'> </p>
|
942
|
-
</div>
|
943
923
|
OUTPUT
|
944
924
|
end
|
945
925
|
|
946
|
-
it
|
947
|
-
|
948
|
-
FileUtils.rm_f
|
949
|
-
IsoDoc::HtmlConvert.new(
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
</sourcecode>
|
956
|
-
|
957
|
-
|
926
|
+
it 'does not lose HTML escapes in postprocessing' do
|
927
|
+
FileUtils.rm_f 'test.doc'
|
928
|
+
FileUtils.rm_f 'test.html'
|
929
|
+
IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
930
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
931
|
+
<preface><foreword>
|
932
|
+
<sourcecode id="samplecode">
|
933
|
+
<name>XML code</name>
|
934
|
+
<xml> &
|
935
|
+
</sourcecode>
|
936
|
+
</foreword></preface>
|
937
|
+
</iso-standard>
|
958
938
|
INPUT
|
959
|
-
|
960
|
-
|
939
|
+
html = File.read('test.html').sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
940
|
+
.sub(%r{</main>.*$}m, '</main>')
|
961
941
|
expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
942
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
943
|
+
<br />
|
944
|
+
<div>
|
945
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
946
|
+
<pre id="samplecode" class="prettyprint "><br />    <br />  <xml> &<br />
|
947
|
+
</pre>
|
948
|
+
<p class="SourceTitle" style="text-align:center;">Figure 1 — XML code</p>
|
949
|
+
</div>
|
950
|
+
<p class="zzSTDTitle1"></p>
|
951
|
+
</main>
|
972
952
|
OUTPUT
|
973
953
|
end
|
974
954
|
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
</
|
986
|
-
|
987
|
-
</iso-standard>
|
955
|
+
it 'does not lose HTML escapes in postprocessing (Word)' do
|
956
|
+
FileUtils.rm_f 'test.doc'
|
957
|
+
FileUtils.rm_f 'test.html'
|
958
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
959
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
960
|
+
<preface><foreword>
|
961
|
+
<sourcecode id="samplecode">
|
962
|
+
<name>XML code</name>
|
963
|
+
<xml> &
|
964
|
+
</sourcecode>
|
965
|
+
</foreword></preface>
|
966
|
+
</iso-standard>
|
988
967
|
INPUT
|
989
|
-
|
990
|
-
|
968
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
|
969
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
991
970
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
971
|
+
<div class="WordSection2">
|
972
|
+
<p class="MsoNormal">
|
973
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
974
|
+
</p>
|
975
|
+
<div>
|
976
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
977
|
+
<p class="Sourcecode" style="page-break-after:avoid;"><a name="samplecode" id="samplecode"></a><br/>    <br/>  <xml> &<br/></p><p class="SourceTitle" style="text-align:center;">Figure 1 — XML code</p>
|
978
|
+
</div>
|
979
|
+
<p class="MsoNormal"> </p>
|
999
980
|
</div>
|
1000
|
-
<p class="MsoNormal"> </p>
|
1001
|
-
</div>
|
1002
981
|
|
1003
982
|
OUTPUT
|
1004
983
|
end
|
1005
984
|
|
1006
|
-
it
|
1007
|
-
FileUtils.rm_f
|
1008
|
-
FileUtils.rm_f
|
1009
|
-
IsoDoc::WordConvert.new(
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
</example>
|
1015
|
-
|
1016
|
-
|
985
|
+
it 'propagates example style to paragraphs in postprocessing (Word)' do
|
986
|
+
FileUtils.rm_f 'test.doc'
|
987
|
+
FileUtils.rm_f 'test.html'
|
988
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
989
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
990
|
+
<preface><foreword>
|
991
|
+
<example id="samplecode">
|
992
|
+
<p>ABC</p>
|
993
|
+
</example>
|
994
|
+
</foreword></preface>
|
995
|
+
</iso-standard>
|
1017
996
|
INPUT
|
1018
|
-
|
1019
|
-
|
997
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
|
998
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
1020
999
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1021
|
-
<div class="WordSection2">
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
</div>
|
1000
|
+
<div class="WordSection2">
|
1001
|
+
<p class="MsoNormal">
|
1002
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
1003
|
+
</p>
|
1004
|
+
<div>
|
1005
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
1006
|
+
<div class="example"><a name="samplecode" id="samplecode"></a><p class="example-title">EXAMPLE</p>
|
1007
|
+
<p class="example">ABC</p>
|
1030
1008
|
</div>
|
1031
|
-
|
1032
|
-
|
1009
|
+
</div>
|
1010
|
+
<p class="MsoNormal"> </p>
|
1011
|
+
</div>
|
1033
1012
|
OUTPUT
|
1034
1013
|
end
|
1035
1014
|
|
1036
|
-
it
|
1037
|
-
FileUtils.rm_f
|
1038
|
-
FileUtils.rm_f
|
1039
|
-
IsoDoc::WordConvert.new(
|
1040
|
-
|
1041
|
-
|
1042
|
-
<figure id="fig1">
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1015
|
+
it 'deals with image captions (Word)' do
|
1016
|
+
FileUtils.rm_f 'test.doc'
|
1017
|
+
FileUtils.rm_f 'test.html'
|
1018
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
1019
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1020
|
+
<preface><foreword>
|
1021
|
+
<figure id="fig1">
|
1022
|
+
<name>Typical arrangement of the far-field scan set-up</name>
|
1023
|
+
<image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
|
1024
|
+
</figure>
|
1025
|
+
</foreword></preface>
|
1026
|
+
</iso-standard>
|
1048
1027
|
INPUT
|
1049
|
-
word = File.read(
|
1050
|
-
|
1051
|
-
|
1028
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
|
1029
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
1030
|
+
.sub(/src="[^"]+"/, 'src="_"')
|
1052
1031
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1032
|
+
<div class="WordSection2">
|
1033
|
+
<p class="MsoNormal">
|
1034
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
1035
|
+
</p>
|
1036
|
+
<div>
|
1037
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
1038
|
+
<div class="figure"><a name="fig1" id="fig1"></a>
|
1039
|
+
<p style="page-break-after:avoid;" class="figure"><img src="_" width="400" height="337"/></p>
|
1040
|
+
<p class="FigureTitle" style="text-align:center;">Figure 1 — Typical arrangement of the far-field scan set-up</p></div>
|
1041
|
+
</div>
|
1042
|
+
<p class="MsoNormal"> </p>
|
1063
1043
|
</div>
|
1064
|
-
<p class="MsoNormal"> </p>
|
1065
|
-
</div>
|
1066
1044
|
OUTPUT
|
1067
|
-
|
1068
1045
|
end
|
1069
1046
|
|
1070
|
-
it
|
1071
|
-
FileUtils.rm_f
|
1072
|
-
FileUtils.rm_f
|
1073
|
-
IsoDoc::WordConvert.new(
|
1074
|
-
|
1075
|
-
|
1076
|
-
<table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1047
|
+
it 'deals with empty table titles (Word)' do
|
1048
|
+
FileUtils.rm_f 'test.doc'
|
1049
|
+
FileUtils.rm_f 'test.html'
|
1050
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
1051
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1052
|
+
<preface><foreword>
|
1053
|
+
<table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
|
1054
|
+
<td rowspan="2">
|
1055
|
+
<p id="_c47d9b39-adb2-431d-9320-78cb148fdb56">Output wavelength <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mo>(</mo><mi>μ</mi><mi>m</mi><mo>)</mo></mrow></math></stem></p>
|
1056
|
+
</td>
|
1057
|
+
<th colspan="3" align="left">Predictive wavelengths</th>
|
1058
|
+
</tr>
|
1059
|
+
</thead>
|
1060
|
+
</table>
|
1061
|
+
</preface>
|
1062
|
+
</iso-standard>
|
1086
1063
|
INPUT
|
1087
|
-
word = File.read(
|
1088
|
-
|
1089
|
-
|
1064
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">')
|
1065
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
1066
|
+
.sub(/src="[^"]+"/, 'src="_"')
|
1090
1067
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
</table>
|
1116
|
-
</div>
|
1117
|
-
</div>
|
1118
|
-
<p class="MsoNormal"> </p>
|
1119
|
-
</div>
|
1068
|
+
<div class="WordSection2" xmlns:m="m">
|
1069
|
+
<p class="MsoNormal">
|
1070
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
1071
|
+
</p>
|
1072
|
+
<div>
|
1073
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
1074
|
+
<div align="center" class="table_container">
|
1075
|
+
<table class="MsoISOTable" style="mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;"><a name="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7"></a>
|
1076
|
+
<thead>
|
1077
|
+
<tr>
|
1078
|
+
<td rowspan="2" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:solid windowtext 1.0pt;">
|
1079
|
+
<p class="MsoNormal"><a name="_c47d9b39-adb2-431d-9320-78cb148fdb56" id="_c47d9b39-adb2-431d-9320-78cb148fdb56"></a>Output wavelength <span class="stem"><m:oMath>
|
1080
|
+
<m:r><m:t>(μm)</m:t></m:r>
|
1081
|
+
</m:oMath>
|
1082
|
+
</span></p>
|
1083
|
+
</td>
|
1084
|
+
<th colspan="3" align="left" style="font-weight:bold;border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Predictive wavelengths</th>
|
1085
|
+
</tr>
|
1086
|
+
</thead>
|
1087
|
+
</table>
|
1088
|
+
</div>
|
1089
|
+
</div>
|
1090
|
+
<p class="MsoNormal"> </p>
|
1091
|
+
</div>
|
1120
1092
|
OUTPUT
|
1121
1093
|
end
|
1122
1094
|
|
1123
|
-
|
1124
|
-
FileUtils.rm_f
|
1125
|
-
FileUtils.rm_f
|
1126
|
-
IsoDoc::WordConvert.new(
|
1127
|
-
|
1128
|
-
|
1129
|
-
<table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1095
|
+
it 'propagates alignment of table cells (Word)' do
|
1096
|
+
FileUtils.rm_f 'test.doc'
|
1097
|
+
FileUtils.rm_f 'test.html'
|
1098
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss').convert('test', <<~"INPUT", false)
|
1099
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1100
|
+
<preface><foreword>
|
1101
|
+
<table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
|
1102
|
+
<td rowspan="2" align="left">
|
1103
|
+
<p id="_c47d9b39-adb2-431d-9320-78cb148fdb56">Output wavelength</p>
|
1104
|
+
<p id="_c47d9b39-adb2-431d-9320-78cb148fdb57">Output wavelength</p>
|
1105
|
+
</td>
|
1106
|
+
<th colspan="3" align="right"><p id="_c47d9b39-adb2-431d-9320-78cb148fdb58">Predictive wavelengths</p></th>
|
1107
|
+
</tr>
|
1108
|
+
</thead>
|
1109
|
+
</table>
|
1110
|
+
</preface>
|
1111
|
+
</iso-standard>
|
1140
1112
|
INPUT
|
1141
|
-
word = File.read(
|
1142
|
-
|
1143
|
-
|
1113
|
+
word = File.read('test.doc').sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">')
|
1114
|
+
.sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, '')
|
1115
|
+
.sub(/src="[^"]+"/, 'src="_"')
|
1144
1116
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1117
|
+
<div class='WordSection2' xmlns:m='m'>
|
1118
|
+
<p class='MsoNormal'>
|
1119
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1120
|
+
</p>
|
1121
|
+
<div>
|
1122
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
1123
|
+
<div align='center' class="table_container">
|
1124
|
+
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
1125
|
+
<a name='_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7' id='_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7'/>
|
1126
|
+
<thead>
|
1127
|
+
<tr>
|
1128
|
+
<td rowspan='2' align='left' style='border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:solid windowtext 1.0pt;'>
|
1129
|
+
<p style='text-align: left' class='MsoNormal'>
|
1130
|
+
<a name='_c47d9b39-adb2-431d-9320-78cb148fdb56' id='_c47d9b39-adb2-431d-9320-78cb148fdb56'/>
|
1131
|
+
Output wavelength
|
1132
|
+
</p>
|
1133
|
+
<p style='text-align: left' class='MsoNormal'>
|
1134
|
+
<a name='_c47d9b39-adb2-431d-9320-78cb148fdb57' id='_c47d9b39-adb2-431d-9320-78cb148fdb57'/>
|
1135
|
+
Output wavelength
|
1136
|
+
</p>
|
1137
|
+
</td>
|
1138
|
+
<th colspan='3' align='right' style='font-weight:bold;border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>
|
1139
|
+
<p style='text-align: right' class='MsoNormal'>
|
1140
|
+
<a name='_c47d9b39-adb2-431d-9320-78cb148fdb58' id='_c47d9b39-adb2-431d-9320-78cb148fdb58'/>
|
1141
|
+
Predictive wavelengths
|
1142
|
+
</p>
|
1143
|
+
</th>
|
1144
|
+
</tr>
|
1145
|
+
</thead>
|
1146
|
+
</table>
|
1147
|
+
</div>
|
1175
1148
|
</div>
|
1149
|
+
<p class='MsoNormal'> </p>
|
1176
1150
|
</div>
|
1177
|
-
<p class='MsoNormal'> </p>
|
1178
|
-
</div>
|
1179
1151
|
OUTPUT
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
<hr/>
|
1193
|
-
<div id="boilerplate-feedback-destination"/>
|
1194
|
-
<div id="boilerplate-legal-destination"/>
|
1195
|
-
<div id="boilerplate-license-destination"/>
|
1196
|
-
<div id="boilerplate-copyright-destination"/>
|
1197
|
-
</div>
|
1198
|
-
</body>
|
1199
|
-
</html>
|
1200
|
-
INPUT
|
1201
|
-
<main class='main-section'>
|
1202
|
-
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
1152
|
+
end
|
1153
|
+
|
1154
|
+
it 'cleans up boilerplate' do
|
1155
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', filename: 'test').html_preface(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, '<main').sub(%r{</main>.*$}m, '</main>')).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1156
|
+
<html>
|
1157
|
+
<head/>
|
1158
|
+
<body>
|
1159
|
+
<div class="main-section">
|
1160
|
+
<div id="boilerplate-copyright"> <h1>Copyright</h1> </div>
|
1161
|
+
<div id="boilerplate-license"> <h1>License</h1> </div>
|
1162
|
+
<div id="boilerplate-legal"> <h1>Legal</h1> </div>
|
1163
|
+
<div id="boilerplate-feedback"> <h1>Feedback</h1> </div>
|
1203
1164
|
<hr/>
|
1204
|
-
<div id=
|
1205
|
-
|
1206
|
-
|
1207
|
-
<div id=
|
1208
|
-
<h1 class='IntroTitle'>Legal</h1>
|
1209
|
-
</div>
|
1210
|
-
<div id='boilerplate-license'>
|
1211
|
-
<h1 class='IntroTitle'>License</h1>
|
1165
|
+
<div id="boilerplate-feedback-destination"/>
|
1166
|
+
<div id="boilerplate-legal-destination"/>
|
1167
|
+
<div id="boilerplate-license-destination"/>
|
1168
|
+
<div id="boilerplate-copyright-destination"/>
|
1212
1169
|
</div>
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1170
|
+
</body>
|
1171
|
+
</html>
|
1172
|
+
INPUT
|
1173
|
+
<main class='main-section'>
|
1174
|
+
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
1175
|
+
<hr/>
|
1176
|
+
<div id='boilerplate-feedback'>
|
1177
|
+
<h1 class='IntroTitle'>Feedback</h1>
|
1178
|
+
</div>
|
1179
|
+
<div id='boilerplate-legal'>
|
1180
|
+
<h1 class='IntroTitle'>Legal</h1>
|
1181
|
+
</div>
|
1182
|
+
<div id='boilerplate-license'>
|
1183
|
+
<h1 class='IntroTitle'>License</h1>
|
1184
|
+
</div>
|
1185
|
+
<div id='boilerplate-copyright'>
|
1186
|
+
<h1 class='IntroTitle'>Copyright</h1>
|
1187
|
+
</div>
|
1188
|
+
</main>
|
1217
1189
|
OUTPUT
|
1218
1190
|
end
|
1219
1191
|
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
<hr/>
|
1231
|
-
<div id="boilerplate-feedback-destination"/>
|
1232
|
-
<div id="boilerplate-legal-destination"/>
|
1233
|
-
<div id="boilerplate-license-destination"/>
|
1234
|
-
<div id="boilerplate-copyright-destination"/>
|
1235
|
-
</div>
|
1236
|
-
</body>
|
1237
|
-
</html>
|
1238
|
-
INPUT
|
1239
|
-
<html>
|
1240
|
-
<head/>
|
1241
|
-
<body>
|
1242
|
-
<div class='main-section'>
|
1192
|
+
it 'cleans up boilerplate (Word)' do
|
1193
|
+
expect(xmlpp(IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', filename: 'test').word_cleanup(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, '<main').sub(%r{</main>.*$}m, '</main>')).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1194
|
+
<html>
|
1195
|
+
<head/>
|
1196
|
+
<body>
|
1197
|
+
<div class="main-section">
|
1198
|
+
<div id="boilerplate-copyright"> <h1>Copyright</h1> </div>
|
1199
|
+
<div id="boilerplate-license"> <h1>License</h1> </div>
|
1200
|
+
<div id="boilerplate-legal"> <h1>Legal</h1> </div>
|
1201
|
+
<div id="boilerplate-feedback"> <h1>Feedback</h1> </div>
|
1243
1202
|
<hr/>
|
1244
|
-
<div id=
|
1245
|
-
|
1246
|
-
|
1247
|
-
<div id=
|
1248
|
-
<p class='TitlePageSubhead'>Legal</p>
|
1249
|
-
</div>
|
1250
|
-
<div id='boilerplate-license'>
|
1251
|
-
<p class='TitlePageSubhead'>License</p>
|
1203
|
+
<div id="boilerplate-feedback-destination"/>
|
1204
|
+
<div id="boilerplate-legal-destination"/>
|
1205
|
+
<div id="boilerplate-license-destination"/>
|
1206
|
+
<div id="boilerplate-copyright-destination"/>
|
1252
1207
|
</div>
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1208
|
+
</body>
|
1209
|
+
</html>
|
1210
|
+
INPUT
|
1211
|
+
<html>
|
1212
|
+
<head/>
|
1213
|
+
<body>
|
1214
|
+
<div class='main-section'>
|
1215
|
+
<hr/>
|
1216
|
+
<div id='boilerplate-feedback'>
|
1217
|
+
<p class='TitlePageSubhead'>Feedback</p>
|
1218
|
+
</div>
|
1219
|
+
<div id='boilerplate-legal'>
|
1220
|
+
<p class='TitlePageSubhead'>Legal</p>
|
1221
|
+
</div>
|
1222
|
+
<div id='boilerplate-license'>
|
1223
|
+
<p class='TitlePageSubhead'>License</p>
|
1224
|
+
</div>
|
1225
|
+
<div id='boilerplate-copyright'>
|
1226
|
+
<p class='TitlePageSubhead'>Copyright</p>
|
1227
|
+
</div>
|
1228
|
+
</div>
|
1229
|
+
</body>
|
1230
|
+
</html>
|
1259
1231
|
OUTPUT
|
1260
1232
|
end
|
1261
1233
|
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
<thead>
|
1302
|
-
<tr>
|
1303
|
-
<th align="left">A</th>
|
1304
|
-
<th align="left">B</th>
|
1305
|
-
</tr>
|
1306
|
-
</thead>
|
1307
|
-
<tbody>
|
1308
|
-
<tr>
|
1309
|
-
<td align="left">C</td>
|
1310
|
-
<td align="left">D</td>
|
1311
|
-
</tr>
|
1312
|
-
</tbody>
|
1313
|
-
<note id="_8fff1596-290e-4314-b03c-7a8aab97eebe">
|
1314
|
-
<p id="_32c22439-387a-48cf-a006-5ab3b934ba73">B</p>
|
1315
|
-
</note></table>
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1234
|
+
it 'deals with landscape and portrait pagebreaks (Word)' do
|
1235
|
+
FileUtils.rm_f 'test.doc'
|
1236
|
+
IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', filename: 'test').convert('test', <<~"INPUT", false)
|
1237
|
+
<standard-document xmlns="http://riboseinc.com/isoxml">
|
1238
|
+
<bibdata type="standard">
|
1239
|
+
<title language="en" format="text/plain">Document title</title>
|
1240
|
+
<version>
|
1241
|
+
<draft>1.2</draft>
|
1242
|
+
</version>
|
1243
|
+
<language>en</language>
|
1244
|
+
<script>Latn</script>
|
1245
|
+
<status><stage>published</stage></status>
|
1246
|
+
<ext>
|
1247
|
+
<doctype>article</doctype>
|
1248
|
+
</ext>
|
1249
|
+
</bibdata>
|
1250
|
+
<preface>
|
1251
|
+
<introduction><title>Preface 1</title>
|
1252
|
+
<p align="center">This is a <pagebreak orientation="landscape"/> paragraph</p>
|
1253
|
+
<table>
|
1254
|
+
<tbody>
|
1255
|
+
<tr><td>A</td><td>B</td></tr>
|
1256
|
+
</tbody>
|
1257
|
+
</table>
|
1258
|
+
<clause><title>Preface 1.1</title>
|
1259
|
+
<p>On my side</p>
|
1260
|
+
<pagebreak orientation="portrait"/>
|
1261
|
+
<p>Upright again</p>
|
1262
|
+
</clause>
|
1263
|
+
<clause><title>Preface 1.3</title>
|
1264
|
+
<p>And still upright</p>
|
1265
|
+
</clause>
|
1266
|
+
</introduction>
|
1267
|
+
</preface>
|
1268
|
+
<sections><clause><title>Foreword</title>
|
1269
|
+
<note>
|
1270
|
+
<p id="_">For further information on the Foreword, see <strong>ISO/IEC Directives, Part 2, 2016, Clause 12.</strong></p>
|
1271
|
+
<pagebreak orientation="landscape"/>
|
1272
|
+
<table id="_c09a7e60-b0c7-4418-9bfc-2ef0bc09a249">
|
1273
|
+
<thead>
|
1274
|
+
<tr>
|
1275
|
+
<th align="left">A</th>
|
1276
|
+
<th align="left">B</th>
|
1277
|
+
</tr>
|
1278
|
+
</thead>
|
1279
|
+
<tbody>
|
1280
|
+
<tr>
|
1281
|
+
<td align="left">C</td>
|
1282
|
+
<td align="left">D</td>
|
1283
|
+
</tr>
|
1284
|
+
</tbody>
|
1285
|
+
<note id="_8fff1596-290e-4314-b03c-7a8aab97eebe">
|
1286
|
+
<p id="_32c22439-387a-48cf-a006-5ab3b934ba73">B</p>
|
1287
|
+
</note></table>
|
1288
|
+
<pagebreak orientation="portrait"/>
|
1289
|
+
<p>And up</p>
|
1290
|
+
</note>
|
1291
|
+
<pagebreak orientation="portrait"/>
|
1292
|
+
</clause></sections>
|
1293
|
+
<annex id="_level_1" inline-header="false" obligation="normative">
|
1294
|
+
<title>Annex 1</title>
|
1295
|
+
</annex>
|
1296
|
+
</standard-document>
|
1325
1297
|
INPUT
|
1326
|
-
|
1327
|
-
html = File.read(
|
1328
|
-
expect(html).to include
|
1329
|
-
expect(html).to include
|
1330
|
-
expect(html).to include
|
1331
|
-
expect(html).to include
|
1332
|
-
expect(html).to include
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
</div>
|
1340
|
-
<p class='MsoNormal'>
|
1341
|
-
<br clear='all' class='section'/>
|
1342
|
-
</p>
|
1343
|
-
<div class='WordSection2'>
|
1344
|
-
<p class='MsoNormal'>
|
1345
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1346
|
-
</p>
|
1347
|
-
<div class='Section3' id=''>
|
1348
|
-
<h1 class='IntroTitle'>Introduction</h1>
|
1349
|
-
<p align='center' style='text-align:center' class='MsoNormal'>
|
1350
|
-
This is a
|
1298
|
+
expect(File.exist?('test.doc')).to be true
|
1299
|
+
html = File.read('test.doc', encoding: 'UTF-8')
|
1300
|
+
expect(html).to include 'div.WordSection2_0 {page:WordSection2P;}'
|
1301
|
+
expect(html).to include 'div.WordSection2_1 {page:WordSection2L;}'
|
1302
|
+
expect(html).to include 'div.WordSection3_0 {page:WordSection3P;}'
|
1303
|
+
expect(html).to include 'div.WordSection3_1 {page:WordSection3P;}'
|
1304
|
+
expect(html).to include 'div.WordSection3_2 {page:WordSection3L;}'
|
1305
|
+
|
1306
|
+
expect(xmlpp(html.sub(/^.*<body /m, '<body ').sub(%r{</body>.*$}m, '</body>'))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1307
|
+
<body lang='EN-US' xml:lang='EN-US' link='blue' vlink='#954F72'>
|
1308
|
+
<div class='WordSection1'>
|
1309
|
+
<p class='MsoNormal'> </p>
|
1310
|
+
</div>
|
1351
1311
|
<p class='MsoNormal'>
|
1352
1312
|
<br clear='all' class='section'/>
|
1353
1313
|
</p>
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
<
|
1395
|
-
|
1396
|
-
|
1397
|
-
<b>ISO/IEC Directives, Part 2, 2016, Clause 12.</b>
|
1398
|
-
</p>
|
1399
|
-
<p class='Note'>
|
1314
|
+
<div class='WordSection2'>
|
1315
|
+
<p class='MsoNormal'>
|
1316
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1317
|
+
</p>
|
1318
|
+
<div class='Section3' id=''>
|
1319
|
+
<h1 class='IntroTitle'>Introduction</h1>
|
1320
|
+
<p align='center' style='text-align:center;' class='MsoNormal'>
|
1321
|
+
This is a
|
1322
|
+
<p class='MsoNormal'>
|
1323
|
+
<br clear='all' class='section'/>
|
1324
|
+
</p>
|
1325
|
+
paragraph
|
1326
|
+
</p>
|
1327
|
+
</div>
|
1328
|
+
</div>
|
1329
|
+
<div class='WordSection2_1'>
|
1330
|
+
<div align='center' class='table_container'>
|
1331
|
+
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
1332
|
+
<tbody>
|
1333
|
+
<tr>
|
1334
|
+
<td style='border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>A</td>
|
1335
|
+
<td style='border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>B</td>
|
1336
|
+
</tr>
|
1337
|
+
</tbody>
|
1338
|
+
</table>
|
1339
|
+
</div>
|
1340
|
+
<div>
|
1341
|
+
<h1>Preface 1.1</h1>
|
1342
|
+
<p class='MsoNormal'>On my side</p>
|
1343
|
+
<p class='MsoNormal'>
|
1344
|
+
<br clear='all' class='section'/>
|
1345
|
+
</p>
|
1346
|
+
</div>
|
1347
|
+
</div>
|
1348
|
+
<div class='WordSection2_0'>
|
1349
|
+
<p class='MsoNormal'>Upright again</p>
|
1350
|
+
<div>
|
1351
|
+
<h1>Preface 1.3</h1>
|
1352
|
+
<p class='MsoNormal'>And still upright</p>
|
1353
|
+
</div>
|
1354
|
+
<p class='MsoNormal'> </p>
|
1355
|
+
</div>
|
1356
|
+
<p class='MsoNormal'>
|
1400
1357
|
<br clear='all' class='section'/>
|
1401
1358
|
</p>
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
</
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1359
|
+
<div class='WordSection3'>
|
1360
|
+
<p class='zzSTDTitle1'>Document title</p>
|
1361
|
+
<div>
|
1362
|
+
<h1>Foreword</h1>
|
1363
|
+
<div class='Note'>
|
1364
|
+
<p class='Note'>
|
1365
|
+
<span class='note_label'>NOTE 1</span>
|
1366
|
+
<span style='mso-tab-count:1'>  </span>
|
1367
|
+
For further information on the Foreword, see
|
1368
|
+
<b>ISO/IEC Directives, Part 2, 2016, Clause 12.</b>
|
1369
|
+
</p>
|
1370
|
+
<p class='Note'>
|
1371
|
+
<br clear='all' class='section'/>
|
1372
|
+
</p>
|
1373
|
+
</div>
|
1374
|
+
</div>
|
1375
|
+
</div>
|
1376
|
+
<div class='WordSection3_2'>
|
1377
|
+
<p class='TableTitle' style='text-align:center;'>Table 1</p>
|
1378
|
+
<div align='center' class='table_container'>
|
1379
|
+
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
1380
|
+
<a name='_c09a7e60-b0c7-4418-9bfc-2ef0bc09a249' id='_c09a7e60-b0c7-4418-9bfc-2ef0bc09a249'/>
|
1381
|
+
<thead>
|
1382
|
+
<tr>
|
1383
|
+
<th align='left' style='font-weight:bold;border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>A</th>
|
1384
|
+
<th align='left' style='font-weight:bold;border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>B</th>
|
1385
|
+
</tr>
|
1386
|
+
</thead>
|
1387
|
+
<tbody>
|
1388
|
+
<tr>
|
1389
|
+
<td align='left' style='border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>C</td>
|
1390
|
+
<td align='left' style='border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>D</td>
|
1391
|
+
</tr>
|
1392
|
+
</tbody>
|
1393
|
+
<tfoot>
|
1394
|
+
<tr>
|
1395
|
+
<td colspan='2' style='border-top:0pt;mso-border-top-alt:0pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>
|
1396
|
+
<div class='Note'>
|
1397
|
+
<a name='_8fff1596-290e-4314-b03c-7a8aab97eebe' id='_8fff1596-290e-4314-b03c-7a8aab97eebe'/>
|
1398
|
+
<p class='Note'>
|
1399
|
+
<span class='note_label'>NOTE</span>
|
1400
|
+
<span style='mso-tab-count:1'>  </span>
|
1401
|
+
B
|
1402
|
+
</p>
|
1403
|
+
</div>
|
1404
|
+
</td>
|
1405
|
+
</tr>
|
1406
|
+
</tfoot>
|
1407
|
+
</table>
|
1408
|
+
</div>
|
1409
|
+
<p class='Note'>
|
1410
|
+
<br clear='all' class='section'/>
|
1411
|
+
</p>
|
1412
|
+
</div>
|
1413
|
+
<div class='WordSection3_1'>
|
1414
|
+
<p class='Note'>And up</p>
|
1415
|
+
<p class='MsoNormal'>
|
1416
|
+
<br clear='all' class='section'/>
|
1417
|
+
</p>
|
1418
|
+
</div>
|
1419
|
+
<div class='WordSection3_0'>
|
1420
|
+
<div class='Section3'>
|
1421
|
+
<a name='_level_1' id='_level_1'/>
|
1422
|
+
<h1 class='Annex'>
|
1423
|
+
<b>Annex A</b>
|
1424
|
+
<br/>
|
1425
|
+
(normative)
|
1426
|
+
<br/>
|
1427
|
+
<br/>
|
1428
|
+
<b>Annex 1</b>
|
1429
|
+
</h1>
|
1460
1430
|
</div>
|
1461
|
-
|
1462
|
-
|
1431
|
+
</div>
|
1432
|
+
<div style='mso-element:footnote-list'/>
|
1433
|
+
</body>
|
1463
1434
|
OUTPUT
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
<table id="_a0f8c202-fd34-460c-bd5e-b2f4cc29210d" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 1-1:</p></th></tr></thead><tbody><tr style="background:#C9C9C9;"><td style="vertical-align:top;" class="recommend" colspan="2">
|
1475
|
-
<p id="_2e2c247b-ce4c-48c5-96dd-f3e090a5b4a7">Description text</p>
|
1476
|
-
</td></tr></tbody></table>
|
1477
|
-
</tbody></table>
|
1478
|
-
</div>
|
1479
|
-
|
1480
|
-
|
1481
|
-
<table id="_9846c486-14e5-4b1c-bb2f-55cc254dd309" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 2:</p></th></tr></thead><tbody><tr><td style="vertical-align:top;" class="recommend" colspan="2"><p>requirement label</p></td></tr><table id="_62de974c-7128-44d6-ba86-99f818f1d467" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 2-1:</p></th></tr></thead><tbody><tr style="background:#C9C9C9;"><td style="vertical-align:top;" class="recommend" colspan="2">
|
1482
|
-
<p id="_30b90b08-bd71-4497-bbcc-8c61fbb9f772">Description text</p>
|
1483
|
-
</td></tr></tbody></table>
|
1484
|
-
<table id="_fede5681-71f6-47bb-bc65-7bd0b11acd01" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 2-2:</p></th></tr></thead><tbody><tr><td style="vertical-align:top;" class="recommend" colspan="2">
|
1485
|
-
<p id="_8daa3d74-90fd-4a57-9169-de457a68cfda">Description text</p>
|
1486
|
-
</td></tr></tbody></table></tbody></table>
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1435
|
+
end
|
1436
|
+
|
1437
|
+
it 'expands out nested tables in Word' do
|
1438
|
+
expect(xmlpp(IsoDoc::WordConvert.new(wordstylesheet: 'spec/assets/word.css', htmlstylesheet: 'spec/assets/html.scss', filename: 'test').word_cleanup(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, '<main').sub(%r{</main>.*$}m, '</main>')).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1439
|
+
<html>
|
1440
|
+
<head/>
|
1441
|
+
<body>
|
1442
|
+
<div class="main-section">
|
1443
|
+
<table id="_7830dff8-419e-4b9e-85cf-a063689f44ca" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 1:</p></th></tr></thead><tbody><tr><td style="vertical-align:top;" class="recommend" colspan="2"><p>requirement label</p></td></tr>
|
1444
|
+
|
1445
|
+
<table id="_a0f8c202-fd34-460c-bd5e-b2f4cc29210d" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 1-1:</p></th></tr></thead><tbody><tr style="background:#C9C9C9;"><td style="vertical-align:top;" class="recommend" colspan="2">
|
1446
|
+
<p id="_2e2c247b-ce4c-48c5-96dd-f3e090a5b4a7">Description text</p>
|
1447
|
+
</td></tr></tbody></table>
|
1448
|
+
</tbody></table>
|
1449
|
+
</div>
|
1450
|
+
<div id="_second_sample"><h2>1.2.<span style="mso-tab-count:1">  </span>Second sample</h2>
|
1451
|
+
|
1452
|
+
<table id="_9846c486-14e5-4b1c-bb2f-55cc254dd309" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 2:</p></th></tr></thead><tbody><tr><td style="vertical-align:top;" class="recommend" colspan="2"><p>requirement label</p></td></tr><table id="_62de974c-7128-44d6-ba86-99f818f1d467" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 2-1:</p></th></tr></thead><tbody><tr style="background:#C9C9C9;"><td style="vertical-align:top;" class="recommend" colspan="2">
|
1453
|
+
<p id="_30b90b08-bd71-4497-bbcc-8c61fbb9f772">Description text</p>
|
1454
|
+
</td></tr></tbody></table>
|
1455
|
+
<table id="_fede5681-71f6-47bb-bc65-7bd0b11acd01" class="recommend" style="border-collapse:collapse;border-spacing:0;"><thead><tr style="background:#A5A5A5;"><th style="vertical-align:top;" class="recommend" colspan="2"><p class="RecommendationTitle">Requirement 2-2:</p></th></tr></thead><tbody><tr><td style="vertical-align:top;" class="recommend" colspan="2">
|
1456
|
+
<p id="_8daa3d74-90fd-4a57-9169-de457a68cfda">Description text</p>
|
1457
|
+
</td></tr></tbody></table></tbody></table>
|
1458
|
+
</div>
|
1459
|
+
</body>
|
1460
|
+
</html>
|
1490
1461
|
INPUT
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
</html>
|
1462
|
+
<html>
|
1463
|
+
<head/>
|
1464
|
+
<body>
|
1465
|
+
<div class='main-section'>
|
1466
|
+
<table id='_7830dff8-419e-4b9e-85cf-a063689f44ca' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
|
1467
|
+
<thead>
|
1468
|
+
<tr style='background:#A5A5A5;'>
|
1469
|
+
<th style='vertical-align:top;' class='recommend' colspan='2'>
|
1470
|
+
<p class='RecommendationTitle'>Requirement 1:</p>
|
1471
|
+
</th>
|
1472
|
+
</tr>
|
1473
|
+
</thead>
|
1474
|
+
<tbody>
|
1475
|
+
<tr>
|
1476
|
+
<td style='vertical-align:top;' class='recommend' colspan='2'>
|
1477
|
+
<p>requirement label</p>
|
1478
|
+
</td>
|
1479
|
+
</tr>
|
1480
|
+
</tbody>
|
1481
|
+
</table>
|
1482
|
+
<table id='_a0f8c202-fd34-460c-bd5e-b2f4cc29210d' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
|
1483
|
+
<thead>
|
1484
|
+
<tr style='background:#A5A5A5;'>
|
1485
|
+
<th style='vertical-align:top;' class='recommend' colspan='2'>
|
1486
|
+
<p class='RecommendationTitle'>Requirement 1-1:</p>
|
1487
|
+
</th>
|
1488
|
+
</tr>
|
1489
|
+
</thead>
|
1490
|
+
<tbody>
|
1491
|
+
<tr style='background:#C9C9C9;'>
|
1492
|
+
<td style='vertical-align:top;' class='recommend' colspan='2'>
|
1493
|
+
<p id='_2e2c247b-ce4c-48c5-96dd-f3e090a5b4a7'>Description text</p>
|
1494
|
+
</td>
|
1495
|
+
</tr>
|
1496
|
+
</tbody>
|
1497
|
+
</table>
|
1498
|
+
</div>
|
1499
|
+
<div id='_second_sample'>
|
1500
|
+
<h2>
|
1501
|
+
1.2.
|
1502
|
+
<span style='mso-tab-count:1'>  </span>
|
1503
|
+
Second sample
|
1504
|
+
</h2>
|
1505
|
+
<table id='_9846c486-14e5-4b1c-bb2f-55cc254dd309' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
|
1506
|
+
<thead>
|
1507
|
+
<tr style='background:#A5A5A5;'>
|
1508
|
+
<th style='vertical-align:top;' class='recommend' colspan='2'>
|
1509
|
+
<p class='RecommendationTitle'>Requirement 2:</p>
|
1510
|
+
</th>
|
1511
|
+
</tr>
|
1512
|
+
</thead>
|
1513
|
+
<tbody>
|
1514
|
+
<tr>
|
1515
|
+
<td style='vertical-align:top;' class='recommend' colspan='2'>
|
1516
|
+
<p>requirement label</p>
|
1517
|
+
</td>
|
1518
|
+
</tr>
|
1519
|
+
</tbody>
|
1520
|
+
</table>
|
1521
|
+
<table id='_62de974c-7128-44d6-ba86-99f818f1d467' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
|
1522
|
+
<thead>
|
1523
|
+
<tr style='background:#A5A5A5;'>
|
1524
|
+
<th style='vertical-align:top;' class='recommend' colspan='2'>
|
1525
|
+
<p class='RecommendationTitle'>Requirement 2-1:</p>
|
1526
|
+
</th>
|
1527
|
+
</tr>
|
1528
|
+
</thead>
|
1529
|
+
<tbody>
|
1530
|
+
<tr style='background:#C9C9C9;'>
|
1531
|
+
<td style='vertical-align:top;' class='recommend' colspan='2'>
|
1532
|
+
<p id='_30b90b08-bd71-4497-bbcc-8c61fbb9f772'>Description text</p>
|
1533
|
+
</td>
|
1534
|
+
</tr>
|
1535
|
+
</tbody>
|
1536
|
+
</table>
|
1537
|
+
<table id='_fede5681-71f6-47bb-bc65-7bd0b11acd01' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
|
1538
|
+
<thead>
|
1539
|
+
<tr style='background:#A5A5A5;'>
|
1540
|
+
<th style='vertical-align:top;' class='recommend' colspan='2'>
|
1541
|
+
<p class='RecommendationTitle'>Requirement 2-2:</p>
|
1542
|
+
</th>
|
1543
|
+
</tr>
|
1544
|
+
</thead>
|
1545
|
+
<tbody>
|
1546
|
+
<tr>
|
1547
|
+
<td style='vertical-align:top;' class='recommend' colspan='2'>
|
1548
|
+
<p id='_8daa3d74-90fd-4a57-9169-de457a68cfda'>Description text</p>
|
1549
|
+
</td>
|
1550
|
+
</tr>
|
1551
|
+
</tbody>
|
1552
|
+
</table>
|
1553
|
+
</div>
|
1554
|
+
</body>
|
1555
|
+
</html>
|
1585
1556
|
OUTPUT
|
1586
|
-
|
1587
|
-
|
1557
|
+
end
|
1588
1558
|
end
|