isodoc 1.0.27 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +4 -8
  3. data/.github/workflows/ubuntu.yml +18 -16
  4. data/.github/workflows/windows.yml +4 -8
  5. data/Rakefile +3 -1
  6. data/isodoc.gemspec +2 -2
  7. data/lib/isodoc.rb +2 -0
  8. data/lib/isodoc/base_style/metanorma_word.scss +0 -1
  9. data/lib/isodoc/base_style/reset.scss +3 -3
  10. data/lib/isodoc/common.rb +0 -4
  11. data/lib/isodoc/convert.rb +121 -58
  12. data/lib/isodoc/function/blocks.rb +42 -53
  13. data/lib/isodoc/function/blocks_example_note.rb +108 -0
  14. data/lib/isodoc/function/cleanup.rb +8 -4
  15. data/lib/isodoc/function/i18n.rb +1 -0
  16. data/lib/isodoc/function/inline.rb +70 -90
  17. data/lib/isodoc/function/inline_simple.rb +72 -0
  18. data/lib/isodoc/function/lists.rb +12 -6
  19. data/lib/isodoc/function/references.rb +33 -38
  20. data/lib/isodoc/function/reqt.rb +14 -5
  21. data/lib/isodoc/function/section.rb +8 -11
  22. data/lib/isodoc/function/table.rb +4 -4
  23. data/lib/isodoc/function/terms.rb +3 -3
  24. data/lib/isodoc/function/to_word_html.rb +21 -13
  25. data/lib/isodoc/function/utils.rb +57 -50
  26. data/lib/isodoc/gem_tasks.rb +104 -0
  27. data/lib/isodoc/headlesshtml_convert.rb +7 -6
  28. data/lib/isodoc/html_convert.rb +2 -1
  29. data/lib/isodoc/html_function/footnotes.rb +1 -1
  30. data/lib/isodoc/html_function/html.rb +13 -1
  31. data/lib/isodoc/html_function/postprocess.rb +4 -4
  32. data/lib/isodoc/metadata.rb +74 -62
  33. data/lib/isodoc/pdf_convert.rb +8 -6
  34. data/lib/isodoc/presentation_xml_convert.rb +29 -0
  35. data/lib/isodoc/sassc_importer.rb +11 -0
  36. data/lib/isodoc/version.rb +1 -1
  37. data/lib/isodoc/word_convert.rb +2 -1
  38. data/lib/isodoc/word_function/body.rb +14 -48
  39. data/lib/isodoc/word_function/footnotes.rb +1 -1
  40. data/lib/isodoc/word_function/inline.rb +75 -0
  41. data/lib/isodoc/word_function/postprocess.rb +1 -0
  42. data/lib/isodoc/word_function/table.rb +3 -3
  43. data/lib/isodoc/xref.rb +59 -0
  44. data/lib/isodoc/{function → xref}/xref_anchor.rb +10 -21
  45. data/lib/isodoc/xref/xref_counter.rb +74 -0
  46. data/lib/isodoc/{function → xref}/xref_gen.rb +9 -22
  47. data/lib/isodoc/{function → xref}/xref_gen_seq.rb +41 -32
  48. data/lib/isodoc/{function → xref}/xref_sect_gen.rb +33 -23
  49. data/lib/isodoc/xslfo_convert.rb +16 -4
  50. data/spec/assets/{html.css → html.scss} +0 -0
  51. data/spec/assets/i18n.yaml +4 -1
  52. data/spec/assets/odf.emf +0 -0
  53. data/spec/assets/odf.svg +4 -0
  54. data/spec/assets/odf1.svg +4 -0
  55. data/spec/isodoc/blocks_spec.rb +219 -47
  56. data/spec/isodoc/cleanup_spec.rb +135 -6
  57. data/spec/isodoc/footnotes_spec.rb +22 -7
  58. data/spec/isodoc/inline_spec.rb +262 -2
  59. data/spec/isodoc/lists_spec.rb +8 -8
  60. data/spec/isodoc/metadata_spec.rb +110 -3
  61. data/spec/isodoc/postproc_spec.rb +1321 -1351
  62. data/spec/isodoc/presentation_xml_spec.rb +20 -0
  63. data/spec/isodoc/ref_spec.rb +119 -50
  64. data/spec/isodoc/section_spec.rb +84 -18
  65. data/spec/isodoc/table_spec.rb +6 -6
  66. data/spec/isodoc/terms_spec.rb +7 -7
  67. data/spec/isodoc/xref_spec.rb +165 -45
  68. metadata +36 -27
  69. data/lib/isodoc/function/blocks_example.rb +0 -53
  70. data/lib/isodoc/function/xref_counter.rb +0 -50
@@ -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 id="" class="Note">
263
+ <div class="Note">
264
264
  <p><span class="note_label">NOTE</span>&#160; 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 id="" class="Note">
326
+ <div class="Note">
327
327
  <p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">&#160; </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", :activateddate=>"2013", :agency=>"ISO", :authors=>["Barney Rubble", "Fred Flintstone"], :authors_affiliations=>{"Slate Inc., Bedrock"=>["Barney Rubble"], ""=>["Fred Flintstone"]}, :circulateddate=>"2015", :confirmeddate=>"2017", :copieddate=>"2016", :createddate=>"2010&ndash;2011", :doc=>"URL E", :docnumber=>"17301-1", :docnumeric=>"17301", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :html=>"URL B", :implementeddate=>"XXX", :issueddate=>"XXX", :iteration=>"2", :obsoleteddate=>"2014", :pdf=>"URL D", :publisheddate=>"2011", :publisher=>"", :receiveddate=>"XXX", :revdate=>"2016-05-01", :revdate_monthyear=>"May 2016", :stage=>"Committee draft", :stageabbr=>"CD", :substage=>"Withdrawn", :transmitteddate=>"2020", :unchangeddate=>"2019", :unpublished=>true, :updateddate=>"2018", :url=>"URL A", :vote_endeddate=>"2022", :vote_starteddate=>"2021", :xml=>"URL C"}
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&ndash;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", :agency=>"ISO/IEC/IEEE", :authors=>[], :authors_affiliations=>{}, :circulateddate=>"XXX", :confirmeddate=>"XXX", :copieddate=>"XXX", :createddate=>"XXX", :docnumber=>"17301-1-3", :docnumeric=>"17301", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05)", :edition=>nil, :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :partof=>"IEC 8122", :publisheddate=>"2011-01", :publisher=>"International Organization for Standardization, International Electrotechnical Commission and Institute of Electrical and Electronics Engineers", :receiveddate=>"XXX", :revdate=>"2016-05", :revdate_monthyear=>"May 2016", :stage=>"Published", :transmitteddate=>"XXX", :unchangeddate=>"XXX", :unpublished=>false, :updateddate=>"XXX", :vote_endeddate=>"XXX", :vote_starteddate=>"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", :agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :circulateddate=>"XXX", :confirmeddate=>"XXX", :copieddate=>"XXX", :createddate=>"XXX", :docnumber=>"17301-1-3", :docnumeric=>"17301", :doctitle=>"Cereals and pulses", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :publisheddate=>"2011-01", :publisher=>"International Organization for Standardization et International Electrotechnical Commission", :receiveddate=>"XXX", :revdate=>"2016-05", :revdate_monthyear=>"Mai 2016", :stage=>"Published", :transmitteddate=>"XXX", :unchangeddate=>"XXX", :unpublished=>false, :updateddate=>"XXX", :vote_endeddate=>"XXX", :vote_starteddate=>"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
- require "spec_helper"
2
- require "fileutils"
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'fileutils'
3
5
 
4
6
  RSpec.describe IsoDoc do
5
- it "generates file based on string input" do
6
- FileUtils.rm_f "test.doc"
7
- FileUtils.rm_f "test.html"
8
- IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).convert("test", <<~"INPUT", false)
9
- <iso-standard xmlns="http://riboseinc.com/isoxml">
10
- <bibdata>
11
- <title language="en">test</title>
12
- </bibdata>
13
- <preface><foreword>
14
- <note>
15
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
16
- </note>
17
- </foreword></preface>
18
- </iso-standard>
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?("test.html")).to be true
21
- html = File.read("test.html")
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 "ignores Liquid markup in the document body" do
29
- FileUtils.rm_f "test.doc"
30
- FileUtils.rm_f "test.html"
31
- IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css"}).convert("test", <<~"INPUT", false)
32
- <iso-standard xmlns="http://riboseinc.com/isoxml">
33
- <bibdata>
34
- <title language="en">test</title>
35
- </bibdata>
36
- <preface><foreword>
37
- <note>
38
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">{% elif %}These results are based on a study carried out on three different types of kernel.</p>
39
- </note>
40
- </foreword></preface>
41
- </iso-standard>
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?("test.html")).to be true
44
- html = File.read("test.html")
45
+ expect(File.exist?('test.html')).to be true
46
+ html = File.read('test.html')
45
47
  end
46
48
 
47
- it "ignores Liquid markup in the document body (Word)" do
48
- FileUtils.rm_f "test.doc"
49
- FileUtils.rm_f "test.html"
50
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css"}).convert("test", <<~"INPUT", false)
51
- <iso-standard xmlns="http://riboseinc.com/isoxml">
52
- <bibdata>
53
- <title language="en">test</title>
54
- </bibdata>
55
- <preface><foreword>
56
- <note>
57
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">{% elif %}These results are based on a study carried out on three different types of kernel.</p>
58
- </note>
59
- </foreword></preface>
60
- </iso-standard>
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?("test.doc")).to be true
63
- html = File.read("test.doc")
64
+ expect(File.exist?('test.doc')).to be true
65
+ html = File.read('test.doc')
64
66
  end
65
67
 
66
- it "generates HTML output docs with null configuration" do
67
- FileUtils.rm_f "test.doc"
68
- FileUtils.rm_f "test.html"
69
- IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css"}).convert("test", <<~"INPUT", false)
70
- <iso-standard xmlns="http://riboseinc.com/isoxml">
71
- <preface><foreword>
72
- <note>
73
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
74
- </note>
75
- </foreword></preface>
76
- </iso-standard>
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?("test.html")).to be true
79
- html = File.read("test.html")
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 "generates Word output docs with null configuration" do
87
- FileUtils.rm_f "test.doc"
88
- FileUtils.rm_f "test.html"
89
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
90
- <iso-standard xmlns="http://riboseinc.com/isoxml">
91
- <preface><foreword>
92
- <note>
93
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
94
- </note>
95
- </foreword></preface>
96
- </iso-standard>
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?("test.doc")).to be true
99
- word = File.read("test.doc")
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 "generates HTML output docs with null configuration from file" do
105
- FileUtils.rm_f "spec/assets/iso.doc"
106
- FileUtils.rm_f "spec/assets/iso.html"
107
- IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
108
- expect(File.exist?("spec/assets/iso.html")).to be true
109
- html = File.read("spec/assets/iso.html")
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 "generates Headless HTML output docs with null configuration from file" do
116
- FileUtils.rm_f "spec/assets/iso.html"
117
- IsoDoc::HeadlessHtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
118
- expect(File.exist?("spec/assets/iso.headless.html")).to be true
119
- html = File.read("spec/assets/iso.headless.html")
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 "generates Word output docs with null configuration from file" do
130
- FileUtils.rm_f "spec/assets/iso.doc"
131
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
132
- expect(File.exist?("spec/assets/iso.doc")).to be true
133
- word = File.read("spec/assets/iso.doc")
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 "generates PDF output docs with null configuration from file" do
138
- FileUtils.rm_f "spec/assets/iso.pdf"
139
- IsoDoc::PdfConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
140
- expect(File.exist?("spec/assets/iso.pdf")).to be true
141
- end
142
-
143
- it "generates HTML output docs with complete configuration" do
144
- FileUtils.rm_f "test.doc"
145
- FileUtils.rm_f "test.html"
146
- IsoDoc::HtmlConvert.new({bodyfont: "Zapf", htmlstylesheet: "spec/assets/html.css", 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)
147
- <iso-standard xmlns="http://riboseinc.com/isoxml">
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("test.html")
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 "generates HTML output docs with default fonts" do
166
- FileUtils.rm_f "test.doc"
167
- FileUtils.rm_f "test.html"
168
- IsoDoc::HtmlConvert.new({htmlstylesheet: "spec/assets/html.css", 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)
169
- <iso-standard xmlns="http://riboseinc.com/isoxml">
170
- <preface><foreword>
171
- <note>
172
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
173
- </note>
174
- </foreword></preface>
175
- </iso-standard>
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("test.html")
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 "generates Word output docs with complete configuration" do
188
- FileUtils.rm_f "test.doc"
189
- FileUtils.rm_f "test.html"
190
- IsoDoc::WordConvert.new({bodyfont: "Zapf", wordstylesheet: "spec/assets/html.css", 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)
191
- <iso-standard xmlns="http://riboseinc.com/isoxml">
192
- <preface><foreword>
193
- <note>
194
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
195
- </note>
196
- </foreword></preface>
197
- </iso-standard>
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("test.doc")
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 "generates Word output docs with default fonts" do
211
- FileUtils.rm_f "test.doc"
212
- FileUtils.rm_f "test.html"
213
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/html.css", 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)
214
- <iso-standard xmlns="http://riboseinc.com/isoxml">
215
- <preface><foreword>
216
- <note>
217
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
218
- </note>
219
- </foreword></preface>
220
- </iso-standard>
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("test.doc")
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 "converts definition lists to tables for Word" do
234
- FileUtils.rm_f "test.doc"
235
- FileUtils.rm_f "test.html"
236
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
237
- <iso-standard xmlns="http://riboseinc.com/isoxml">
238
- <preface><foreword>
239
- <dl>
240
- <dt>Term</dt>
241
- <dd>Definition</dd>
242
- <dt>Term 2</dt>
243
- <dd>Definition 2</dd>
244
- </dl>
245
- </foreword></preface>
246
- </iso-standard>
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("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
249
- sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
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
- <div class="WordSection2">
252
- <p class="MsoNormal"><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
253
- <div>
254
- <h1 class="ForewordTitle">Foreword</h1>
255
- <table class="dl">
256
- <tr>
257
- <td valign="top" align="left">
258
- <p align="left" style="margin-left:0pt;text-align:left;" class="MsoNormal">Term</p>
259
- </td>
260
- <td valign="top">Definition</td>
261
- </tr>
262
- <tr>
263
- <td valign="top" align="left">
264
- <p align="left" style="margin-left:0pt;text-align:left;" class="MsoNormal">Term 2</p>
265
- </td>
266
- <td valign="top">Definition 2</td>
267
- </tr>
268
- </table>
269
- </div>
270
- <p class="MsoNormal">&#xA0;</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">&#xA0;</p>
267
+ </div>
272
268
  OUTPUT
273
269
  end
274
270
 
275
- it "populates Word template with terms reference labels" do
276
- FileUtils.rm_f "test.doc"
277
- FileUtils.rm_f "test.html"
278
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
279
- <iso-standard xmlns="http://riboseinc.com/isoxml">
280
- <sections>
281
- <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
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
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
287
- <modification>
288
- <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>
289
- </modification>
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("test.doc").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
298
- sub(%r{<div style="mso-element:footnote-list"/>.*$}m, "")
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
- <div class="WordSection3">
301
- <p class="zzSTDTitle1"></p>
302
- <div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1.<span style="mso-tab-count:1">&#xA0; </span>Terms and Definitions</h1>
303
- <p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
304
- <p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
305
- <p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>, modified &#x2014; The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
306
- </div>
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">&#xA0; </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 &#x2014; 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 "populates Word header" do
311
- FileUtils.rm_f "test.doc"
312
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", header: "spec/assets/header.html"}).convert("test", <<~"INPUT", false)
313
- <iso-standard xmlns="http://riboseinc.com/isoxml">
314
- <bibdata type="article">
315
- <docidentifier>
316
- <project-number part="1">1000</project-number>
317
- </docidentifier>
318
- </bibdata>
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("test.doc").sub(%r{^.*Content-Location: file:///C:/Doc/test_files/header.html}m, "Content-Location: file:///C:/Doc/test_files/header.html").
323
- sub(/------=_NextPart.*$/m, "")
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 "populates Word ToC" do
337
- FileUtils.rm_f "test.doc"
338
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
339
- <iso-standard xmlns="http://riboseinc.com/isoxml">
340
- <sections>
341
- <clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
342
-
343
- <title>Introduction<bookmark id="Q"/> to this<fn reference="1">
344
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
345
- </fn></title>
346
- </clause>
347
- <clause id="O" inline-header="false" obligation="normative">
348
- <title>Clause 4.2</title>
349
- <p>A<fn reference="1">
350
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
351
- </fn></p>
352
- <clause id="P" inline-header="false" obligation="normative">
353
- <title>Clause 4.2.1</title>
354
- </clause>
355
- </clause></clause>
356
- </sections>
357
- </iso-standard>
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("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
361
- sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
362
- expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc"))).to be_equivalent_to xmlpp(<<~'OUTPUT')
363
- <div class="WordSection2">
364
- /* an empty word intro page */
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">&#xA0;</span>TOC
367
- \o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
368
- <span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
369
- <a href="#_Toc">1. Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
370
- <span style="mso-tab-count:1 dotted">. </span>
371
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
372
- <span style="mso-element:field-begin"></span></span>
373
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
374
- <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>
375
- <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>
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
- <span class="MsoHyperlink">
379
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
380
- <a href="#_Toc">1.1. Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
381
- <span style="mso-tab-count:1 dotted">. </span>
382
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
383
- <span style="mso-element:field-begin"></span></span>
384
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
385
- <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>
386
- <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>
387
- </span>
388
- </p>
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
- <span class="MsoHyperlink">
392
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
393
- <a href="#_Toc">1.2. Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
394
- <span style="mso-tab-count:1 dotted">. </span>
395
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
396
- <span style="mso-element:field-begin"></span></span>
397
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
398
- <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>
399
- <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>
400
- </span>
401
- </p>
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
- <span lang="EN-GB" xml:lang="EN-GB">
405
- <span style="mso-element:field-end"></span>
406
- </span>
407
- <span lang="EN-GB" xml:lang="EN-GB">
408
- <p class="MsoNormal">&#xA0;</p>
409
- </span>
410
- </p>
411
-
412
-
413
- <p class="MsoNormal">&#xA0;</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">&#xA0;</p>
401
+ </span>
402
+ </p>
403
+ <p class="MsoNormal">&#xA0;</p>
404
+ </div>
415
405
  OUTPUT
416
406
  end
417
407
 
418
- it "populates Word ToC with custom levels" do
419
- FileUtils.rm_f "test.doc"
420
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html", doctoclevels: 3}).convert("test", <<~"INPUT", false)
421
- <iso-standard xmlns="http://riboseinc.com/isoxml">
422
- <sections>
423
- <clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
424
-
425
- <title>Introduction<bookmark id="Q"/> to this<fn reference="1">
426
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
427
- </fn></title>
428
- </clause>
429
- <clause id="O" inline-header="false" obligation="normative">
430
- <title>Clause 4.2</title>
431
- <p>A<fn reference="1">
432
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
433
- </fn></p>
434
- <clause id="P" inline-header="false" obligation="normative">
435
- <title>Clause 4.2.1</title>
436
- </clause>
437
- </clause></clause>
438
- </sections>
439
- </iso-standard>
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("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
443
- sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
444
- expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc"))).to be_equivalent_to xmlpp(<<~'OUTPUT')
445
- <div class="WordSection2">
446
- /* an empty word intro page */
447
-
448
- <p class="MsoToc1"><span lang="EN-GB" xml:lang="EN-GB"><span style="mso-element:field-begin"></span><span style="mso-spacerun:yes">&#xA0;</span>TOC
449
- \o "1-3" \h \z \u <span style="mso-element:field-separator"></span></span>
450
- <span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
451
- <a href="#_Toc">1. Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
452
- <span style="mso-tab-count:1 dotted">. </span>
453
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
454
- <span style="mso-element:field-begin"></span></span>
455
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
456
- <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>
457
- <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>
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">&#xA0;</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
- <p class="MsoToc2">
460
- <span class="MsoHyperlink">
461
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
462
- <a href="#_Toc">1.1. Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
463
- <span style="mso-tab-count:1 dotted">. </span>
464
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
465
- <span style="mso-element:field-begin"></span></span>
466
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
467
- <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>
468
- <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>
469
- </span>
470
- </p>
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
- <p class="MsoToc2">
473
- <span class="MsoHyperlink">
474
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
475
- <a href="#_Toc">1.2. Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
476
- <span style="mso-tab-count:1 dotted">. </span>
477
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
478
- <span style="mso-element:field-begin"></span></span>
479
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
480
- <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>
481
- <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>
482
- </span>
483
- </p>
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
- <p class="MsoToc1">
499
- <span lang="EN-GB" xml:lang="EN-GB">
500
- <span style="mso-element:field-end"></span>
501
- </span>
502
- <span lang="EN-GB" xml:lang="EN-GB">
503
- <p class="MsoNormal">&#xA0;</p>
504
- </span>
505
- </p>
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">&#xA0;</p>
494
+ </span>
495
+ </p>
506
496
 
507
497
 
508
- <p class="MsoNormal">&#xA0;</p>
509
- </div>
498
+ <p class="MsoNormal">&#xA0;</p>
499
+ </div>
510
500
  OUTPUT
511
- end
512
-
513
- it "generates HTML output with custom ToC levels function" do
514
- FileUtils.rm_f "test.doc"
515
- FileUtils.rm_f "test.html"
516
- IsoDoc::HtmlConvert.new({htmltoclevels: 3}).convert("test", <<~"INPUT", false)
517
- <iso-standard xmlns="http://riboseinc.com/isoxml">
518
- <preface><foreword>
519
- <note>
520
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
521
- </note>
522
- </foreword></preface>
523
- </iso-standard>
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("test.html")
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 "reorders footnote numbers in HTML" do
533
- FileUtils.rm_f "test.html"
534
- IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
535
- <iso-standard xmlns="http://riboseinc.com/isoxml">
536
- <sections>
537
- <clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><fn reference="3">
538
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">This is a footnote.</p>
539
- </fn><clause id="N" inline-header="false" obligation="normative">
540
-
541
- <title>Introduction to this<fn reference="2">
542
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
543
- </fn></title>
544
- </clause>
545
- <clause id="O" inline-header="false" obligation="normative">
546
- <title>Clause 4.2</title>
547
- <p>A<fn reference="1">
548
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
549
- </fn></p>
550
- </clause></clause>
551
- </sections>
552
- </iso-standard>
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("test.html").sub(/^.*<main class="main-section">/m, '<main xmlns:epub="epub" class="main-section">').
555
- sub(%r{</main>.*$}m, "</main>")
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
- <main xmlns:epub="epub" class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
558
- <p class="zzSTDTitle1"></p>
559
- <div id="A">
560
- <h1>1.&#xA0; Clause 4</h1>
561
- <a rel="footnote" href="#fn:3" epub:type="footnote" id="fnref:1">
562
- <sup>1</sup>
563
- </a>
564
- <div id="N">
565
-
566
- <h2>1.1.&#160; 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.&#160; 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.&#xA0; 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.&#160; Introduction to this<a class='FootnoteRef' href='#fn:2' id='fnref:2'><sup>2</sup></a></h2>
572
556
  </div>
573
- <aside id="fn:3" class="footnote">
574
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a rel="footnote" href="#fn:3" epub:type="footnote">
575
- <sup>1</sup>
576
- </a>This is a footnote.</p>
577
- <a href="#fnref:1">&#x21A9;</a></aside>
578
- <aside id="fn:2" class="footnote">
579
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2</sup></a>Formerly denoted as 15 % (m/m).</p>
580
- <a href="#fnref:2">&#x21A9;</a></aside>
581
-
557
+ <div id="O">
558
+ <h2>1.2.&#160; 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">&#x21A9;</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">&#x21A9;</a></aside>
582
570
  </main>
583
571
  OUTPUT
584
572
  end
585
573
 
586
- it "moves images in HTML" do
587
- FileUtils.rm_f "test.html"
588
- FileUtils.rm_rf "test_htmlimages"
589
- IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
590
- <iso-standard xmlns="http://riboseinc.com/isoxml">
591
- <preface><foreword>
592
- <figure id="_">
593
- <name>Split-it-right sample divider</name>
594
- <image src="#{File.expand_path(File.join(File.dirname(__FILE__), "..", "assets/rice_image1.png"))}" id="_" mimetype="image/png"/>
595
- <image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
596
- <image src="spec/assets/rice_image1.png" id="_" width="20000" height="300000" mimetype="image/png"/>
597
- <image src="spec/assets/rice_image1.png" id="_" width="99" height="auto" mimetype="image/png"/>
598
-
599
- </figure>
600
- </foreword></preface>
601
- </iso-standard>
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("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
604
- sub(%r{</main>.*$}m, "</main>")
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/, "/_.png"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
607
- <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
608
- <br />
609
- <div>
610
- <h1 class="ForewordTitle">Foreword</h1>
611
- <div id="_" class="figure">
612
- <img src="test_htmlimages/_.png" height="776" width="922" />
613
- <img src="test_htmlimages/_.png" height="776" width="922" />
614
- <img src="test_htmlimages/_.png" height="800" width="53" />
615
- <img src="test_htmlimages/_.png" height="83" width="99" />
616
-
617
- <p class="FigureTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; Split-it-right sample divider</p></div>
618
- </div>
619
- <p class="zzSTDTitle1"></p>
620
- </main>
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&#xA0;&#x2014; 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
- it "moves images in HTML with no file suffix" do
627
- FileUtils.rm_f "test.html"
628
- FileUtils.rm_rf "test_htmlimages"
629
- IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
630
- <iso-standard xmlns="http://riboseinc.com/isoxml">
631
- <preface><foreword>
632
- <figure id="_">
633
- <name>Split-it-right sample divider</name>
634
- <image src="spec/assets/rice_image1" id="_" mimetype="image/png"/>
635
-
636
-
637
- </figure>
638
- </foreword></preface>
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("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
642
- sub(%r{</main>.*$}m, "</main>")
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/, "/_.png"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
645
- <main class='main-section'>
646
- <button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
647
- <br/>
648
- <div>
649
- <h1 class='ForewordTitle'>Foreword</h1>
650
- <div id='_' class='figure'>
651
- <img src='test_htmlimages/_.png' height='776' width='922'/>
652
- <img src='test_htmlimages/_.png' height='776' width='922'/>
653
-
654
- <p class='FigureTitle' style='text-align:center;'>Figure 1&#xA0;&#x2014; Split-it-right sample divider</p>
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&#xA0;&#x2014; Split-it-right sample divider</p>
641
+ </div>
655
642
  </div>
656
- </div>
657
- <p class='zzSTDTitle1'/>
658
- </main>
643
+ <p class='zzSTDTitle1'/>
644
+ </main>
659
645
  OUTPUT
660
646
  end
661
647
 
662
- it "moves images in HTML, using relative file location" do
663
- FileUtils.rm_f "spec/test.html"
664
- FileUtils.rm_rf "spec/test_htmlimages"
665
- IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/test", <<~"INPUT", false)
666
- <iso-standard xmlns="http://riboseinc.com/isoxml">
667
- <preface><foreword>
668
- <figure id="_">
669
- <name>Split-it-right sample divider</name>
670
- <image src="#{File.expand_path(File.join(File.dirname(__FILE__), "..", "assets/rice_image1.png"))}" id="_" mimetype="image/png"/>
671
- <image src="assets/rice_image1.png" id="_" mimetype="image/png"/>
672
- <image src="assets/rice_image1.png" id="_" width="20000" height="300000" mimetype="image/png"/>
673
- <image src="assets/rice_image1.png" id="_" width="99" height="auto" mimetype="image/png"/>
674
- </figure>
675
- </foreword></preface>
676
- </iso-standard>
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("spec/test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
679
- sub(%r{</main>.*$}m, "</main>")
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/, "/_.png"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
682
- <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
683
- <br />
684
- <div>
685
- <h1 class="ForewordTitle">Foreword</h1>
686
- <div id="_" class="figure">
687
- <img src="test_htmlimages/_.png" height="776" width="922" />
688
- <img src="test_htmlimages/_.png" height="776" width="922" />
689
- <img src="test_htmlimages/_.png" height="800" width="53" />
690
- <img src="test_htmlimages/_.png" height="83" width="99" />
691
- <p class="FigureTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; Split-it-right sample divider</p></div>
692
- </div>
693
- <p class="zzSTDTitle1"></p>
694
- </main>
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&#xA0;&#x2014; 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
- it "encodes images in HTML as data URIs" do
700
- FileUtils.rm_f "test.html"
701
- FileUtils.rm_rf "test_htmlimages"
702
- IsoDoc::HtmlConvert.new({htmlstylesheet: "spec/assets/html.css", datauriimage: true}).convert("test", <<~"INPUT", false)
703
- <iso-standard xmlns="http://riboseinc.com/isoxml">
704
- <preface><foreword>
705
- <figure id="_">
706
- <name>Split-it-right sample divider</name>
707
- <image src="#{File.expand_path(File.join(File.dirname(__FILE__), "..", "assets/rice_image1.png"))}" id="_" mimetype="image/png"/>
708
- <image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
709
- </figure>
710
- </foreword></preface>
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("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
714
- sub(%r{</main>.*$}m, "</main>")
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
- <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
717
- <br />
718
- <div>
719
- <h1 class="ForewordTitle">Foreword</h1>
720
- <div id="_" class="figure">
721
- <img src="data:image/png;base64,_" height="776" width="922" />
722
- <img src="data:image/png;base64,_" height="776" width="922" />
723
- <p class="FigureTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; Split-it-right sample divider</p></div>
724
- </div>
725
- <p class="zzSTDTitle1"></p>
726
- </main>
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&#xA0;&#x2014; 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
- it "encodes images in HTML as data URIs, using relative file location" do
732
- FileUtils.rm_f "spec/test.html"
733
- FileUtils.rm_rf "spec/test_htmlimages"
734
- IsoDoc::HtmlConvert.new({htmlstylesheet: "spec/assets/html.css", datauriimage: true}).convert("spec/test", <<~"INPUT", false)
735
- <iso-standard xmlns="http://riboseinc.com/isoxml">
736
- <preface><foreword>
737
- <figure id="_">
738
- <name>Split-it-right sample divider</name>
739
- <image src="#{File.expand_path(File.join(File.dirname(__FILE__), "..", "assets/rice_image1.png"))}" id="_" mimetype="image/png"/>
740
- <image src="assets/rice_image1.png" id="_" mimetype="image/png"/>
741
- </figure>
742
- </foreword></preface>
743
- </iso-standard>
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("spec/test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
746
- sub(%r{</main>.*$}m, "</main>")
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
- <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
749
- <br />
750
- <div>
751
- <h1 class="ForewordTitle">Foreword</h1>
752
- <div id="_" class="figure">
753
- <img src="data:image/png;base64,_" height="776" width="922" />
754
- <img src="data:image/png;base64,_" height="776" width="922" />
755
- <p class="FigureTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; Split-it-right sample divider</p></div>
756
- </div>
757
- <p class="zzSTDTitle1"></p>
758
- </main>
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&#xA0;&#x2014; 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
- it "processes IsoXML terms for HTML" do
765
- FileUtils.rm_f "test.html"
766
- FileUtils.rm_f "test.doc"
767
- IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
768
- <iso-standard xmlns="http://riboseinc.com/isoxml">
769
- <sections>
770
- <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
771
-
772
- <term id="paddy1"><preferred>paddy</preferred>
773
- <domain>rice</domain>
774
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
775
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
776
- <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
777
- <ul>
778
- <li>A</li>
779
- </ul>
780
- </termexample>
781
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
782
- <ul>
783
- <li>A</li>
784
- </ul>
785
- </termexample>
786
-
787
- <termsource status="modified">
788
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
789
- <modification>
790
- <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>
791
- </modification>
792
- </termsource></term>
793
-
794
- <term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
795
- <admitted>rough rice</admitted>
796
- <deprecates>cargo rice</deprecates>
797
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
798
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
799
- <ul>
800
- <li>A</li>
801
- </ul>
802
- </termexample>
803
- <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
804
- <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>
805
- </termnote>
806
- <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
807
- <ul><li>A</li></ul>
808
- <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>
809
- </termnote>
810
- <termsource status="identical">
811
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
812
- </termsource></term>
813
- </terms>
814
- </sections>
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?("test.html")).to be true
818
- html = File.read("test.html")
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
- it "processes empty term modifications" do
824
- FileUtils.rm_f "test.html"
825
- FileUtils.rm_f "test.doc"
826
- IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
827
- <iso-standard xmlns="http://riboseinc.com/isoxml">
828
- <sections>
829
- <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
830
-
831
- <term id="paddy1"><preferred>paddy</preferred>
832
- <domain>rice</domain>
833
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
834
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
835
- <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
836
- <ul>
837
- <li>A</li>
838
- </ul>
839
- </termexample>
840
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
841
- <ul>
842
- <li>A</li>
843
- </ul>
844
- </termexample>
845
-
846
- <termsource status="modified">
847
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
848
- <modification>
849
- <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489"/>
850
- </modification>
851
- </termsource></term>
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?("test.html")).to be true
858
- html = File.read("test.html")
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
- it "creates continuation styles for multiparagraph list items in Word" do
864
- FileUtils.rm_f "test.doc"
865
- FileUtils.rm_f "test.html"
866
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
867
- <iso-standard xmlns="http://riboseinc.com/isoxml">
868
- <preface><foreword>
869
- <ul>
870
- <li><p>A</p>
871
- <p>B</p></li>
872
- <li><ol><li><p>C</p>
873
- <p>D</p>
874
- <sourcecode>E</sourcecode></li>
875
- </ol></li>
876
- </ul>
877
- <ol>
878
- <li><p>A1</p>
879
- <p>B1</p></li>
880
- <li><ul><li><p>C1</p>
881
- <formula id="_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62">
882
- <stem type="AsciiMath">D1</stem>
883
- </formula>
884
- </ul></li>
885
- </ol>
886
- </foreword></preface>
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("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">').
890
- sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
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
- <div class='WordSection2' xmlns:m='m'>
893
- <p class='MsoNormal'>
894
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
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
- <p class='MsoListParagraphCxSpLast'>
874
+ <div>
875
+ <h1 class='ForewordTitle'>Foreword</h1>
905
876
  <p class='MsoListParagraphCxSpFirst'>
906
- C
907
- <div class='ListContLevel2'>
908
- <p class='MsoNormal'>D</p>
877
+ A
878
+ <div class='ListContLevel1'>
879
+ <p class='MsoNormal'>B</p>
909
880
  </div>
910
- <div class='ListContLevel2'>
911
- <p class='Sourcecode'>E</p>
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
- </p>
915
- <p class='MsoListParagraphCxSpFirst'>
916
- A1
917
- <div class='ListContLevel1'>
918
- <p class='MsoNormal'>B1</p>
919
- </div>
920
- </p>
921
- <p class='MsoListParagraphCxSpLast'>
922
- C1
923
- <div class='ListContLevel2'>
924
- <div class='formula'>
925
- <a name='_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62' id='_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62'/>
926
- <p class='MsoNormal'>
927
- <span class='stem'>
928
- <m:oMath>
929
- <m:r>
930
- <m:t>D1</m:t>
931
- </m:r>
932
- </m:oMath>
933
- </span>
934
- <span style='mso-tab-count:1'>&#xA0; </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'>&#xA0; </span>
914
+ (1)
915
+ </p>
916
+ </div>
917
+ </div>
937
918
  </div>
938
- </div>
939
- </p>
919
+ </p>
920
+ </div>
921
+ <p class='MsoNormal'>&#xA0;</p>
940
922
  </div>
941
- <p class='MsoNormal'>&#xA0;</p>
942
- </div>
943
923
  OUTPUT
944
924
  end
945
925
 
946
- it "does not lose HTML escapes in postprocessing" do
947
- FileUtils.rm_f "test.doc"
948
- FileUtils.rm_f "test.html"
949
- IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
950
- <iso-standard xmlns="http://riboseinc.com/isoxml">
951
- <preface><foreword>
952
- <sourcecode id="samplecode">
953
- <name>XML code</name>
954
- &lt;xml&gt; &amp;
955
- </sourcecode>
956
- </foreword></preface>
957
- </iso-standard>
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
+ &lt;xml&gt; &amp;
935
+ </sourcecode>
936
+ </foreword></preface>
937
+ </iso-standard>
958
938
  INPUT
959
- html = File.read("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
960
- sub(%r{</main>.*$}m, "</main>")
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
- <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
963
- <br />
964
- <div>
965
- <h1 class="ForewordTitle">Foreword</h1>
966
- <pre id="samplecode" class="prettyprint "><br />&#xA0;&#xA0;&#xA0; <br />&#xA0; &lt;xml&gt; &amp;<br />
967
- </pre>
968
- <p class="SourceTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; XML code</p>
969
- </div>
970
- <p class="zzSTDTitle1"></p>
971
- </main>
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 />&#xA0;&#xA0;&#xA0; <br />&#xA0; &lt;xml&gt; &amp;<br />
947
+ </pre>
948
+ <p class="SourceTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; XML code</p>
949
+ </div>
950
+ <p class="zzSTDTitle1"></p>
951
+ </main>
972
952
  OUTPUT
973
953
  end
974
954
 
975
-
976
- it "does not lose HTML escapes in postprocessing (Word)" do
977
- FileUtils.rm_f "test.doc"
978
- FileUtils.rm_f "test.html"
979
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
980
- <iso-standard xmlns="http://riboseinc.com/isoxml">
981
- <preface><foreword>
982
- <sourcecode id="samplecode">
983
- <name>XML code</name>
984
- &lt;xml&gt; &amp;
985
- </sourcecode>
986
- </foreword></preface>
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
+ &lt;xml&gt; &amp;
964
+ </sourcecode>
965
+ </foreword></preface>
966
+ </iso-standard>
988
967
  INPUT
989
- word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
990
- sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
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
- <div class="WordSection2">
993
- <p class="MsoNormal">
994
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
995
- </p>
996
- <div>
997
- <h1 class="ForewordTitle">Foreword</h1>
998
- <p class="Sourcecode" style="page-break-after:avoid;"><a name="samplecode" id="samplecode"></a><br/>&#xA0;&#xA0;&#xA0; <br/>&#xA0; &lt;xml&gt; &amp;<br/></p><p class="SourceTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; XML code</p>
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/>&#xA0;&#xA0;&#xA0; <br/>&#xA0; &lt;xml&gt; &amp;<br/></p><p class="SourceTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; XML code</p>
978
+ </div>
979
+ <p class="MsoNormal">&#xA0;</p>
999
980
  </div>
1000
- <p class="MsoNormal">&#xA0;</p>
1001
- </div>
1002
981
 
1003
982
  OUTPUT
1004
983
  end
1005
984
 
1006
- it "propagates example style to paragraphs in postprocessing (Word)" do
1007
- FileUtils.rm_f "test.doc"
1008
- FileUtils.rm_f "test.html"
1009
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
1010
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1011
- <preface><foreword>
1012
- <example id="samplecode">
1013
- <p>ABC</p>
1014
- </example>
1015
- </foreword></preface>
1016
- </iso-standard>
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
- word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
1019
- sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
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
- <p class="MsoNormal">
1023
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
1024
- </p>
1025
- <div>
1026
- <h1 class="ForewordTitle">Foreword</h1>
1027
- <div class="example"><a name="samplecode" id="samplecode"></a><p class="example-title">EXAMPLE</p>
1028
- <p class="example">ABC</p>
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
- <p class="MsoNormal">&#xA0;</p>
1032
- </div>
1009
+ </div>
1010
+ <p class="MsoNormal">&#xA0;</p>
1011
+ </div>
1033
1012
  OUTPUT
1034
1013
  end
1035
1014
 
1036
- it "deals with image captions (Word)" do
1037
- FileUtils.rm_f "test.doc"
1038
- FileUtils.rm_f "test.html"
1039
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
1040
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1041
- <preface><foreword>
1042
- <figure id="fig1">
1043
- <name>Typical arrangement of the far-field scan set-up</name>
1044
- <image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
1045
- </figure>
1046
- </foreword></preface>
1047
- </iso-standard>
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("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
1050
- sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "").
1051
- sub(/src="[^"]+"/, 'src="_"')
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
- <div class="WordSection2">
1054
- <p class="MsoNormal">
1055
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
1056
- </p>
1057
- <div>
1058
- <h1 class="ForewordTitle">Foreword</h1>
1059
- <div class="figure"><a name="fig1" id="fig1"></a>
1060
-
1061
- <p style="page-break-after:avoid;" class="figure"><img src="_" width="400" height="337"/></p>
1062
- <p class="FigureTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; Typical arrangement of the far-field scan set-up</p></div>
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&#xA0;&#x2014; Typical arrangement of the far-field scan set-up</p></div>
1041
+ </div>
1042
+ <p class="MsoNormal">&#xA0;</p>
1063
1043
  </div>
1064
- <p class="MsoNormal">&#xA0;</p>
1065
- </div>
1066
1044
  OUTPUT
1067
-
1068
1045
  end
1069
1046
 
1070
- it "deals with empty table titles (Word)" do
1071
- FileUtils.rm_f "test.doc"
1072
- FileUtils.rm_f "test.html"
1073
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
1074
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1075
- <preface><foreword>
1076
- <table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
1077
- <td rowspan="2">
1078
- <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>
1079
- </td>
1080
- <th colspan="3" align="left">Predictive wavelengths</th>
1081
- </tr>
1082
- </thead>
1083
- </table>
1084
- </preface>
1085
- </iso-standard>
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("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">').
1088
- sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "").
1089
- sub(/src="[^"]+"/, 'src="_"')
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
- <div class="WordSection2" xmlns:m="m">
1092
- <p class="MsoNormal">
1093
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
1094
- </p>
1095
- <div>
1096
- <h1 class="ForewordTitle">Foreword</h1>
1097
- <div align="center" class="table_container">
1098
- <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>
1099
- <thead>
1100
- <tr>
1101
- <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;">
1102
- <p class="MsoNormal"><a name="_c47d9b39-adb2-431d-9320-78cb148fdb56" id="_c47d9b39-adb2-431d-9320-78cb148fdb56"></a>Output wavelength <span class="stem"><m:oMath>
1103
-
1104
- <m:r><m:t>(&#x3BC;m)</m:t></m:r>
1105
-
1106
-
1107
-
1108
-
1109
- </m:oMath>
1110
- </span></p>
1111
- </td>
1112
- <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>
1113
- </tr>
1114
- </thead>
1115
- </table>
1116
- </div>
1117
- </div>
1118
- <p class="MsoNormal">&#xA0;</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>(&#x3BC;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">&#xA0;</p>
1091
+ </div>
1120
1092
  OUTPUT
1121
1093
  end
1122
1094
 
1123
- it "propagates alignment of table cells (Word)" do
1124
- FileUtils.rm_f "test.doc"
1125
- FileUtils.rm_f "test.html"
1126
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
1127
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1128
- <preface><foreword>
1129
- <table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
1130
- <td rowspan="2" align="left">
1131
- <p id="_c47d9b39-adb2-431d-9320-78cb148fdb56">Output wavelength</p>
1132
- <p id="_c47d9b39-adb2-431d-9320-78cb148fdb57">Output wavelength</p>
1133
- </td>
1134
- <th colspan="3" align="right"><p id="_c47d9b39-adb2-431d-9320-78cb148fdb58">Predictive wavelengths</p></th>
1135
- </tr>
1136
- </thead>
1137
- </table>
1138
- </preface>
1139
- </iso-standard>
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("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">').
1142
- sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "").
1143
- sub(/src="[^"]+"/, 'src="_"')
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
- <div class='WordSection2' xmlns:m='m'>
1146
- <p class='MsoNormal'>
1147
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1148
- </p>
1149
- <div>
1150
- <h1 class='ForewordTitle'>Foreword</h1>
1151
- <div align='center' class="table_container">
1152
- <table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
1153
- <a name='_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7' id='_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7'/>
1154
- <thead>
1155
- <tr>
1156
- <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;'>
1157
- <p style='text-align: left' class='MsoNormal'>
1158
- <a name='_c47d9b39-adb2-431d-9320-78cb148fdb56' id='_c47d9b39-adb2-431d-9320-78cb148fdb56'/>
1159
- Output wavelength
1160
- </p>
1161
- <p style='text-align: left' class='MsoNormal'>
1162
- <a name='_c47d9b39-adb2-431d-9320-78cb148fdb57' id='_c47d9b39-adb2-431d-9320-78cb148fdb57'/>
1163
- Output wavelength
1164
- </p>
1165
- </td>
1166
- <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;'>
1167
- <p style='text-align: right' class='MsoNormal'>
1168
- <a name='_c47d9b39-adb2-431d-9320-78cb148fdb58' id='_c47d9b39-adb2-431d-9320-78cb148fdb58'/>
1169
- Predictive wavelengths
1170
- </p>
1171
- </th>
1172
- </tr>
1173
- </thead>
1174
- </table>
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'>&#xA0;</p>
1176
1150
  </div>
1177
- <p class='MsoNormal'>&#xA0;</p>
1178
- </div>
1179
1151
  OUTPUT
1180
- end
1181
-
1182
- it "cleans up boilerplate" do
1183
- expect(xmlpp(IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).html_preface(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>")).to be_equivalent_to xmlpp(<<~"OUTPUT")
1184
- <html>
1185
- <head/>
1186
- <body>
1187
- <div class="main-section">
1188
- <div id="boilerplate-copyright"> <h1>Copyright</h1> </div>
1189
- <div id="boilerplate-license"> <h1>License</h1> </div>
1190
- <div id="boilerplate-legal"> <h1>Legal</h1> </div>
1191
- <div id="boilerplate-feedback"> <h1>Feedback</h1> </div>
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='boilerplate-feedback'>
1205
- <h1 class='IntroTitle'>Feedback</h1>
1206
- </div>
1207
- <div id='boilerplate-legal'>
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
- <div id='boilerplate-copyright'>
1214
- <h1 class='IntroTitle'>Copyright</h1>
1215
- </div>
1216
- </main>
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
- it "cleans up boilerplate (Word)" do
1221
- expect(xmlpp(IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).word_cleanup(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>")).to be_equivalent_to xmlpp(<<~"OUTPUT")
1222
- <html>
1223
- <head/>
1224
- <body>
1225
- <div class="main-section">
1226
- <div id="boilerplate-copyright"> <h1>Copyright</h1> </div>
1227
- <div id="boilerplate-license"> <h1>License</h1> </div>
1228
- <div id="boilerplate-legal"> <h1>Legal</h1> </div>
1229
- <div id="boilerplate-feedback"> <h1>Feedback</h1> </div>
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='boilerplate-feedback'>
1245
- <p class='TitlePageSubhead'>Feedback</p>
1246
- </div>
1247
- <div id='boilerplate-legal'>
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
- <div id='boilerplate-copyright'>
1254
- <p class='TitlePageSubhead'>Copyright</p>
1255
- </div>
1256
- </div>
1257
- </body>
1258
- </html>
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
- it "deals with landscape and portrait pagebreaks (Word)" do
1263
- FileUtils.rm_f "test.doc"
1264
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).convert("test", <<~"INPUT", false)
1265
- <standard-document xmlns="http://riboseinc.com/isoxml">
1266
- <bibdata type="standard">
1267
- <title language="en" format="text/plain">Document title</title>
1268
- <version>
1269
- <draft>1.2</draft>
1270
- </version>
1271
- <language>en</language>
1272
- <script>Latn</script>
1273
- <status><stage>published</stage></status>
1274
- <ext>
1275
- <doctype>article</doctype>
1276
- </ext>
1277
- </bibdata>
1278
- <preface>
1279
- <introduction><title>Preface 1</title>
1280
- <p align="center">This is a <pagebreak orientation="landscape"/> paragraph</p>
1281
- <table>
1282
- <tbody>
1283
- <tr><td>A</td><td>B</td></tr>
1284
- </tbody>
1285
- </table>
1286
- <clause><title>Preface 1.1</title>
1287
- <p>On my side</p>
1288
- <pagebreak orientation="portrait"/>
1289
- <p>Upright again</p>
1290
- </clause>
1291
- <clause><title>Preface 1.3</title>
1292
- <p>And still upright</p>
1293
- </clause>
1294
- </introduction>
1295
- </preface>
1296
- <sections><clause><title>Foreword</title>
1297
- <note>
1298
- <p id="_">For further information on the Foreword, see <strong>ISO/IEC Directives, Part 2, 2016, Clause 12.</strong></p>
1299
- <pagebreak orientation="landscape"/>
1300
- <table id="_c09a7e60-b0c7-4418-9bfc-2ef0bc09a249">
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
- <pagebreak orientation="portrait"/>
1317
- <p>And up</p>
1318
- </note>
1319
- <pagebreak orientation="portrait"/>
1320
- </clause></sections>
1321
- <annex id="_level_1" inline-header="false" obligation="normative">
1322
- <title>Annex 1</title>
1323
- </annex>
1324
- </standard-document>
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
- expect(File.exist?("test.doc")).to be true
1327
- html = File.read("test.doc", encoding: "UTF-8")
1328
- expect(html).to include "div.WordSection2_0 {page:WordSection2P;}"
1329
- expect(html).to include "div.WordSection2_1 {page:WordSection2L;}"
1330
- expect(html).to include "div.WordSection3_0 {page:WordSection3P;}"
1331
- expect(html).to include "div.WordSection3_1 {page:WordSection3P;}"
1332
- expect(html).to include "div.WordSection3_2 {page:WordSection3L;}"
1333
-
1334
-
1335
- expect(xmlpp(html.sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1336
- <body lang='EN-US' xml:lang='EN-US' link='blue' vlink='#954F72'>
1337
- <div class='WordSection1'>
1338
- <p class='MsoNormal'>&#xA0;</p>
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'>&#xA0;</p>
1310
+ </div>
1351
1311
  <p class='MsoNormal'>
1352
1312
  <br clear='all' class='section'/>
1353
1313
  </p>
1354
- paragraph
1355
- </p>
1356
- </div>
1357
- </div>
1358
- <div class='WordSection2_1'>
1359
- <div align='center' class='table_container'>
1360
- <table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
1361
- <tbody>
1362
- <tr>
1363
- <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>
1364
- <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>
1365
- </tr>
1366
- </tbody>
1367
- </table>
1368
- </div>
1369
- <div>
1370
- <h1>Preface 1.1</h1>
1371
- <p class='MsoNormal'>On my side</p>
1372
- <p class='MsoNormal'>
1373
- <br clear='all' class='section'/>
1374
- </p>
1375
- </div>
1376
- </div>
1377
- <div class='WordSection2_0'>
1378
- <p class='MsoNormal'>Upright again</p>
1379
- <div>
1380
- <h1>Preface 1.3</h1>
1381
- <p class='MsoNormal'>And still upright</p>
1382
- </div>
1383
- <p class='MsoNormal'>&#xA0;</p>
1384
- </div>
1385
- <p class='MsoNormal'>
1386
- <br clear='all' class='section'/>
1387
- </p>
1388
- <div class='WordSection3'>
1389
- <p class='zzSTDTitle1'>Document title</p>
1390
- <div>
1391
- <h1>Foreword</h1>
1392
- <div id='' class='Note'>
1393
- <p class='Note'>
1394
- <span class='note_label'>NOTE 1</span>
1395
- <span style='mso-tab-count:1'>&#xA0; </span>
1396
- For further information on the Foreword, see
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'>&#xA0;</p>
1355
+ </div>
1356
+ <p class='MsoNormal'>
1400
1357
  <br clear='all' class='section'/>
1401
1358
  </p>
1402
- </div>
1403
- </div>
1404
- </div>
1405
- <div class='WordSection3_2'>
1406
- <p class='TableTitle' style='text-align:center;'>Table 1</p>
1407
- <div align='center' class='table_container'>
1408
- <table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
1409
- <a name='_c09a7e60-b0c7-4418-9bfc-2ef0bc09a249' id='_c09a7e60-b0c7-4418-9bfc-2ef0bc09a249'/>
1410
- <thead>
1411
- <tr>
1412
- <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>
1413
- <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>
1414
- </tr>
1415
- </thead>
1416
- <tbody>
1417
- <tr>
1418
- <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>
1419
- <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>
1420
- </tr>
1421
- </tbody>
1422
- <tfoot>
1423
- <tr>
1424
- <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;'>
1425
- <div class='Note'>
1426
- <a name='_8fff1596-290e-4314-b03c-7a8aab97eebe' id='_8fff1596-290e-4314-b03c-7a8aab97eebe'/>
1427
- <p class='Note'>
1428
- <span class='note_label'>NOTE</span>
1429
- <span style='mso-tab-count:1'>&#xA0; </span>
1430
- B
1431
- </p>
1432
- </div>
1433
- </td>
1434
- </tr>
1435
- </tfoot>
1436
- </table>
1437
- </div>
1438
- <p class='Note'>
1439
- <br clear='all' class='section'/>
1440
- </p>
1441
- </div>
1442
- <div class='WordSection3_1'>
1443
- <p class='Note'>And up</p>
1444
- <p class='MsoNormal'>
1445
- <br clear='all' class='section'/>
1446
- </p>
1447
- </div>
1448
- <div class='WordSection3_0'>
1449
- <div class='Section3'>
1450
- <a name='_level_1' id='_level_1'/>
1451
- <h1 class='Annex'>
1452
- <b>Annex A</b>
1453
- <br/>
1454
- (normative)
1455
- <br/>
1456
- <br/>
1457
- <b>Annex 1</b>
1458
- </h1>
1459
- </div>
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'>&#xA0; </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'>&#xA0; </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
- <div style='mso-element:footnote-list'/>
1462
- </body>
1431
+ </div>
1432
+ <div style='mso-element:footnote-list'/>
1433
+ </body>
1463
1434
  OUTPUT
1464
- end
1465
-
1466
- it "expands out nested tables in Word" do
1467
- expect(xmlpp(IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).word_cleanup(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>")).to be_equivalent_to xmlpp(<<~"OUTPUT")
1468
- <html>
1469
- <head/>
1470
- <body>
1471
- <div class="main-section">
1472
- <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>
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
- <div id="_second_sample"><h2>1.2.<span style="mso-tab-count:1">&#xA0; </span>Second sample</h2>
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
- </div>
1488
- </body>
1489
- </html>
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">&#xA0; </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
- <html>
1492
- <head/>
1493
- <body>
1494
- <div class='main-section'>
1495
- <table id='_7830dff8-419e-4b9e-85cf-a063689f44ca' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
1496
- <thead>
1497
- <tr style='background:#A5A5A5;'>
1498
- <th style='vertical-align:top;' class='recommend' colspan='2'>
1499
- <p class='RecommendationTitle'>Requirement 1:</p>
1500
- </th>
1501
- </tr>
1502
- </thead>
1503
- <tbody>
1504
- <tr>
1505
- <td style='vertical-align:top;' class='recommend' colspan='2'>
1506
- <p>requirement label</p>
1507
- </td>
1508
- </tr>
1509
- </tbody>
1510
- </table>
1511
- <table id='_a0f8c202-fd34-460c-bd5e-b2f4cc29210d' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
1512
- <thead>
1513
- <tr style='background:#A5A5A5;'>
1514
- <th style='vertical-align:top;' class='recommend' colspan='2'>
1515
- <p class='RecommendationTitle'>Requirement 1-1:</p>
1516
- </th>
1517
- </tr>
1518
- </thead>
1519
- <tbody>
1520
- <tr style='background:#C9C9C9;'>
1521
- <td style='vertical-align:top;' class='recommend' colspan='2'>
1522
- <p id='_2e2c247b-ce4c-48c5-96dd-f3e090a5b4a7'>Description text</p>
1523
- </td>
1524
- </tr>
1525
- </tbody>
1526
- </table>
1527
- </div>
1528
- <div id='_second_sample'>
1529
- <h2>
1530
- 1.2.
1531
- <span style='mso-tab-count:1'>&#xA0; </span>
1532
- Second sample
1533
- </h2>
1534
- <table id='_9846c486-14e5-4b1c-bb2f-55cc254dd309' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
1535
- <thead>
1536
- <tr style='background:#A5A5A5;'>
1537
- <th style='vertical-align:top;' class='recommend' colspan='2'>
1538
- <p class='RecommendationTitle'>Requirement 2:</p>
1539
- </th>
1540
- </tr>
1541
- </thead>
1542
- <tbody>
1543
- <tr>
1544
- <td style='vertical-align:top;' class='recommend' colspan='2'>
1545
- <p>requirement label</p>
1546
- </td>
1547
- </tr>
1548
- </tbody>
1549
- </table>
1550
- <table id='_62de974c-7128-44d6-ba86-99f818f1d467' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
1551
- <thead>
1552
- <tr style='background:#A5A5A5;'>
1553
- <th style='vertical-align:top;' class='recommend' colspan='2'>
1554
- <p class='RecommendationTitle'>Requirement 2-1:</p>
1555
- </th>
1556
- </tr>
1557
- </thead>
1558
- <tbody>
1559
- <tr style='background:#C9C9C9;'>
1560
- <td style='vertical-align:top;' class='recommend' colspan='2'>
1561
- <p id='_30b90b08-bd71-4497-bbcc-8c61fbb9f772'>Description text</p>
1562
- </td>
1563
- </tr>
1564
- </tbody>
1565
- </table>
1566
- <table id='_fede5681-71f6-47bb-bc65-7bd0b11acd01' class='recommend' style='border-collapse:collapse;border-spacing:0;'>
1567
- <thead>
1568
- <tr style='background:#A5A5A5;'>
1569
- <th style='vertical-align:top;' class='recommend' colspan='2'>
1570
- <p class='RecommendationTitle'>Requirement 2-2:</p>
1571
- </th>
1572
- </tr>
1573
- </thead>
1574
- <tbody>
1575
- <tr>
1576
- <td style='vertical-align:top;' class='recommend' colspan='2'>
1577
- <p id='_8daa3d74-90fd-4a57-9169-de457a68cfda'>Description text</p>
1578
- </td>
1579
- </tr>
1580
- </tbody>
1581
- </table>
1582
- </div>
1583
- </body>
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'>&#xA0; </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
- end
1587
-
1557
+ end
1588
1558
  end