metanorma-iso 1.6.0 → 1.7.3

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