isodoc 1.0.29 → 1.1.3.pre.alpha2

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