deba 0.9.0 → 0.10.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/definition_description.rb +13 -0
- data/lib/deba/definition_term.rb +12 -0
- data/lib/deba/extractor.rb +17 -0
- data/lib/deba/list_item.rb +5 -5
- data/lib/deba.rb +3 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d717c720283ce4e2ec8ff902b269c8fc79e15d92
|
4
|
+
data.tar.gz: e589c45ed86c7b6929ffdee81f8228a4197f963a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff5850362d73ad3fcb1e3ed1708ed2fb5ae35ab6d364f6f9efec83d41a02bff57fc3f52968c253941d07d16ff9e16364247a1d226b6925a2f9ae45d14c226a3c
|
7
|
+
data.tar.gz: e21024b05d064f279ee581f6841bc8e0d63dc4e7733b44151a2e9a0ef9d3aebf68a8103860503ed3c174f92af30c9851bf89f29c4e030ab936495f78bde4d71c
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Deba::DefinitionDescription
|
2
|
+
attr_reader :segments
|
3
|
+
|
4
|
+
def initialize(segments, line_prefix, last)
|
5
|
+
@segments = segments
|
6
|
+
@line_prefix = line_prefix
|
7
|
+
@last = last
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
"#{Deba::Stringifier.new(@segments, @line_prefix).stringify}\n#{"\n" if @last}"
|
12
|
+
end
|
13
|
+
end
|
data/lib/deba/extractor.rb
CHANGED
@@ -74,6 +74,23 @@ class Deba::Extractor
|
|
74
74
|
return
|
75
75
|
end
|
76
76
|
|
77
|
+
if node_name == 'dt'
|
78
|
+
@text_run.break(Deba::DefinitionTerm, line_prefix(node))
|
79
|
+
node.children.each { |n| process(n) }
|
80
|
+
@text_run.break(Deba::Paragraph, line_prefix(node))
|
81
|
+
|
82
|
+
return
|
83
|
+
end
|
84
|
+
|
85
|
+
if node_name == 'dd'
|
86
|
+
last_item = node.xpath('count(following-sibling::dd)').to_i == 0
|
87
|
+
@text_run.break(Deba::DefinitionDescription, line_prefix(node), last_item)
|
88
|
+
node.children.each { |n| process(n) }
|
89
|
+
@text_run.break(Deba::Paragraph, line_prefix(node))
|
90
|
+
|
91
|
+
return
|
92
|
+
end
|
93
|
+
|
77
94
|
#These tags terminate the current paragraph, if present, and start a new paragraph
|
78
95
|
if BLOCK_INITIATING_TAGS.include?(node_name)
|
79
96
|
@text_run.break(Deba::Paragraph, line_prefix(node))
|
data/lib/deba/list_item.rb
CHANGED
@@ -9,14 +9,14 @@ class Deba::ListItem
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_s
|
12
|
-
prefix
|
12
|
+
"#{Deba::Stringifier.new([prefix] + @segments, @line_prefix).stringify}\n#{"\n" if @last}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def prefix
|
16
|
+
if @index.nil?
|
13
17
|
"* "
|
14
18
|
else
|
15
19
|
"#{@index}. "
|
16
20
|
end
|
17
|
-
|
18
|
-
@segments.unshift(prefix)
|
19
|
-
|
20
|
-
"#{Deba::Stringifier.new(@segments, @line_prefix).stringify}\n#{"\n" if @last}"
|
21
21
|
end
|
22
22
|
end
|
data/lib/deba.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "nokogiri"
|
2
2
|
|
3
3
|
module Deba
|
4
|
-
VERSION = "0.
|
4
|
+
VERSION = "0.10.0"
|
5
5
|
end
|
6
6
|
|
7
7
|
require "deba/utils"
|
@@ -11,6 +11,8 @@ require "deba/break"
|
|
11
11
|
require "deba/heading"
|
12
12
|
require "deba/list_item"
|
13
13
|
require "deba/blockquote"
|
14
|
+
require "deba/definition_term"
|
15
|
+
require "deba/definition_description"
|
14
16
|
require "deba/paragraph"
|
15
17
|
require "deba/text_runner"
|
16
18
|
require "deba/extractor"
|
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.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brenton "B-Train" Fletcher
|
@@ -73,6 +73,8 @@ files:
|
|
73
73
|
- lib/deba.rb
|
74
74
|
- lib/deba/blockquote.rb
|
75
75
|
- lib/deba/break.rb
|
76
|
+
- lib/deba/definition_description.rb
|
77
|
+
- lib/deba/definition_term.rb
|
76
78
|
- lib/deba/document.rb
|
77
79
|
- lib/deba/extractor.rb
|
78
80
|
- lib/deba/heading.rb
|
@@ -101,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
103
|
version: '0'
|
102
104
|
requirements: []
|
103
105
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.6.8
|
105
107
|
signing_key:
|
106
108
|
specification_version: 4
|
107
109
|
summary: Fillet HTML using this Deba knife to extract the juicy text content
|