metanorma-iso 1.7.1 → 1.7.2

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