slaw 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slaw/version.rb +1 -1
- data/lib/slaw/za/act_nodes.rb +2 -2
- data/spec/za/act_spec.rb +44 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab0729eacd76a7bf7f4cd639986b5a892a635125
|
4
|
+
data.tar.gz: c9994dc951d991553f55709a22cd8d21e6bb9aa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d40d3cba28815aed221a31216dc6d337300f0cc74925e816f974c5a42e3e427a88b2a18010aafb554bc9b9ffc4fe691b7d4bcadeadfee6022bb198e2425c469
|
7
|
+
data.tar.gz: 42653d4f00bf24f9d7345938255ab49d725ef197adda131410d7317dd8d30dcec34f61cf66c6da48dcffbaf57fd63a61398973c332cd98a9d763c3a3d80cf734
|
data/lib/slaw/version.rb
CHANGED
data/lib/slaw/za/act_nodes.rb
CHANGED
@@ -143,7 +143,7 @@ module Slaw
|
|
143
143
|
|
144
144
|
def title
|
145
145
|
if heading.text_value and heading.respond_to? :content
|
146
|
-
heading.content.text_value
|
146
|
+
heading.content.text_value.strip
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
@@ -180,7 +180,7 @@ module Slaw
|
|
180
180
|
|
181
181
|
def title
|
182
182
|
if heading.text_value and heading.respond_to? :content
|
183
|
-
heading.content.text_value
|
183
|
+
heading.content.text_value.strip
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
data/spec/za/act_spec.rb
CHANGED
@@ -191,6 +191,28 @@ EOS
|
|
191
191
|
</content>
|
192
192
|
</subsection>
|
193
193
|
</section>
|
194
|
+
</chapter>'
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'should handle whitespace in chapter titles' do
|
198
|
+
node = parse :chapter, <<EOS
|
199
|
+
Chapter 2
|
200
|
+
The Chapter Heading
|
201
|
+
1. Section
|
202
|
+
Hello there
|
203
|
+
EOS
|
204
|
+
to_xml(node).should == '<chapter id="chapter-2">
|
205
|
+
<num>2</num>
|
206
|
+
<heading>The Chapter Heading</heading>
|
207
|
+
<section id="section-1">
|
208
|
+
<num>1.</num>
|
209
|
+
<heading>Section</heading>
|
210
|
+
<subsection id="section-1.subsection-0">
|
211
|
+
<content>
|
212
|
+
<p>Hello there</p>
|
213
|
+
</content>
|
214
|
+
</subsection>
|
215
|
+
</section>
|
194
216
|
</chapter>'
|
195
217
|
end
|
196
218
|
end
|
@@ -284,6 +306,28 @@ EOS
|
|
284
306
|
</part>'
|
285
307
|
end
|
286
308
|
|
309
|
+
it 'should handle part headers with whitespace' do
|
310
|
+
node = parse :part, <<EOS
|
311
|
+
Part 2
|
312
|
+
The Part Heading
|
313
|
+
1. Section
|
314
|
+
Hello there
|
315
|
+
EOS
|
316
|
+
to_xml(node).should == '<part id="part-2">
|
317
|
+
<num>2</num>
|
318
|
+
<heading>The Part Heading</heading>
|
319
|
+
<section id="section-1">
|
320
|
+
<num>1.</num>
|
321
|
+
<heading>Section</heading>
|
322
|
+
<subsection id="section-1.subsection-0">
|
323
|
+
<content>
|
324
|
+
<p>Hello there</p>
|
325
|
+
</content>
|
326
|
+
</subsection>
|
327
|
+
</section>
|
328
|
+
</part>'
|
329
|
+
end
|
330
|
+
|
287
331
|
it 'should handle parts and odd section numbers' do
|
288
332
|
subject.parser.options = {section_number_after_title: false}
|
289
333
|
node = parse :parts, <<EOS
|