pubgen 0.2.0 → 0.2.1
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/README.md +2 -2
- data/Rakefile +8 -8
- data/lib/pubgen/opf.rb +1 -1
- data/lib/pubgen/version.rb +1 -1
- data/lib/pubgen/yaml.rb +5 -5
- metadata +6 -6
data/README.md
CHANGED
@@ -74,7 +74,7 @@ metadata:
|
|
74
74
|
# See http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6
|
75
75
|
#
|
76
76
|
# If you provide cover-image without cover-page, pubgen automatically
|
77
|
-
#
|
77
|
+
# generates cover-page xhtml, and add it to manifest and spine.
|
78
78
|
guide:
|
79
79
|
toc-page:
|
80
80
|
title-page:
|
@@ -87,7 +87,7 @@ guide:
|
|
87
87
|
# See http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.3
|
88
88
|
#
|
89
89
|
# All the file paths in manifest ought to be relative to yaml's path and in the
|
90
|
-
# same or sub-directory of yaml. Say yaml's path is /book/a.yaml.
|
90
|
+
# same or sub-directory of yaml file. Say yaml's path is /book/a.yaml.
|
91
91
|
# - a/b/c.html # good. in the sub-directory
|
92
92
|
# - d.jpg # good. in the same directory
|
93
93
|
# - ./e.jpg # good. in the same directory
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ def sh_echo_off(cmd)
|
|
15
15
|
raise "Failed: #{cmd}" unless $?.success?
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def sh_failure_echo_off(cmd)
|
19
19
|
%x[#{cmd} > /dev/null 2>&1]
|
20
20
|
raise "Not failed: #{cmd}" if $?.success?
|
21
21
|
end
|
@@ -24,13 +24,13 @@ $tmpdir = '.rake_test'
|
|
24
24
|
|
25
25
|
task :test_bad_options => :test_toc_2 do |t|
|
26
26
|
$stdout << "# task: #{t} => "
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
27
|
+
sh_failure_echo_off("bin/pubgen -t x.html -o a.epub")
|
28
|
+
sh_failure_echo_off("bin/pubgen -t x.html -m")
|
29
|
+
sh_failure_echo_off("bin/pubgen -o x.epub -m")
|
30
|
+
sh_failure_echo_off("bin/pubgen")
|
31
|
+
sh_failure_echo_off("bin/pubgen -t x.html")
|
32
|
+
sh_failure_echo_off("bin/pubgen -o")
|
33
|
+
sh_failure_echo_off("bin/pubgen -t")
|
34
34
|
puts "done!"
|
35
35
|
end
|
36
36
|
|
data/lib/pubgen/opf.rb
CHANGED
data/lib/pubgen/version.rb
CHANGED
data/lib/pubgen/yaml.rb
CHANGED
@@ -76,7 +76,7 @@ EOF
|
|
76
76
|
|
77
77
|
# href is relative to index.html, so we need to change it relative to
|
78
78
|
# epub_root
|
79
|
-
abspath = File.
|
79
|
+
abspath = File.expand_path(File.join(File.dirname(toc_html), path))
|
80
80
|
rpath = subpath2basepath(abspath, epub_root)
|
81
81
|
next if rpath == nil
|
82
82
|
# toc paths should be sub-set of manifest
|
@@ -117,11 +117,11 @@ EOF
|
|
117
117
|
return "#{manifest}\n#{spine}\n#{toc}"
|
118
118
|
end
|
119
119
|
|
120
|
-
# Returns relative path of input path to base_pase. It's
|
120
|
+
# Returns the relative path of input path to base_pase. It's private.
|
121
121
|
def self.subpath2basepath(path, base_path)
|
122
|
-
if File.
|
123
|
-
return File.
|
124
|
-
File.
|
122
|
+
if File.expand_path(path).include?(File.expand_path(base_path))
|
123
|
+
return File.expand_path(path)[
|
124
|
+
File.expand_path(base_path).size + 1..-1]
|
125
125
|
else
|
126
126
|
return nil
|
127
127
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-05 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: zipruby
|
16
|
-
requirement: &
|
16
|
+
requirement: &18025420 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *18025420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hpricot
|
27
|
-
requirement: &
|
27
|
+
requirement: &18025000 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *18025000
|
36
36
|
description: Pubgen is a command-line based epub generator. Make an epub with YAML.
|
37
37
|
email:
|
38
38
|
- 9beach@gmail.com
|