gepub 0.4.1 → 0.4.2
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.
- data/VERSION +1 -1
- data/gepub.gemspec +2 -2
- data/lib/gepub/book.rb +8 -3
- data/lib/gepub/gepuber.rb +8 -1
- data/spec/gepuber_spec.rb +2 -1
- metadata +2 -2
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.2
|
data/gepub.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{gepub}
|
|
8
|
-
s.version = "0.4.
|
|
8
|
+
s.version = "0.4.2"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["KOJIMA Satoshi"]
|
|
12
|
-
s.date = %q{2011-
|
|
12
|
+
s.date = %q{2011-06-13}
|
|
13
13
|
s.description = %q{an easy-to-use (and easy-to-implement) EPUB generator.}
|
|
14
14
|
s.email = %q{skoji@skoji.jp}
|
|
15
15
|
s.executables = ["gepuber"]
|
data/lib/gepub/book.rb
CHANGED
|
@@ -71,8 +71,8 @@ module GEPUB
|
|
|
71
71
|
item
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
-
def add_nav(item, text)
|
|
75
|
-
@toc.push({ :item => item, :text => text})
|
|
74
|
+
def add_nav(item, text, id = nil)
|
|
75
|
+
@toc.push({ :item => item, :text => text, :id => id})
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def specify_cover_image(item)
|
|
@@ -223,7 +223,12 @@ EOF
|
|
|
223
223
|
nav_label << XML::Node.new('text', "#{x[:text]}")
|
|
224
224
|
|
|
225
225
|
nav_content = XML::Node.new('content')
|
|
226
|
-
|
|
226
|
+
if x[:id].nil?
|
|
227
|
+
nav_content['src'] = "#{x[:item].href}"
|
|
228
|
+
else
|
|
229
|
+
nav_content['src'] = "#{x[:item].href}##{x[:id]}"
|
|
230
|
+
end
|
|
231
|
+
|
|
227
232
|
count = count + 1
|
|
228
233
|
|
|
229
234
|
nav_map << nav_point
|
data/lib/gepub/gepuber.rb
CHANGED
|
@@ -40,7 +40,14 @@ module GEPUB
|
|
|
40
40
|
|f, fio|
|
|
41
41
|
item = add_item(f, fio)
|
|
42
42
|
@spine << item
|
|
43
|
-
|
|
43
|
+
if !@table_of_contents[f].nil?
|
|
44
|
+
add_nav(item, @table_of_contents[f])
|
|
45
|
+
@table_of_contents.each {
|
|
46
|
+
|k,v|
|
|
47
|
+
k =~ /^#{@table_of_contents[f]}#(.?)$/
|
|
48
|
+
add_nav(item, @table_of_contents[f], $1) unless $1.nil?
|
|
49
|
+
}
|
|
50
|
+
end
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
@provider.new(@resources).each {
|
data/spec/gepuber_spec.rb
CHANGED
|
@@ -28,6 +28,7 @@ describe GEPUB::Gepuber do
|
|
|
28
28
|
table_of_contents: {
|
|
29
29
|
'1_.html' => '1st toc',
|
|
30
30
|
'3_.html' => '3rd toc',
|
|
31
|
+
'3_.html#a1' => '3rd toc 2',
|
|
31
32
|
'9_.html' => 'last toc'
|
|
32
33
|
},
|
|
33
34
|
coverimg: 'cover.gif',
|
|
@@ -44,7 +45,7 @@ describe GEPUB::Gepuber do
|
|
|
44
45
|
gepuber.identifier.should == 'http://skoji.jp/gepuber/2011-03-11.0.0'
|
|
45
46
|
gepuber.epubname.should == 'gepub_00'
|
|
46
47
|
gepuber.coverimg.should == 'cover.gif'
|
|
47
|
-
gepuber.table_of_contents.should == { '1_.html' => '1st toc', '3_.html' => '3rd toc',
|
|
48
|
+
gepuber.table_of_contents.should == { '1_.html' => '1st toc', '3_.html' => '3rd toc', '3_.html#a1' => '3rd toc 2','9_.html' => 'last toc'}
|
|
48
49
|
gepuber.texts.should == ['*.html']
|
|
49
50
|
gepuber.resources.should == ['*.css', '*.gif']
|
|
50
51
|
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: gepub
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.4.
|
|
5
|
+
version: 0.4.2
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- KOJIMA Satoshi
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2011-
|
|
13
|
+
date: 2011-06-13 00:00:00 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: libxml-ruby
|