deba 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/deba.rb +1 -1
- data/lib/deba/document.rb +8 -6
- data/lib/deba/extractor.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fe17361d27ad08be736b43226bb3d45f651ea54
|
4
|
+
data.tar.gz: ae815a96de117f228132fb6ceb0555ba4e626c38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddbd6ff04ae63cad8a15c99e27a5652cc0862784ab832eaed32aea23405c496d540c6d2f41a934deeb7204f5a2d96a4a83daf06372780e9fca15504a5aef08c1
|
7
|
+
data.tar.gz: b916d4c464968c4b7bae4badf8ae040f9050df48f87f3dd662f40b4095b42a63408aa6d1095aa1e7eeb76e4e860ef86c65d47c226a3c62f8691fa611f8a0c41b
|
data/lib/deba.rb
CHANGED
data/lib/deba/document.rb
CHANGED
@@ -22,20 +22,22 @@ class Deba::Document
|
|
22
22
|
def finish
|
23
23
|
return unless present?
|
24
24
|
|
25
|
-
@
|
26
|
-
|
27
|
-
block.unshift(BLOCKQUOTE) if @extractor.in_blockquote?
|
28
|
-
|
29
|
-
@content << Deba::Stringifier.new(block).stringify
|
25
|
+
@content << BLOCKQUOTE if @extractor.in_blockquote?
|
26
|
+
@content << block_content
|
30
27
|
end
|
31
28
|
|
32
29
|
def start(*args)
|
33
30
|
@segments = []
|
34
|
-
@block_type = args.shift
|
35
31
|
@args = args
|
36
32
|
end
|
37
33
|
|
38
34
|
def present?
|
39
35
|
@segments.any? { |segment| segment.is_a?(Deba::Span) && Deba::Utils.present?(segment.to_s) }
|
40
36
|
end
|
37
|
+
|
38
|
+
def block_content
|
39
|
+
block_type = @args.shift
|
40
|
+
@args.unshift(@segments)
|
41
|
+
Deba::Stringifier.new(block_type.new(*@args).to_a).stringify
|
42
|
+
end
|
41
43
|
end
|
data/lib/deba/extractor.rb
CHANGED
@@ -106,7 +106,7 @@ class Deba::Extractor
|
|
106
106
|
if node_name == 'li'
|
107
107
|
last_item = node.xpath('count(following-sibling::li)').to_i == 0
|
108
108
|
index = node.xpath('boolean(ancestor::ol)') ? (node.xpath('count(preceding-sibling::li)').to_i + 1) : nil
|
109
|
-
|
109
|
+
|
110
110
|
@document.break(Deba::ListItem, last_item, index)
|
111
111
|
node.children.each { |n| process(n) }
|
112
112
|
@document.break(Deba::Paragraph)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brenton "B-Train" Fletcher
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
103
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.
|
104
|
+
rubygems_version: 2.6.8
|
105
105
|
signing_key:
|
106
106
|
specification_version: 4
|
107
107
|
summary: Fillet HTML using this Deba knife to extract the juicy text content
|