deba 0.14.0 → 0.15.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b6d057d5222e5c9217b6eb4e71e38bb48e0d174
4
- data.tar.gz: 44a35652c286de0f3b03e09a768e7c747ee2ce09
3
+ metadata.gz: 2fe17361d27ad08be736b43226bb3d45f651ea54
4
+ data.tar.gz: ae815a96de117f228132fb6ceb0555ba4e626c38
5
5
  SHA512:
6
- metadata.gz: 2cd4202bb56930f4fc666917b1edad5769d5000f268699e1ec2a246bf097613388f785741a5ecd5159b8a46b3aebc6a0b6d141bb2c7f608f99b834139f996bc9
7
- data.tar.gz: 052c0c915fda9685c7b51ea7ca741a04022dd6d39ed0a08b13d09621fd57281ea305f3008327edf6d8c4114a6ff2701809e3423581eea785077ec9b8c16094da
6
+ metadata.gz: ddbd6ff04ae63cad8a15c99e27a5652cc0862784ab832eaed32aea23405c496d540c6d2f41a934deeb7204f5a2d96a4a83daf06372780e9fca15504a5aef08c1
7
+ data.tar.gz: b916d4c464968c4b7bae4badf8ae040f9050df48f87f3dd662f40b4095b42a63408aa6d1095aa1e7eeb76e4e860ef86c65d47c226a3c62f8691fa611f8a0c41b
data/lib/deba.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require "nokogiri"
2
2
 
3
3
  module Deba
4
- VERSION = "0.14.0"
4
+ VERSION = "0.15.0"
5
5
  end
6
6
 
7
7
  require "deba/utils"
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
- @args.unshift(@segments)
26
- block = @block_type.new(*@args).to_a
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
@@ -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.14.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.4.5.1
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