invisiblellama-repub 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +25 -9
- data/README.rdoc +46 -40
- data/Rakefile +1 -0
- data/bin/repub +1 -1
- data/lib/repub.rb +1 -1
- data/lib/repub/app.rb +3 -3
- data/lib/repub/app/builder.rb +84 -36
- data/lib/repub/app/fetcher.rb +13 -11
- data/lib/repub/app/options.rb +36 -5
- data/lib/repub/app/parser.rb +1 -1
- data/lib/repub/app/profile.rb +16 -15
- data/lib/repub/epub/container.rb +28 -28
- data/lib/repub/epub/content.rb +59 -34
- data/lib/repub/epub/toc.rb +139 -139
- data/repub.gemspec +3 -3
- data/test/data/custom.css +3 -0
- data/test/data/invisiblellama.png +0 -0
- data/test/data/test.css +5 -0
- data/test/data/test.html +60 -0
- data/test/epub/test_container.rb +4 -4
- data/test/epub/test_content.rb +42 -38
- data/test/epub/test_toc.rb +19 -7
- data/test/test_builder.rb +145 -1
- data/test/test_fetcher.rb +79 -20
- data/test/test_parser.rb +45 -32
- metadata +6 -2
data/test/test_parser.rb
CHANGED
@@ -1,32 +1,45 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'repub'
|
3
|
-
require 'repub/app'
|
4
|
-
|
5
|
-
class TestParser < Test::Unit::TestCase
|
6
|
-
|
7
|
-
include Repub::App::Fetcher
|
8
|
-
include Repub::App::Parser
|
9
|
-
attr_reader :options
|
10
|
-
|
11
|
-
def
|
12
|
-
@
|
13
|
-
|
14
|
-
:
|
15
|
-
# :
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
1
|
+
require 'test/unit'
|
2
|
+
require 'repub'
|
3
|
+
require 'repub/app'
|
4
|
+
|
5
|
+
class TestParser < Test::Unit::TestCase
|
6
|
+
|
7
|
+
include Repub::App::Fetcher
|
8
|
+
include Repub::App::Parser
|
9
|
+
attr_reader :options
|
10
|
+
|
11
|
+
def setup
|
12
|
+
@url = 'file://' + File.expand_path(File.join(File.dirname(__FILE__), 'data/test.html'))
|
13
|
+
@options = {
|
14
|
+
:url => @url,
|
15
|
+
# NOTE: cannot test with wget because it doesn't support file:// schema
|
16
|
+
:helper => 'httrack',
|
17
|
+
:selectors => {
|
18
|
+
:title => '//h1',
|
19
|
+
:toc => '//ul',
|
20
|
+
:toc_item => './li',
|
21
|
+
:toc_section => './ul'
|
22
|
+
}
|
23
|
+
}
|
24
|
+
Cache.cleanup
|
25
|
+
end
|
26
|
+
|
27
|
+
def teardown
|
28
|
+
Cache.cleanup
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_parser
|
32
|
+
cache = fetch
|
33
|
+
parser = parse(cache)
|
34
|
+
assert_equal('8b8d358cf1ada41d4fee885a47530296528dc235', parser.uid)
|
35
|
+
assert_equal('Lorem Ipsum', parser.title)
|
36
|
+
assert_equal(3, parser.toc.size)
|
37
|
+
assert_equal('Chapter 1', parser.toc[0].title)
|
38
|
+
assert_equal('Chapter 3', parser.toc[2].title)
|
39
|
+
assert_equal(2, parser.toc[0].subitems.size)
|
40
|
+
assert_equal('Chapter 1.2', parser.toc[0].subitems[1].title)
|
41
|
+
assert_equal(cache.assets[:documents][0], parser.toc[0].subitems[1].uri)
|
42
|
+
assert_equal('c12', parser.toc[0].subitems[1].fragment_id)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invisiblellama-repub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitri Goutnik
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-07-05 00:00:00 -07:00
|
13
13
|
default_executable: repub
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -92,6 +92,10 @@ files:
|
|
92
92
|
- lib/repub/epub/content.rb
|
93
93
|
- lib/repub/epub/toc.rb
|
94
94
|
- repub.gemspec
|
95
|
+
- test/data/custom.css
|
96
|
+
- test/data/invisiblellama.png
|
97
|
+
- test/data/test.css
|
98
|
+
- test/data/test.html
|
95
99
|
- test/epub/test_container.rb
|
96
100
|
- test/epub/test_content.rb
|
97
101
|
- test/epub/test_toc.rb
|