deba 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/deba.gemspec +1 -1
- data/lib/deba/document.rb +15 -0
- data/lib/deba/extractor.rb +6 -6
- data/lib/deba/text_runner.rb +9 -9
- data/lib/deba.rb +2 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bb2408108f8d55f9615dfe7076804f0514a31ad
|
4
|
+
data.tar.gz: 300e03f63676c61472dfca464fc578c4e192655f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e83bfef880ff0cd253681079351f311025ea8af5c9f94ce183fa7449a250c0b15efc515391a75167beb84d52d5bb6b16f182ad0bf2e9cbe919c9222906066c0
|
7
|
+
data.tar.gz: 68b754c99c9697dcd68d745c40cfb34156d093f26557cde21e17ef4fd82214def9bff7241a5ae80f6cfaf0bb6a6bb33beb576b965138182570d6cc1e434de518
|
data/deba.gemspec
CHANGED
data/lib/deba/extractor.rb
CHANGED
@@ -5,18 +5,18 @@ class Deba::Extractor
|
|
5
5
|
|
6
6
|
attr_reader :blocks
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
@
|
8
|
+
def initialize(node)
|
9
|
+
@node = node
|
10
10
|
end
|
11
11
|
|
12
12
|
def extract
|
13
|
-
@blocks = []
|
14
13
|
@just_appended_br = false
|
15
|
-
@
|
14
|
+
@document = Deba::Document.new
|
15
|
+
@text_run = Deba::TextRunner.new(@document)
|
16
16
|
|
17
|
-
process(@
|
17
|
+
process(@node)
|
18
18
|
|
19
|
-
@
|
19
|
+
@document
|
20
20
|
end
|
21
21
|
|
22
22
|
def process(node)
|
data/lib/deba/text_runner.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class Deba::TextRunner
|
2
|
-
def initialize(
|
3
|
-
@
|
2
|
+
def initialize(document)
|
3
|
+
@document = document
|
4
4
|
|
5
5
|
start
|
6
6
|
end
|
@@ -9,22 +9,22 @@ class Deba::TextRunner
|
|
9
9
|
@segments << segment
|
10
10
|
end
|
11
11
|
|
12
|
-
def break(
|
12
|
+
def break(*args)
|
13
13
|
finish
|
14
|
-
start(
|
14
|
+
start(*args)
|
15
15
|
end
|
16
16
|
|
17
17
|
def finish
|
18
18
|
return unless present?
|
19
19
|
|
20
|
-
|
21
|
-
@
|
20
|
+
@args.unshift(@segments)
|
21
|
+
@document << @block_type.new(*@args)
|
22
22
|
end
|
23
23
|
|
24
|
-
def start(
|
24
|
+
def start(*args)
|
25
25
|
@segments = []
|
26
|
-
@block_type =
|
27
|
-
@
|
26
|
+
@block_type = args.shift
|
27
|
+
@args = args
|
28
28
|
end
|
29
29
|
|
30
30
|
def present?
|
data/lib/deba.rb
CHANGED
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brenton "B-Train" Fletcher
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: nokogiri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.7'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1.7'
|
55
55
|
description: Deba takes a HTML document or fragment and extracts the text content
|
56
56
|
into a plaintext format that is a strict subset of markdown.
|
57
57
|
email:
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- deba.gemspec
|
71
71
|
- lib/deba.rb
|
72
72
|
- lib/deba/break.rb
|
73
|
+
- lib/deba/document.rb
|
73
74
|
- lib/deba/extractor.rb
|
74
75
|
- lib/deba/heading.rb
|
75
76
|
- lib/deba/paragraph.rb
|