isodoc 1.7.6 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +1 -1
  3. data/lib/isodoc/class_utils.rb +23 -0
  4. data/lib/isodoc/convert.rb +9 -0
  5. data/lib/isodoc/function/cleanup.rb +4 -0
  6. data/lib/isodoc/function/inline.rb +2 -4
  7. data/lib/isodoc/function/utils.rb +1 -1
  8. data/lib/isodoc/html_function/html.rb +1 -0
  9. data/lib/isodoc/html_function/postprocess.rb +4 -6
  10. data/lib/isodoc/metadata_date.rb +13 -11
  11. data/lib/isodoc/presentation_function/bibdata.rb +2 -2
  12. data/lib/isodoc/presentation_function/block.rb +0 -36
  13. data/lib/isodoc/presentation_function/inline.rb +14 -11
  14. data/lib/isodoc/presentation_function/terms.rb +179 -0
  15. data/lib/isodoc/presentation_xml_convert.rb +11 -4
  16. data/lib/isodoc/version.rb +1 -1
  17. data/lib/isodoc/word_function/body.rb +24 -14
  18. data/lib/isodoc/word_function/comments.rb +0 -4
  19. data/lib/isodoc/word_function/postprocess.rb +184 -176
  20. data/lib/isodoc/xref/xref_gen.rb +18 -22
  21. data/lib/isodoc/xref/xref_gen_seq.rb +10 -16
  22. data/lib/isodoc/xref/xref_sect_gen.rb +134 -129
  23. data/lib/isodoc/xslfo_convert.rb +11 -7
  24. data/lib/isodoc-yaml/i18n-ar.yaml +22 -0
  25. data/lib/isodoc-yaml/i18n-de.yaml +20 -0
  26. data/lib/isodoc-yaml/i18n-en.yaml +20 -0
  27. data/lib/isodoc-yaml/i18n-es.yaml +20 -0
  28. data/lib/isodoc-yaml/i18n-fr.yaml +20 -0
  29. data/lib/isodoc-yaml/i18n-ru.yaml +21 -1
  30. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +21 -0
  31. data/lib/metanorma/output/xslfo.rb +4 -11
  32. data/spec/assets/i18n.yaml +3 -1
  33. data/spec/isodoc/blocks_spec.rb +14 -8
  34. data/spec/isodoc/i18n_spec.rb +8 -8
  35. data/spec/isodoc/inline_spec.rb +200 -6
  36. data/spec/isodoc/lists_spec.rb +344 -222
  37. data/spec/isodoc/section_spec.rb +11 -10
  38. data/spec/isodoc/table_spec.rb +71 -73
  39. data/spec/isodoc/terms_spec.rb +354 -34
  40. data/spec/isodoc/xref_numbering_spec.rb +347 -0
  41. data/spec/isodoc/xref_spec.rb +271 -350
  42. data/spec/isodoc/xslfo_convert_spec.rb +34 -9
  43. metadata +7 -6
  44. data/lib/isodoc/presentation_function/concept.rb +0 -68
@@ -2,232 +2,247 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
4
  it "processes unordered lists" do
5
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
6
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
7
- <iso-standard xmlns="http://riboseinc.com/isoxml">
8
- <preface><foreword>
9
- <ul id="_61961034-0fb1-436b-b281-828857a59ddb" keep-with-next="true" keep-lines-together="true">
10
- <li>
11
- <p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
12
- </li>
13
- <li>
14
- <p id="_60eb765c-1f6c-418a-8016-29efa06bf4f9">deletion of 4.3.</p>
15
- </li>
16
- </ul>
17
- </foreword></preface>
18
- </iso-standard>
19
- INPUT
20
- #{HTML_HDR}
21
- <br/>
22
- <div>
23
- <h1 class="ForewordTitle">Foreword</h1>
24
- <ul id="_61961034-0fb1-436b-b281-828857a59ddb" style="page-break-after: avoid;page-break-inside: avoid;">
25
- <li>
26
- <p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
27
- </li>
28
- <li>
29
- <p id="_60eb765c-1f6c-418a-8016-29efa06bf4f9">deletion of 4.3.</p>
30
- </li>
31
- </ul>
32
- </div>
33
- <p class="zzSTDTitle1"/>
5
+ input = <<~INPUT
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <preface><foreword>
8
+ <ul id="_61961034-0fb1-436b-b281-828857a59ddb" keep-with-next="true" keep-lines-together="true">
9
+ <li>
10
+ <p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
11
+ </li>
12
+ <li>
13
+ <p id="_60eb765c-1f6c-418a-8016-29efa06bf4f9">deletion of 4.3.</p>
14
+ </li>
15
+ </ul>
16
+ </foreword></preface>
17
+ </iso-standard>
18
+ INPUT
19
+ output = <<~OUTPUT
20
+ #{HTML_HDR}
21
+ <br/>
22
+ <div>
23
+ <h1 class="ForewordTitle">Foreword</h1>
24
+ <ul id="_61961034-0fb1-436b-b281-828857a59ddb" style="page-break-after: avoid;page-break-inside: avoid;">
25
+ <li>
26
+ <p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
27
+ </li>
28
+ <li>
29
+ <p id="_60eb765c-1f6c-418a-8016-29efa06bf4f9">deletion of 4.3.</p>
30
+ </li>
31
+ </ul>
34
32
  </div>
35
- </body>
36
- </html>
37
- OUTPUT
33
+ <p class="zzSTDTitle1"/>
34
+ </div>
35
+ </body>
36
+ </html>
37
+ OUTPUT
38
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
39
+ .convert("test", input, true)))
40
+ .to be_equivalent_to xmlpp(output)
38
41
  end
39
42
 
40
43
  it "processes unordered checklists" do
44
+ input = <<~INPUT
45
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
46
+ <preface><foreword>
47
+ <ul id="_61961034-0fb1-436b-b281-828857a59ddb">
48
+ <li checkedcheckbox="true" uncheckedcheckbox="false">
49
+ <p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
50
+ </li>
51
+ <li checkedcheckbox="false" uncheckedcheckbox="true">
52
+ <p id="_60eb765c-1f6c-418a-8016-29efa06bf4f9">deletion of 4.3.</p>
53
+ </li>
54
+ </ul>
55
+ </foreword></preface>
56
+ </iso-standard>
57
+ INPUT
58
+ output = <<~OUTPUT
59
+ #{HTML_HDR}
60
+ <br/>
61
+ <div>
62
+ <h1 class='ForewordTitle'>Foreword</h1>
63
+ <ul id='_61961034-0fb1-436b-b281-828857a59ddb'>
64
+ <li>
65
+ <span class='zzMoveToFollowing'>
66
+ <input type='checkbox'/>
67
+ </span>
68
+ <p id='_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2'>updated normative references;</p>
69
+ </li>
70
+ <li>
71
+ <span class='zzMoveToFollowing'>
72
+ <input type='checkbox' checked='checked'/>
73
+ </span>
74
+ <p id='_60eb765c-1f6c-418a-8016-29efa06bf4f9'>deletion of 4.3.</p>
75
+ </li>
76
+ </ul>
77
+ </div>
78
+ <p class='zzSTDTitle1'/>
79
+ </div>
80
+ </body>
81
+ </html>
82
+ OUTPUT
41
83
  expect(xmlpp(IsoDoc::HtmlConvert.new({})
42
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
43
- <iso-standard xmlns="http://riboseinc.com/isoxml">
44
- <preface><foreword>
45
- <ul id="_61961034-0fb1-436b-b281-828857a59ddb">
46
- <li checkedcheckbox="true" uncheckedcheckbox="false">
47
- <p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
48
- </li>
49
- <li checkedcheckbox="false" uncheckedcheckbox="true">
50
- <p id="_60eb765c-1f6c-418a-8016-29efa06bf4f9">deletion of 4.3.</p>
51
- </li>
52
- </ul>
53
- </foreword></preface>
54
- </iso-standard>
55
- INPUT
56
- #{HTML_HDR}
57
- <br/>
58
- <div>
84
+ .convert("test", input, true)))
85
+ .to be_equivalent_to xmlpp(output)
86
+ end
87
+
88
+ it "processes unordered checklists (Word)" do
89
+ input = <<~INPUT
90
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
91
+ <preface><foreword>
92
+ <ul id="_61961034-0fb1-436b-b281-828857a59ddb">
93
+ <li checkedcheckbox="true" uncheckedcheckbox="false">
94
+ <p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
95
+ </li>
96
+ <li checkedcheckbox="false" uncheckedcheckbox="true">
97
+ <p id="_60eb765c-1f6c-418a-8016-29efa06bf4f9">deletion of 4.3.</p>
98
+ </li>
99
+ </ul>
100
+ </foreword></preface>
101
+ </iso-standard>
102
+ INPUT
103
+ output = <<~OUTPUT
104
+ <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
105
+ <head><style/></head>
106
+ <body lang='EN-US' link='blue' vlink='#954F72'>
107
+ <div class='WordSection1'>
108
+ <p>&#160;</p>
109
+ </div>
110
+ <p>
111
+ <br clear='all' class='section'/>
112
+ </p>
113
+ <div class='WordSection2'>
114
+ <p>
115
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
116
+ </p>
117
+ <div>
59
118
  <h1 class='ForewordTitle'>Foreword</h1>
60
119
  <ul id='_61961034-0fb1-436b-b281-828857a59ddb'>
61
120
  <li>
62
- <span class='zzMoveToFollowing'>
63
- <input type='checkbox'/>
64
- </span>
121
+ <span class='zzMoveToFollowing'>&#9745; </span>
65
122
  <p id='_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2'>updated normative references;</p>
66
123
  </li>
67
124
  <li>
68
- <span class='zzMoveToFollowing'>
69
- <input type='checkbox' checked='checked'/>
70
- </span>
125
+ <span class='zzMoveToFollowing'>&#9744; </span>
71
126
  <p id='_60eb765c-1f6c-418a-8016-29efa06bf4f9'>deletion of 4.3.</p>
72
127
  </li>
73
128
  </ul>
74
129
  </div>
130
+ <p>&#160;</p>
131
+ </div>
132
+ <p>
133
+ <br clear='all' class='section'/>
134
+ </p>
135
+ <div class='WordSection3'>
75
136
  <p class='zzSTDTitle1'/>
76
137
  </div>
77
138
  </body>
78
139
  </html>
79
- OUTPUT
80
- end
81
-
82
- it "processes unordered checklists (Word)" do
140
+ OUTPUT
83
141
  expect(xmlpp(IsoDoc::WordConvert.new({})
84
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
85
- <iso-standard xmlns="http://riboseinc.com/isoxml">
86
- <preface><foreword>
87
- <ul id="_61961034-0fb1-436b-b281-828857a59ddb">
88
- <li checkedcheckbox="true" uncheckedcheckbox="false">
89
- <p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
90
- </li>
91
- <li checkedcheckbox="false" uncheckedcheckbox="true">
92
- <p id="_60eb765c-1f6c-418a-8016-29efa06bf4f9">deletion of 4.3.</p>
93
- </li>
94
- </ul>
95
- </foreword></preface>
96
- </iso-standard>
97
- INPUT
98
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
99
- <head><style/></head>
100
- <body lang='EN-US' link='blue' vlink='#954F72'>
101
- <div class='WordSection1'>
102
- <p>&#160;</p>
103
- </div>
104
- <p>
105
- <br clear='all' class='section'/>
106
- </p>
107
- <div class='WordSection2'>
108
- <p>
109
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
110
- </p>
111
- <div>
112
- <h1 class='ForewordTitle'>Foreword</h1>
113
- <ul id='_61961034-0fb1-436b-b281-828857a59ddb'>
114
- <li>
115
- <span class='zzMoveToFollowing'>&#9745; </span>
116
- <p id='_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2'>updated normative references;</p>
117
- </li>
118
- <li>
119
- <span class='zzMoveToFollowing'>&#9744; </span>
120
- <p id='_60eb765c-1f6c-418a-8016-29efa06bf4f9'>deletion of 4.3.</p>
121
- </li>
122
- </ul>
123
- </div>
124
- <p>&#160;</p>
125
- </div>
126
- <p>
127
- <br clear='all' class='section'/>
128
- </p>
129
- <div class='WordSection3'>
130
- <p class='zzSTDTitle1'/>
131
- </div>
132
- </body>
133
- </html>
134
- OUTPUT
142
+ .convert("test", input, true)))
143
+ .to be_equivalent_to xmlpp(output)
135
144
  end
136
145
 
137
146
  it "processes ordered lists" do
138
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
139
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
140
- <iso-standard xmlns="http://riboseinc.com/isoxml">
141
- <preface><foreword>
142
- <ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="alphabet" keep-with-next="true" keep-lines-together="true">
143
- <li>
144
- <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
145
- </li>
146
- <ol>
147
- <li>
148
- <p id="_8a7b6299-db05-4ff8-9de7-ff019b9017b2">a reference to this document (i.e. ISO 17301-1);</p>
149
- </li>
150
- <ol>
151
- <li>
152
- <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
153
- </li>
154
- </ol>
155
- </ol>
147
+ input = <<~INPUT
148
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
149
+ <preface><foreword>
150
+ <ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="alphabet" keep-with-next="true" keep-lines-together="true">
151
+ <li>
152
+ <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
153
+ </li>
154
+ <ol>
155
+ <li>
156
+ <p id="_8a7b6299-db05-4ff8-9de7-ff019b9017b2">a reference to this document (i.e. ISO 17301-1);</p>
157
+ </li>
158
+ <ol>
159
+ <li>
160
+ <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
161
+ </li>
162
+ </ol>
156
163
  </ol>
157
- </foreword></preface>
158
- </iso-standard>
159
- INPUT
160
- #{HTML_HDR}
161
- <br/>
162
- <div>
163
- <h1 class="ForewordTitle">Foreword</h1>
164
- <ol type="a" id="_ae34a226-aab4-496d-987b-1aa7b6314026" style="page-break-after: avoid;page-break-inside: avoid;">
165
- <li>
166
- <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
167
- </li>
168
- <ol type="1">
169
- <li>
170
- <p id="_8a7b6299-db05-4ff8-9de7-ff019b9017b2">a reference to this document (i.e. ISO 17301-1);</p>
171
- </li>
172
- <ol type="i">
173
- <li>
174
- <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
175
- </li>
176
- </ol>
177
- </ol>
164
+ </ol>
165
+ </foreword></preface>
166
+ </iso-standard>
167
+ INPUT
168
+ output = <<~OUTPUT
169
+ #{HTML_HDR}
170
+ <br/>
171
+ <div>
172
+ <h1 class="ForewordTitle">Foreword</h1>
173
+ <ol type="a" id="_ae34a226-aab4-496d-987b-1aa7b6314026" style="page-break-after: avoid;page-break-inside: avoid;">
174
+ <li>
175
+ <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
176
+ </li>
177
+ <ol type="1">
178
+ <li>
179
+ <p id="_8a7b6299-db05-4ff8-9de7-ff019b9017b2">a reference to this document (i.e. ISO 17301-1);</p>
180
+ </li>
181
+ <ol type="i">
182
+ <li>
183
+ <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
184
+ </li>
178
185
  </ol>
179
- </div>
180
- <p class="zzSTDTitle1"/>
186
+ </ol>
187
+ </ol>
181
188
  </div>
182
- </body>
183
- </html>
184
- OUTPUT
189
+ <p class="zzSTDTitle1"/>
190
+ </div>
191
+ </body>
192
+ </html>
193
+ OUTPUT
194
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
195
+ .convert("test", input, true)))
196
+ .to be_equivalent_to xmlpp(output)
185
197
  end
186
198
 
187
199
  it "processes Roman Upper ordered lists" do
188
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
189
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
190
- <iso-standard xmlns="http://riboseinc.com/isoxml">
191
- <preface><foreword>
192
- <ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="roman_upper">
193
- <li id="_ae34a226-aab4-496d-987b-1aa7b6314027">
194
- <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
195
- </li>
196
- <li>
197
- <p id="_8a7b6299-db05-4ff8-9de7-ff019b9017b2">a reference to this document (i.e. ISO 17301-1);</p>
198
- </li>
199
- <li>
200
- <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
201
- </li>
202
- </ol>
203
- </foreword></preface>
204
- </iso-standard>
205
- INPUT
206
- #{HTML_HDR}
207
- <br/>
208
- <div>
209
- <h1 class="ForewordTitle">Foreword</h1>
210
- <ol type="I" id="_ae34a226-aab4-496d-987b-1aa7b6314026">
211
- <li id="_ae34a226-aab4-496d-987b-1aa7b6314027">
212
- <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
213
- </li>
214
- <li>
215
- <p id="_8a7b6299-db05-4ff8-9de7-ff019b9017b2">a reference to this document (i.e. ISO 17301-1);</p>
216
- </li>
217
- <li>
218
- <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
219
- </li>
220
- </ol>
221
- </div>
222
- <p class="zzSTDTitle1"/>
200
+ input = <<~INPUT
201
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
202
+ <preface><foreword>
203
+ <ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="roman_upper">
204
+ <li id="_ae34a226-aab4-496d-987b-1aa7b6314027">
205
+ <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
206
+ </li>
207
+ <li>
208
+ <p id="_8a7b6299-db05-4ff8-9de7-ff019b9017b2">a reference to this document (i.e. ISO 17301-1);</p>
209
+ </li>
210
+ <li>
211
+ <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
212
+ </li>
213
+ </ol>
214
+ </foreword></preface>
215
+ </iso-standard>
216
+ INPUT
217
+ output = <<~OUTPUT
218
+ #{HTML_HDR}
219
+ <br/>
220
+ <div>
221
+ <h1 class="ForewordTitle">Foreword</h1>
222
+ <ol type="I" id="_ae34a226-aab4-496d-987b-1aa7b6314026">
223
+ <li id="_ae34a226-aab4-496d-987b-1aa7b6314027">
224
+ <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
225
+ </li>
226
+ <li>
227
+ <p id="_8a7b6299-db05-4ff8-9de7-ff019b9017b2">a reference to this document (i.e. ISO 17301-1);</p>
228
+ </li>
229
+ <li>
230
+ <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
231
+ </li>
232
+ </ol>
223
233
  </div>
224
- </body>
225
- </html>
226
- OUTPUT
234
+ <p class="zzSTDTitle1"/>
235
+ </div>
236
+ </body>
237
+ </html>
238
+ OUTPUT
239
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
240
+ .convert("test", input, true)))
241
+ .to be_equivalent_to xmlpp(output)
227
242
  end
228
243
 
229
244
  it "processes definition lists" do
230
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
245
+ input = <<~INPUT
231
246
  <iso-standard xmlns="http://riboseinc.com/isoxml">
232
247
  <preface><foreword>
233
248
  <dl id="_732d3f57-4f88-40bf-9ae9-633891edc395" keep-with-next="true" keep-lines-together="true">
@@ -244,39 +259,43 @@ RSpec.describe IsoDoc do
244
259
  </foreword></preface>
245
260
  </iso-standard>
246
261
  INPUT
247
- #{HTML_HDR}
248
- <br/>
249
- <div>
250
- <h1 class="ForewordTitle">Foreword</h1>
251
- <dl id="_732d3f57-4f88-40bf-9ae9-633891edc395" style="page-break-after: avoid;page-break-inside: avoid;">
252
- <dt>
253
- <p>
254
- W
255
- </p>
256
- </dt>
257
- <dd>
258
- <p id="_05d81174-3a41-44af-94d8-c78b8d2e175d">mass fraction of gelatinized kernels, expressed in per cent</p>
259
- </dd>
260
- <dt>
261
- <span class="stem">(#(w)#)</span>
262
- </dt>
263
- <dd>
264
- <p>??</p>
265
- </dd>
266
- </dl>
267
- <div class="Note">
268
- <p>&#160; This is a note</p>
269
- </div>
270
- </div>
271
- <p class="zzSTDTitle1"/>
272
- </div>
273
- </body>
274
- </html>
262
+ output = <<~OUTPUT
263
+ #{HTML_HDR}
264
+ <br/>
265
+ <div>
266
+ <h1 class="ForewordTitle">Foreword</h1>
267
+ <dl id="_732d3f57-4f88-40bf-9ae9-633891edc395" style="page-break-after: avoid;page-break-inside: avoid;">
268
+ <dt>
269
+ <p>
270
+ W
271
+ </p>
272
+ </dt>
273
+ <dd>
274
+ <p id="_05d81174-3a41-44af-94d8-c78b8d2e175d">mass fraction of gelatinized kernels, expressed in per cent</p>
275
+ </dd>
276
+ <dt>
277
+ <span class="stem">(#(w)#)</span>
278
+ </dt>
279
+ <dd>
280
+ <p>??</p>
281
+ </dd>
282
+ </dl>
283
+ <div class="Note">
284
+ <p>&#160; This is a note</p>
285
+ </div>
286
+ </div>
287
+ <p class="zzSTDTitle1"/>
288
+ </div>
289
+ </body>
290
+ </html>
275
291
  OUTPUT
292
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
293
+ .convert("test", input, true)))
294
+ .to be_equivalent_to xmlpp(output)
276
295
  end
277
296
 
278
297
  it "processes definition lists (Word)" do
279
- expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
298
+ input = <<~INPUT
280
299
  <iso-standard xmlns="http://riboseinc.com/isoxml">
281
300
  <preface><foreword>
282
301
  <dl id="_732d3f57-4f88-40bf-9ae9-633891edc395">
@@ -293,6 +312,7 @@ RSpec.describe IsoDoc do
293
312
  </foreword></preface>
294
313
  </iso-standard>
295
314
  INPUT
315
+ output = <<~OUTPUT
296
316
  <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
297
317
  <head><style/></head>
298
318
  <body lang="EN-US" link="blue" vlink="#954F72">
@@ -343,5 +363,107 @@ RSpec.describe IsoDoc do
343
363
  </body>
344
364
  </html>
345
365
  OUTPUT
366
+ expect(xmlpp(IsoDoc::WordConvert.new({})
367
+ .convert("test", input, true)))
368
+ .to be_equivalent_to xmlpp(output)
369
+ end
370
+
371
+ it "processes nested definition lists (Word)" do
372
+ input = <<~INPUT
373
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
374
+ <preface><foreword>
375
+ <dl id="_732d3f57-4f88-40bf-9ae9-633891edc394">
376
+ <dt>A Deflist</dt>
377
+ <dd>
378
+ <dl id="_732d3f57-4f88-40bf-9ae9-633891edc395">
379
+ <dt>W</dt>
380
+ <dd><p id="_05d81174-3a41-44af-94d8-c78b8d2e175d">mass fraction of gelatinized kernels</p></dd>
381
+ </dl>
382
+ </dd>
383
+ </dl>
384
+ <table id="_732d3f57-4f88-40bf-9ae9-633891edc396">
385
+ <tbody>
386
+ <tr>
387
+ <td>
388
+ <dl id="_732d3f57-4f88-40bf-9ae9-633891edc397">
389
+ <dt>X</dt>
390
+ <dd><p id="_05d81174-3a41-44af-94d8-c78b8d2e175e">expressed in per cent</p></dd>
391
+ </dl>
392
+ </td>
393
+ </tr>
394
+ </tbody>
395
+ </table>
396
+ </foreword></preface>
397
+ </iso-standard>
398
+ INPUT
399
+ output = <<~OUTPUT
400
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
401
+ <head>
402
+ <style>
403
+ </style>
404
+ </head>
405
+ <body lang='EN-US' link='blue' vlink='#954F72'>
406
+ <div class='WordSection1'>
407
+ <p>&#160;</p>
408
+ </div>
409
+ <p>
410
+ <br clear='all' class='section'/>
411
+ </p>
412
+ <div class='WordSection2'>
413
+ <p>
414
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
415
+ </p>
416
+ <div>
417
+ <h1 class='ForewordTitle'>Foreword</h1>
418
+ <table class='dl'>
419
+ <tr>
420
+ <td valign='top' align='left'>
421
+ <p align='left' style='margin-left:0pt;text-align:left;'>A Deflist</p>
422
+ </td>
423
+ <td valign='top'>
424
+ <dl id='_732d3f57-4f88-40bf-9ae9-633891edc395'>
425
+ <dt>
426
+ <p align='left' style='margin-left:0pt;text-align:left;'>W</p>
427
+ </dt>
428
+ <dd>
429
+ <p id='_05d81174-3a41-44af-94d8-c78b8d2e175d'>mass fraction of gelatinized kernels</p>
430
+ </dd>
431
+ </dl>
432
+ </td>
433
+ </tr>
434
+ </table>
435
+ <div align='center' class='table_container'>
436
+ <table id='_732d3f57-4f88-40bf-9ae9-633891edc396' class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
437
+ <tbody>
438
+ <tr>
439
+ <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;'>
440
+ <dl id='_732d3f57-4f88-40bf-9ae9-633891edc397'>
441
+ <dt>
442
+ <p align='left' style='margin-left:0pt;text-align:left;'>X</p>
443
+ </dt>
444
+ <dd>
445
+ <p id='_05d81174-3a41-44af-94d8-c78b8d2e175e'>expressed in per cent</p>
446
+ </dd>
447
+ </dl>
448
+ </td>
449
+ </tr>
450
+ </tbody>
451
+ </table>
452
+ </div>
453
+ </div>
454
+ <p>&#160;</p>
455
+ </div>
456
+ <p>
457
+ <br clear='all' class='section'/>
458
+ </p>
459
+ <div class='WordSection3'>
460
+ <p class='zzSTDTitle1'/>
461
+ </div>
462
+ </body>
463
+ </html>
464
+ OUTPUT
465
+ expect(xmlpp(IsoDoc::WordConvert.new({})
466
+ .convert("test", input, true)))
467
+ .to be_equivalent_to xmlpp(output)
346
468
  end
347
469
  end