metanorma-iec 1.3.5 → 1.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/lib/asciidoctor/iec/front.rb +64 -46
- data/lib/asciidoctor/iec/isodoc.rng +62 -8
- data/lib/asciidoctor/iec/isostandard.rng +7 -3
- data/lib/asciidoctor/iec/reqt.rng +15 -4
- data/lib/isodoc/iec/iec.international-standard.xsl +558 -82
- data/lib/metanorma/iec/processor.rb +1 -1
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +1 -1
- data/spec/asciidoctor/blocks_spec.rb +3 -3
- data/spec/isodoc/postproc_spec.rb +221 -192
- data/spec/spec_helper.rb +2 -0
- metadata +4 -4
data/metanorma-iec.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
28
28
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
29
29
|
|
30
|
-
spec.add_dependency "metanorma-iso", "~> 1.
|
30
|
+
spec.add_dependency "metanorma-iso", "~> 1.9.0"
|
31
31
|
spec.add_dependency "ruby-jing"
|
32
32
|
|
33
33
|
spec.add_development_dependency "byebug"
|
@@ -32,8 +32,8 @@ RSpec.describe Asciidoctor::Iec do
|
|
32
32
|
#{ASCIIDOC_BLANK_HDR}
|
33
33
|
[stem]
|
34
34
|
++++
|
35
|
-
r = 1
|
36
|
-
r = 1
|
35
|
+
r = 1 %
|
36
|
+
r = 1 %
|
37
37
|
++++
|
38
38
|
|
39
39
|
[stem]
|
@@ -45,7 +45,7 @@ RSpec.describe Asciidoctor::Iec do
|
|
45
45
|
#{@blank_hdr}
|
46
46
|
<sections>
|
47
47
|
<formula id="_">
|
48
|
-
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><
|
48
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo></math></stem>
|
49
49
|
</formula>
|
50
50
|
|
51
51
|
<formula id="_">
|
@@ -5,25 +5,29 @@ RSpec.describe IsoDoc do
|
|
5
5
|
it "generates file based on string input" do
|
6
6
|
FileUtils.rm_f "test.doc"
|
7
7
|
FileUtils.rm_f "test.html"
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
</note>
|
21
|
-
|
22
|
-
|
8
|
+
input = <<~INPUT
|
9
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
10
|
+
<bibdata>
|
11
|
+
<title>
|
12
|
+
<title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
|
13
|
+
<title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
|
14
|
+
<title type="title-part" language="en" format="text/plain">Rice</title>
|
15
|
+
</title>
|
16
|
+
</bibdata>
|
17
|
+
<preface><foreword>
|
18
|
+
<note>
|
19
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
20
|
+
</note>
|
21
|
+
</foreword></preface>
|
22
|
+
</iso-standard>
|
23
23
|
INPUT
|
24
|
+
IsoDoc::Iec::HtmlConvert
|
25
|
+
.new({ wordstylesheet: "spec/assets/word.css",
|
26
|
+
htmlstylesheet: "spec/assets/html.css", filename: "test" })
|
27
|
+
.convert("test", input, false)
|
24
28
|
expect(File.exist?("test.html")).to be true
|
25
29
|
html = File.read("test.html", encoding: "UTF-8")
|
26
|
-
expect(html).to match(%r{<title>Cereals and pulses
|
30
|
+
expect(html).to match(%r{<title>Cereals and pulses — Specifications and test methods — Rice</title>})
|
27
31
|
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
|
28
32
|
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
|
29
33
|
end
|
@@ -31,25 +35,29 @@ RSpec.describe IsoDoc do
|
|
31
35
|
it "generates HTML output docs with null configuration" do
|
32
36
|
FileUtils.rm_f "test.doc"
|
33
37
|
FileUtils.rm_f "test.html"
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
</note>
|
47
|
-
|
48
|
-
|
38
|
+
input = <<~INPUT
|
39
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
40
|
+
<bibdata>
|
41
|
+
<title>
|
42
|
+
<title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
|
43
|
+
<title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
|
44
|
+
<title type="title-part" language="en" format="text/plain">Rice</title>
|
45
|
+
</title>
|
46
|
+
</bibdata>
|
47
|
+
<preface><foreword>
|
48
|
+
<note>
|
49
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
50
|
+
</note>
|
51
|
+
</foreword></preface>
|
52
|
+
</iso-standard>
|
49
53
|
INPUT
|
54
|
+
IsoDoc::Iec::HtmlConvert
|
55
|
+
.new({ wordstylesheet: "spec/assets/word.css",
|
56
|
+
htmlstylesheet: "spec/assets/html.css" })
|
57
|
+
.convert("test", input, false)
|
50
58
|
expect(File.exist?("test.html")).to be true
|
51
59
|
html = File.read("test.html", encoding: "UTF-8")
|
52
|
-
expect(html).to match(%r{<title>Cereals and pulses
|
60
|
+
expect(html).to match(%r{<title>Cereals and pulses — Specifications and test methods — Rice</title>})
|
53
61
|
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
|
54
62
|
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
|
55
63
|
end
|
@@ -57,15 +65,19 @@ RSpec.describe IsoDoc do
|
|
57
65
|
it "generates Word output docs with null configuration" do
|
58
66
|
FileUtils.rm_f "test.doc"
|
59
67
|
FileUtils.rm_f "test.html"
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
</note>
|
66
|
-
|
67
|
-
|
68
|
+
input = <<~INPUT
|
69
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
70
|
+
<preface><foreword>
|
71
|
+
<note>
|
72
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
73
|
+
</note>
|
74
|
+
</foreword></preface>
|
75
|
+
</iso-standard>
|
68
76
|
INPUT
|
77
|
+
IsoDoc::Iec::WordConvert
|
78
|
+
.new({ wordstylesheet: "spec/assets/word.css",
|
79
|
+
htmlstylesheet: "spec/assets/html.css" })
|
80
|
+
.convert("test", input, false)
|
69
81
|
expect(File.exist?("test.doc")).to be true
|
70
82
|
word = File.read("test.doc", encoding: "UTF-8")
|
71
83
|
expect(word).to match(/<style>/)
|
@@ -74,7 +86,9 @@ RSpec.describe IsoDoc do
|
|
74
86
|
it "generates HTML output docs with null configuration from file" do
|
75
87
|
FileUtils.rm_f "spec/assets/iso.doc"
|
76
88
|
FileUtils.rm_f "spec/assets/iso.html"
|
77
|
-
IsoDoc::Iec::HtmlConvert
|
89
|
+
IsoDoc::Iec::HtmlConvert
|
90
|
+
.new({ wordstylesheet: "word.css", htmlstylesheet: "html.css" })
|
91
|
+
.convert("spec/assets/iso.xml", nil, false)
|
78
92
|
expect(File.exist?("spec/assets/iso.html")).to be true
|
79
93
|
html = File.read("spec/assets/iso.html", encoding: "UTF-8")
|
80
94
|
expect(html).to match(/<style>/)
|
@@ -84,198 +98,213 @@ RSpec.describe IsoDoc do
|
|
84
98
|
|
85
99
|
it "generates Word output docs with null configuration from file" do
|
86
100
|
FileUtils.rm_f "spec/assets/iso.doc"
|
87
|
-
IsoDoc::Iec::WordConvert
|
101
|
+
IsoDoc::Iec::WordConvert
|
102
|
+
.new({ wordstylesheet: "word.css", htmlstylesheet: "html.css" })
|
103
|
+
.convert("spec/assets/iso.xml", nil, false)
|
88
104
|
expect(File.exist?("spec/assets/iso.doc")).to be true
|
89
105
|
word = File.read("spec/assets/iso.doc", encoding: "UTF-8")
|
90
106
|
expect(word).to match(/<w:WordDocument>/)
|
91
107
|
expect(word).to match(/<style>/)
|
92
108
|
end
|
93
109
|
|
94
|
-
|
110
|
+
it "generates Pdf output docs with null configuration from file" do
|
95
111
|
FileUtils.rm_f "spec/assets/iso.pdf"
|
96
|
-
IsoDoc::Iec::PdfConvert
|
112
|
+
IsoDoc::Iec::PdfConvert
|
113
|
+
.new({ wordstylesheet: "spec/assets/word.css",
|
114
|
+
htmlstylesheet: "spec/assets/html.css" })
|
115
|
+
.convert("spec/assets/iso.xml", nil, false)
|
97
116
|
expect(File.exist?("spec/assets/iso.pdf")).to be true
|
98
117
|
end
|
99
118
|
|
100
119
|
it "populates Word template with terms reference labels" do
|
101
120
|
FileUtils.rm_f "test.doc"
|
102
121
|
FileUtils.rm_f "test.html"
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
<
|
109
|
-
<
|
110
|
-
<
|
111
|
-
<
|
112
|
-
<
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
</
|
118
|
-
|
119
|
-
</
|
120
|
-
</sections>
|
121
|
-
</iso-standard>
|
122
|
-
|
122
|
+
input = <<~INPUT
|
123
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
124
|
+
<sections>
|
125
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>1<tab/>Terms and Definitions</title>
|
126
|
+
<term id="paddy1">
|
127
|
+
<name>1.1</name>
|
128
|
+
<preferred>paddy</preferred>
|
129
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
130
|
+
<termsource status="modified">
|
131
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
132
|
+
<modification>
|
133
|
+
<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>
|
134
|
+
</modification>
|
135
|
+
</termsource></term>
|
136
|
+
</terms>
|
137
|
+
</sections>
|
138
|
+
</iso-standard>
|
123
139
|
INPUT
|
124
|
-
|
125
|
-
|
140
|
+
IsoDoc::Iec::WordConvert
|
141
|
+
.new({ wordstylesheet: "spec/assets/word.css",
|
142
|
+
htmlstylesheet: "spec/assets/html.css" })
|
143
|
+
.convert("test", input, false)
|
144
|
+
word = File.read("test.doc", encoding: "UTF-8")
|
145
|
+
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
146
|
+
.sub(%r{<br.*$}m, "")
|
126
147
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
148
|
+
<div class="WordSection3">
|
149
|
+
#{IEC_TITLE1.gsub(/ /, ' ')}
|
150
|
+
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1 class="main">1<span style="mso-tab-count:1">  </span>Terms and Definitions</h1>
|
151
|
+
<p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1</p><p class="Terms" style="text-align:left;">paddy</p>
|
152
|
+
<p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
|
153
|
+
<p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301:2011, 3.1</a>, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
|
154
|
+
</div>
|
134
155
|
OUTPUT
|
135
156
|
end
|
136
157
|
|
137
158
|
it "processes IsoXML terms for HTML" do
|
138
159
|
FileUtils.rm_f "test.html"
|
139
160
|
FileUtils.rm_f "test.doc"
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
<
|
146
|
-
<
|
147
|
-
<
|
148
|
-
<
|
149
|
-
<
|
150
|
-
<
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
<
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
<
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
</
|
168
|
-
|
169
|
-
<
|
170
|
-
<
|
171
|
-
<
|
172
|
-
<
|
173
|
-
<
|
174
|
-
<
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
</
|
180
|
-
<termnote id="_671a1994-4783-40d0-bc81-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
<
|
185
|
-
|
186
|
-
</
|
187
|
-
|
188
|
-
|
189
|
-
</
|
190
|
-
</terms>
|
191
|
-
</sections>
|
192
|
-
</iso-standard>
|
161
|
+
input = <<~INPUT
|
162
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
163
|
+
<sections>
|
164
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>1<tab/>Terms and Definitions</title>
|
165
|
+
<term id="paddy1">
|
166
|
+
<name>1.1</name>
|
167
|
+
<preferred>paddy</preferred>
|
168
|
+
<domain>rice</domain>
|
169
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
170
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
171
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
172
|
+
<ul>
|
173
|
+
<li>A</li>
|
174
|
+
</ul>
|
175
|
+
</termexample>
|
176
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
177
|
+
<ul>
|
178
|
+
<li>A</li>
|
179
|
+
</ul>
|
180
|
+
</termexample>
|
181
|
+
<termsource status="modified">
|
182
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
183
|
+
<modification>
|
184
|
+
<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>
|
185
|
+
</modification>
|
186
|
+
</termsource></term>
|
187
|
+
<term id="paddy">
|
188
|
+
<name>1.2</name>
|
189
|
+
<preferred>paddy</preferred><admitted>paddy rice</admitted>
|
190
|
+
<admitted>rough rice</admitted>
|
191
|
+
<deprecates>cargo rice</deprecates>
|
192
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
193
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
194
|
+
<ul>
|
195
|
+
<li>A</li>
|
196
|
+
</ul>
|
197
|
+
</termexample>
|
198
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
199
|
+
<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>
|
200
|
+
</termnote>
|
201
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
202
|
+
<ul><li>A</li></ul>
|
203
|
+
<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>
|
204
|
+
</termnote>
|
205
|
+
<termsource status="identical">
|
206
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
207
|
+
</termsource></term>
|
208
|
+
</terms>
|
209
|
+
</sections>
|
210
|
+
</iso-standard>
|
193
211
|
INPUT
|
212
|
+
IsoDoc::Iec::HtmlConvert
|
213
|
+
.new({ wordstylesheet: "spec/assets/word.css",
|
214
|
+
htmlstylesheet: "spec/assets/html.css" })
|
215
|
+
.convert("test", input, false)
|
194
216
|
expect(File.exist?("test.html")).to be true
|
195
217
|
html = File.read("test.html", encoding: "UTF-8")
|
196
218
|
expect(html).to match(%r{<h2 class="TermNum" id="paddy1">1\.1</h2>})
|
197
219
|
expect(html).to match(%r{<h2 class="TermNum" id="paddy">1\.2</h2>})
|
198
220
|
end
|
199
221
|
|
200
|
-
|
222
|
+
it "inserts default paragraph between two tables for Word" do
|
201
223
|
FileUtils.rm_f "test.doc"
|
202
224
|
FileUtils.rm_f "test.html"
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
</example>
|
209
|
-
<example id="_63112cbc-cde0-435f-9553-e0b8c4f5851d">
|
210
|
-
|
211
|
-
</example>
|
212
|
-
|
213
|
-
|
225
|
+
input = <<~INPUT
|
226
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
227
|
+
<annex id="P" inline-header="false" obligation="normative">
|
228
|
+
<example id="_63112cbc-cde0-435f-9553-e0b8c4f5851c">
|
229
|
+
<p id="_158d4efa-b1c9-4aec-b325-756de8e4c968">'1M', '01M', and '0001M' all describe the calendar month January.</p>
|
230
|
+
</example>
|
231
|
+
<example id="_63112cbc-cde0-435f-9553-e0b8c4f5851d">
|
232
|
+
<p id="_158d4efa-b1c9-4aec-b325-756de8e4c969">'2M', '02M', and '0002M' all describe the calendar month February.</p>
|
233
|
+
</example>
|
234
|
+
</annex>
|
235
|
+
</iso-standard>
|
214
236
|
INPUT
|
215
|
-
|
216
|
-
|
237
|
+
IsoDoc::Iec::WordConvert
|
238
|
+
.new({ wordstylesheet: "spec/assets/word.css",
|
239
|
+
htmlstylesheet: "spec/assets/html.css" })
|
240
|
+
.convert("test", input, false)
|
241
|
+
word = File.read("test.doc", encoding: "UTF-8")
|
242
|
+
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
243
|
+
.sub(%r{<br[^>]*>\s*<div class="colophon">.*$}m, "")
|
217
244
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
245
|
+
<div class="WordSection3">
|
246
|
+
#{IEC_TITLE1.gsub(/ /, ' ')}
|
247
|
+
<p class="MsoNormal">
|
248
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
249
|
+
</p>
|
250
|
+
<div class="Section3"><a name="P" id="P"></a>
|
251
|
+
<div class="example"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851c" id="_63112cbc-cde0-435f-9553-e0b8c4f5851c"></a>
|
252
|
+
<p class="example"><span style="mso-tab-count:1">  </span>'1M', '01M', and '0001M' all describe the calendar month January.</p>
|
253
|
+
</div>
|
254
|
+
<div class="example"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851d" id="_63112cbc-cde0-435f-9553-e0b8c4f5851d"></a>
|
255
|
+
<p class="example"><span style="mso-tab-count:1">  </span>'2M', '02M', and '0002M' all describe the calendar month February.</p>
|
256
|
+
</div>
|
229
257
|
</div>
|
230
258
|
</div>
|
231
|
-
</div>
|
232
259
|
OUTPUT
|
233
260
|
end
|
234
261
|
|
235
|
-
|
236
|
-
|
262
|
+
it "processes source code in tables (Word)" do
|
263
|
+
FileUtils.rm_f "test.doc"
|
237
264
|
FileUtils.rm_f "test.html"
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
</table>
|
249
|
-
|
250
|
-
|
265
|
+
input = <<~INPUT
|
266
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
267
|
+
<annex id="P" inline-header="false" obligation="normative">
|
268
|
+
<sourcecode lang="ruby" id="A">puts "Hello, world."</sourcecode>
|
269
|
+
<table id="samplecode">
|
270
|
+
<tbody>
|
271
|
+
<tr><td>
|
272
|
+
<sourcecode lang="ruby" id="B">puts "Hello, world."</sourcecode>
|
273
|
+
</td></tr>
|
274
|
+
</tbody>
|
275
|
+
</table>
|
276
|
+
</annex>
|
277
|
+
</iso-standard>
|
251
278
|
INPUT
|
252
|
-
|
253
|
-
|
279
|
+
IsoDoc::Iec::WordConvert
|
280
|
+
.new({ wordstylesheet: "spec/assets/word.css",
|
281
|
+
htmlstylesheet: "spec/assets/html.css" })
|
282
|
+
.convert("test", input, false)
|
283
|
+
word = File.read("test.doc", encoding: "UTF-8")
|
284
|
+
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
285
|
+
.sub(%r{<br[^>]*>\s*<div class="colophon">.*$}m, "")
|
254
286
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
287
|
+
<div class="WordSection3">
|
288
|
+
#{IEC_TITLE1.gsub(/ /, ' ')}
|
289
|
+
<p class="MsoNormal">
|
290
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
291
|
+
</p>
|
292
|
+
<div class="Section3"><a name="P" id="P"></a>
|
293
|
+
<p class="Sourcecode"><a name="A" id="A"></a>puts "Hello, world."</p>
|
294
|
+
<div align='center' class='table_container'>
|
295
|
+
<table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
296
|
+
<a name='samplecode' id='samplecode'/>
|
297
|
+
<tbody>
|
298
|
+
<tr>
|
299
|
+
<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;" class="TABLE-cell">
|
300
|
+
<p class="CODE-TableCell"><a name="B" id="B"></a>puts "Hello, world."</p>
|
301
|
+
</td>
|
302
|
+
</tr>
|
303
|
+
</tbody>
|
304
|
+
</table>
|
305
|
+
</div>
|
273
306
|
</div>
|
274
307
|
</div>
|
275
|
-
</div>
|
276
308
|
OUTPUT
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
309
|
+
end
|
281
310
|
end
|