metanorma-iso 1.6.1 → 1.7.4
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 +11 -41
- data/.gitignore +2 -0
- data/.rubocop.yml +6 -2
- data/lib/asciidoctor/iso/base.rb +13 -13
- data/lib/asciidoctor/iso/basicdoc.rng +5 -3
- data/lib/asciidoctor/iso/biblio.rng +4 -6
- data/lib/asciidoctor/iso/cleanup.rb +1 -1
- data/lib/asciidoctor/iso/front.rb +6 -6
- data/lib/asciidoctor/iso/front_id.rb +30 -25
- data/lib/asciidoctor/iso/isodoc.rng +108 -2
- data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
- data/lib/asciidoctor/iso/isostandard.rng +17 -97
- data/lib/asciidoctor/iso/validate.rb +68 -1
- data/lib/asciidoctor/iso/validate_title.rb +21 -13
- data/lib/isodoc/iso/base_convert.rb +11 -0
- data/lib/isodoc/iso/html/header.html +12 -12
- data/lib/isodoc/iso/html/html_iso_intro.html +1 -1
- data/lib/isodoc/iso/html/html_iso_titlepage.html +1 -1
- data/lib/isodoc/iso/html/word_iso_intro.html +1 -1
- data/lib/isodoc/iso/html/word_iso_titlepage.html +1 -1
- data/lib/isodoc/iso/html_convert.rb +2 -2
- data/lib/isodoc/iso/i18n-en.yaml +6 -0
- data/lib/isodoc/iso/i18n-fr.yaml +4 -0
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
- data/lib/isodoc/iso/index.rb +140 -0
- data/lib/isodoc/iso/iso.amendment.xsl +1009 -321
- data/lib/isodoc/iso/iso.international-standard.xsl +1009 -321
- data/lib/isodoc/iso/presentation_xml_convert.rb +1 -4
- data/lib/isodoc/iso/word_convert.rb +2 -2
- data/lib/isodoc/iso/xref.rb +5 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -4
- data/spec/asciidoctor/amd_spec.rb +696 -0
- data/spec/asciidoctor/base_spec.rb +704 -0
- data/spec/asciidoctor/blocks_spec.rb +527 -0
- data/spec/asciidoctor/cleanup_spec.rb +1134 -0
- data/spec/asciidoctor/inline_spec.rb +195 -0
- data/spec/asciidoctor/lists_spec.rb +197 -0
- data/spec/asciidoctor/refs_spec.rb +375 -0
- data/spec/asciidoctor/section_spec.rb +393 -0
- data/spec/asciidoctor/table_spec.rb +329 -0
- data/spec/asciidoctor/validate_spec.rb +1572 -0
- data/spec/isodoc/amd_spec.rb +967 -946
- data/spec/isodoc/blocks_spec.rb +530 -507
- data/spec/isodoc/i18n_spec.rb +953 -911
- data/spec/isodoc/inline_spec.rb +355 -293
- data/spec/isodoc/iso_spec.rb +340 -316
- data/spec/isodoc/metadata_spec.rb +392 -382
- data/spec/isodoc/postproc_spec.rb +834 -656
- data/spec/isodoc/ref_spec.rb +374 -331
- data/spec/isodoc/section_spec.rb +821 -519
- data/spec/isodoc/table_spec.rb +472 -411
- data/spec/isodoc/terms_spec.rb +209 -185
- data/spec/isodoc/xref_spec.rb +1370 -1236
- data/spec/metanorma/processor_spec.rb +28 -26
- data/spec/spec_helper.rb +186 -189
- metadata +26 -27
- data/.rubocop.ribose.yml +0 -66
- data/spec/asciidoctor-iso/amd_spec.rb +0 -694
- data/spec/asciidoctor-iso/base_spec.rb +0 -713
- data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
- data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
- data/spec/asciidoctor-iso/inline_spec.rb +0 -170
- data/spec/asciidoctor-iso/lists_spec.rb +0 -190
- data/spec/asciidoctor-iso/refs_spec.rb +0 -317
- data/spec/asciidoctor-iso/section_spec.rb +0 -362
- data/spec/asciidoctor-iso/table_spec.rb +0 -313
- data/spec/asciidoctor-iso/validate_spec.rb +0 -1550
- data/spec/assets/xref_error.adoc +0 -7
data/spec/isodoc/iso_spec.rb
CHANGED
@@ -2,16 +2,17 @@ require "spec_helper"
|
|
2
2
|
require "fileutils"
|
3
3
|
|
4
4
|
RSpec.describe IsoDoc::Iso do
|
5
|
-
FileUtils.rm_f "test.html"
|
6
5
|
it "processes isodoc as ISO: HTML output" do
|
7
6
|
IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", false)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
8
|
+
<preface>
|
9
|
+
<foreword>
|
10
|
+
<note>
|
11
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
12
|
+
</note>
|
13
|
+
</foreword>
|
14
|
+
</preface>
|
15
|
+
</iso-standard>
|
15
16
|
INPUT
|
16
17
|
html = File.read("test.html", encoding: "utf-8")
|
17
18
|
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
@@ -20,15 +21,16 @@ RSpec.describe IsoDoc::Iso do
|
|
20
21
|
end
|
21
22
|
|
22
23
|
it "processes isodoc as ISO: alt HTML output" do
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
</note>
|
30
|
-
|
31
|
-
|
24
|
+
IsoDoc::Iso::HtmlConvert.new(alt: true).convert("test", <<~"INPUT", false)
|
25
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
26
|
+
<preface>
|
27
|
+
<foreword>
|
28
|
+
<note>
|
29
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
30
|
+
</note>
|
31
|
+
</foreword>
|
32
|
+
</preface>
|
33
|
+
</iso-standard>
|
32
34
|
INPUT
|
33
35
|
html = File.read("test.html", encoding: "utf-8")
|
34
36
|
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Space Mono", monospace;]m)
|
@@ -37,33 +39,36 @@ RSpec.describe IsoDoc::Iso do
|
|
37
39
|
end
|
38
40
|
|
39
41
|
it "processes isodoc as ISO: Chinese HTML output" do
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
</note>
|
47
|
-
|
48
|
-
|
42
|
+
IsoDoc::Iso::HtmlConvert.new(script: "Hans").convert("test", <<~"INPUT", false)
|
43
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
44
|
+
<preface>
|
45
|
+
<foreword>
|
46
|
+
<note>
|
47
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
48
|
+
</note>
|
49
|
+
</foreword>
|
50
|
+
</preface>
|
51
|
+
</iso-standard>
|
49
52
|
INPUT
|
50
53
|
html = File.read("test.html", encoding: "utf-8")
|
51
54
|
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
52
|
-
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "
|
53
|
-
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "
|
55
|
+
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
|
56
|
+
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
|
54
57
|
end
|
55
58
|
|
56
59
|
it "processes isodoc as ISO: user nominated fonts" do
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
60
|
+
IsoDoc::Iso::HtmlConvert.new(bodyfont: "Zapf Chancery", headerfont: "Comic Sans", monospacefont: "Andale Mono")
|
61
|
+
.convert("test", <<~"INPUT", false)
|
62
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
63
|
+
<preface>
|
64
|
+
<foreword>
|
65
|
+
<note>
|
66
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
67
|
+
</note>
|
68
|
+
</foreword>
|
69
|
+
</preface>
|
70
|
+
</iso-standard>
|
71
|
+
INPUT
|
67
72
|
html = File.read("test.html", encoding: "utf-8")
|
68
73
|
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: Andale Mono;]m)
|
69
74
|
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: Zapf Chancery;]m)
|
@@ -71,15 +76,16 @@ RSpec.describe IsoDoc::Iso do
|
|
71
76
|
end
|
72
77
|
|
73
78
|
it "processes isodoc as ISO: Word output" do
|
74
|
-
FileUtils.rm_f "test.doc"
|
75
79
|
IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", false)
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
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>
|
83
89
|
INPUT
|
84
90
|
html = File.read("test.doc", encoding: "utf-8")
|
85
91
|
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
@@ -88,297 +94,315 @@ RSpec.describe IsoDoc::Iso do
|
|
88
94
|
end
|
89
95
|
|
90
96
|
it "does not include IEV in references" do
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
<bibitem
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
</
|
141
|
-
</
|
142
|
-
|
143
|
-
|
97
|
+
output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
|
98
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
99
|
+
<preface>
|
100
|
+
<foreword>
|
101
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
|
102
|
+
<eref bibitemid="IEV">IEV</eref>
|
103
|
+
<eref bibitemid="ISO20483">ISO 20483</eref>
|
104
|
+
</p>
|
105
|
+
</foreword>
|
106
|
+
</preface>
|
107
|
+
<bibliography>
|
108
|
+
<references id="_normative_references" normative="true" obligation="informative">
|
109
|
+
<title>1<tab/>
|
110
|
+
Normative References</title>
|
111
|
+
<bibitem id="IEV" type="international-standard">
|
112
|
+
<title format="text/plain" language="en" script="Latn">Electropedia: The World's Online Electrotechnical Vocabulary</title>
|
113
|
+
<uri type="src">http://www.electropedia.org</uri>
|
114
|
+
<docidentifier>IEV</docidentifier>
|
115
|
+
<contributor>
|
116
|
+
<role type="publisher"/>
|
117
|
+
<organization>
|
118
|
+
<name>International Electrotechnical Commission</name>
|
119
|
+
<abbreviation>IEC</abbreviation>
|
120
|
+
<uri>www.iec.ch</uri>
|
121
|
+
</organization>
|
122
|
+
</contributor>
|
123
|
+
<language>en</language>
|
124
|
+
<language>fr</language>
|
125
|
+
<script>Latn</script>
|
126
|
+
<copyright>
|
127
|
+
<owner>
|
128
|
+
<organization>
|
129
|
+
<name>International Electrotechnical Commission</name>
|
130
|
+
<abbreviation>IEC</abbreviation>
|
131
|
+
<uri>www.iec.ch</uri>
|
132
|
+
</organization>
|
133
|
+
</owner>
|
134
|
+
</copyright>
|
135
|
+
<relation type="updates">
|
136
|
+
<bibitem>
|
137
|
+
<formattedref>IEC 60050</formattedref>
|
138
|
+
</bibitem>
|
139
|
+
</relation>
|
140
|
+
</bibitem>
|
141
|
+
<bibitem id="ISO20483" type="standard">
|
142
|
+
<title format="text/plain">Cereals and pulses</title>
|
143
|
+
<docidentifier>ISO 20483</docidentifier>
|
144
|
+
<date type="published">
|
145
|
+
<from>2013</from>
|
146
|
+
<to>2014</to>
|
147
|
+
</date>
|
148
|
+
<contributor>
|
149
|
+
<role type="publisher"/>
|
150
|
+
<organization>
|
151
|
+
<name>International Organization for Standardization</name>
|
152
|
+
</organization>
|
153
|
+
</contributor>
|
154
|
+
</bibitem>
|
155
|
+
</references>
|
156
|
+
</bibliography>
|
157
|
+
</iso-standard>
|
144
158
|
INPUT
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
159
|
+
expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
160
|
+
#{HTML_HDR}
|
161
|
+
<br/>
|
162
|
+
<div>
|
163
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
164
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
|
165
|
+
<a href="#IEV">IEV</a>
|
166
|
+
<a href="#ISO20483">ISO 20483</a>
|
167
|
+
</p>
|
168
|
+
</div>
|
169
|
+
<p class="zzSTDTitle1"/>
|
170
|
+
<div>
|
171
|
+
<h1>1  Normative References</h1>
|
172
|
+
<p id="ISO20483" class="NormRef">ISO 20483, <i>Cereals and pulses</i></p>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
</body>
|
176
|
+
</html>
|
163
177
|
OUTPUT
|
164
|
-
end
|
178
|
+
end
|
165
179
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
</
|
174
|
-
|
175
|
-
|
180
|
+
it "processes examples (Presentation XML)" do
|
181
|
+
output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)
|
182
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
183
|
+
<preface>
|
184
|
+
<foreword>
|
185
|
+
<example id="samplecode">
|
186
|
+
<name>Title</name>
|
187
|
+
<p>Hello</p>
|
188
|
+
</example>
|
189
|
+
</foreword>
|
190
|
+
</preface>
|
191
|
+
</iso-standard>
|
176
192
|
INPUT
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
</
|
188
|
-
|
189
|
-
|
193
|
+
expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
194
|
+
<?xml version='1.0'?>
|
195
|
+
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
196
|
+
<preface>
|
197
|
+
<foreword>
|
198
|
+
<example id="samplecode">
|
199
|
+
<name>EXAMPLE — Title</name>
|
200
|
+
<p>Hello</p>
|
201
|
+
</example>
|
202
|
+
</foreword>
|
203
|
+
</preface>
|
204
|
+
</iso-standard>
|
205
|
+
OUTPUT
|
206
|
+
end
|
190
207
|
|
191
208
|
it "processes examples (HTML)" do
|
192
|
-
|
193
|
-
<iso-standard xmlns=
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
</iso-standard>
|
209
|
+
output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
|
210
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
211
|
+
<preface>
|
212
|
+
<foreword>
|
213
|
+
<example id="samplecode">
|
214
|
+
<name>EXAMPLE — Title</name>
|
215
|
+
<p>Hello</p>
|
216
|
+
</example>
|
217
|
+
</foreword>
|
218
|
+
</preface>
|
219
|
+
</iso-standard>
|
203
220
|
INPUT
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
221
|
+
expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
222
|
+
#{HTML_HDR}
|
223
|
+
<br/>
|
224
|
+
<div>
|
225
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
226
|
+
<div id="samplecode" class="example">
|
227
|
+
<p><span class="example_label">EXAMPLE — Title</span>  Hello</p>
|
228
|
+
</div>
|
229
|
+
</div>
|
230
|
+
<p class="zzSTDTitle1"/>
|
231
|
+
</div>
|
232
|
+
</body>
|
233
|
+
</html>
|
216
234
|
OUTPUT
|
217
235
|
end
|
218
236
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
</
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
</
|
230
|
-
|
231
|
-
|
237
|
+
it "processes sequences of examples (Presentation XML)" do
|
238
|
+
output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)
|
239
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
240
|
+
<preface>
|
241
|
+
<foreword>
|
242
|
+
<example id="samplecode">
|
243
|
+
<quote>Hello</quote>
|
244
|
+
</example>
|
245
|
+
<example id="samplecode2">
|
246
|
+
<name>Title</name>
|
247
|
+
<p>Hello</p>
|
248
|
+
</example>
|
249
|
+
</foreword>
|
250
|
+
</preface>
|
251
|
+
</iso-standard>
|
232
252
|
INPUT
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
</
|
248
|
-
|
249
|
-
|
253
|
+
expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
254
|
+
<?xml version='1.0'?>
|
255
|
+
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
256
|
+
<preface>
|
257
|
+
<foreword>
|
258
|
+
<example id="samplecode">
|
259
|
+
<name>EXAMPLE 1</name>
|
260
|
+
<quote>Hello</quote>
|
261
|
+
</example>
|
262
|
+
<example id="samplecode2">
|
263
|
+
<name>EXAMPLE 2 — Title</name>
|
264
|
+
<p>Hello</p>
|
265
|
+
</example>
|
266
|
+
</foreword>
|
267
|
+
</preface>
|
268
|
+
</iso-standard>
|
269
|
+
OUTPUT
|
270
|
+
end
|
250
271
|
|
251
272
|
it "processes sequences of examples (HTML)" do
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
</iso-standard>
|
273
|
+
output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
|
274
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
275
|
+
<preface>
|
276
|
+
<foreword>
|
277
|
+
<example id="samplecode">
|
278
|
+
<name>EXAMPLE 1</name>
|
279
|
+
<quote>Hello</quote>
|
280
|
+
</example>
|
281
|
+
<example id="samplecode2">
|
282
|
+
<name>EXAMPLE 2 — Title</name>
|
283
|
+
<p>Hello</p>
|
284
|
+
</example>
|
285
|
+
</foreword>
|
286
|
+
</preface>
|
287
|
+
</iso-standard>
|
267
288
|
INPUT
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
289
|
+
expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
290
|
+
#{HTML_HDR}
|
291
|
+
<br/>
|
292
|
+
<div>
|
293
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
294
|
+
<div id="samplecode" class="example">
|
295
|
+
<p><span class="example_label">EXAMPLE 1</span>  </p>
|
296
|
+
<div class="Quote">Hello</div>
|
297
|
+
</div>
|
298
|
+
<div id="samplecode2" class="example">
|
299
|
+
<p><span class="example_label">EXAMPLE 2 — Title</span>  Hello</p>
|
300
|
+
</div>
|
301
|
+
</div>
|
302
|
+
<p class="zzSTDTitle1"/>
|
303
|
+
</div>
|
304
|
+
</body>
|
305
|
+
</html>
|
284
306
|
OUTPUT
|
285
307
|
end
|
286
308
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
</iso-standard>
|
309
|
+
it "processes examples (Word)" do
|
310
|
+
output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true)
|
311
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
312
|
+
<preface>
|
313
|
+
<foreword>
|
314
|
+
<example id="samplecode">
|
315
|
+
<name>EXAMPLE — Title</name>
|
316
|
+
<p>Hello</p>
|
317
|
+
</example>
|
318
|
+
</foreword>
|
319
|
+
</preface>
|
320
|
+
</iso-standard>
|
299
321
|
INPUT
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
322
|
+
expect(xmlpp(output.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
|
323
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
324
|
+
<body lang="EN-US" link="blue" vlink="#954F72">
|
325
|
+
<div class="WordSection1">
|
326
|
+
<p> </p>
|
327
|
+
</div>
|
328
|
+
<p>
|
329
|
+
<br clear="all" class="section"/>
|
330
|
+
</p>
|
331
|
+
<div class="WordSection2">
|
332
|
+
<p>
|
333
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
334
|
+
</p>
|
335
|
+
<div>
|
336
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
337
|
+
<div id="samplecode" class="example">
|
338
|
+
<p><span class="example_label">EXAMPLE — Title</span><span style="mso-tab-count:1">  </span>Hello</p>
|
339
|
+
</div>
|
340
|
+
</div>
|
341
|
+
<p> </p>
|
342
|
+
</div>
|
343
|
+
<p>
|
344
|
+
<br clear="all" class="section"/>
|
345
|
+
</p>
|
346
|
+
<div class="WordSection3">
|
347
|
+
<p class="zzSTDTitle1"/>
|
348
|
+
</div>
|
349
|
+
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
350
|
+
<div class="colophon"/>
|
351
|
+
</body>
|
352
|
+
OUTPUT
|
329
353
|
end
|
330
354
|
|
331
|
-
|
332
355
|
it "processes sequences of examples (Word)" do
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
</iso-standard>
|
356
|
+
output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true)
|
357
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
358
|
+
<preface>
|
359
|
+
<foreword>
|
360
|
+
<example id="samplecode">
|
361
|
+
<name>EXAMPLE 1</name>
|
362
|
+
<quote>Hello</quote>
|
363
|
+
</example>
|
364
|
+
<example id="samplecode2">
|
365
|
+
<name>EXAMPLE 2 — Title</name>
|
366
|
+
<p>Hello</p>
|
367
|
+
</example>
|
368
|
+
</foreword>
|
369
|
+
</preface>
|
370
|
+
</iso-standard>
|
348
371
|
INPUT
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
372
|
+
expect(xmlpp(output.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
|
373
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
374
|
+
<body lang="EN-US" link="blue" vlink="#954F72">
|
375
|
+
<div class="WordSection1">
|
376
|
+
<p> </p>
|
377
|
+
</div>
|
378
|
+
<p>
|
379
|
+
<br clear="all" class="section"/>
|
380
|
+
</p>
|
381
|
+
<div class="WordSection2">
|
382
|
+
<p>
|
383
|
+
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
384
|
+
</p>
|
385
|
+
<div>
|
386
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
387
|
+
<div id="samplecode" class="example">
|
388
|
+
<p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">  </span></p>
|
389
|
+
<div class="Quote">Hello</div>
|
390
|
+
</div>
|
391
|
+
<div id="samplecode2" class="example">
|
392
|
+
<p><span class="example_label">EXAMPLE 2 — Title</span><span style="mso-tab-count:1">  </span>Hello</p>
|
393
|
+
</div>
|
394
|
+
</div>
|
395
|
+
<p> </p>
|
396
|
+
</div>
|
397
|
+
<p>
|
398
|
+
<br clear="all" class="section"/>
|
399
|
+
</p>
|
400
|
+
<div class="WordSection3">
|
401
|
+
<p class="zzSTDTitle1"/>
|
402
|
+
</div>
|
403
|
+
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
404
|
+
<div class="colophon"/>
|
405
|
+
</body>
|
406
|
+
OUTPUT
|
382
407
|
end
|
383
|
-
|
384
408
|
end
|