kitabu 1.0.0.rc4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +6 -6
- data/README.rdoc +1 -1
- data/kitabu.gemspec +1 -2
- data/lib/kitabu.rb +2 -1
- data/lib/kitabu/cli.rb +0 -1
- data/lib/kitabu/exporter.rb +1 -19
- data/lib/kitabu/generator.rb +4 -0
- data/lib/kitabu/parser/html.rb +4 -4
- data/lib/kitabu/parser/pdf.rb +1 -1
- data/lib/kitabu/version.rb +1 -1
- data/spec/support/shared.rb +4 -0
- data/templates/Guardfile +8 -0
- metadata +13 -28
data/Gemfile.lock
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kitabu (1.0.0
|
4
|
+
kitabu (1.0.0)
|
5
5
|
RedCloth
|
6
6
|
activesupport
|
7
7
|
coderay
|
8
8
|
eeepub-with-cover-support
|
9
9
|
i18n
|
10
10
|
nokogiri
|
11
|
-
notifier
|
12
11
|
rdiscount
|
13
12
|
thor
|
14
|
-
watchr
|
15
13
|
|
16
14
|
GEM
|
17
15
|
remote: http://rubygems.org/
|
@@ -21,13 +19,13 @@ GEM
|
|
21
19
|
i18n (~> 0.6)
|
22
20
|
multi_json (~> 1.0)
|
23
21
|
awesome_print (1.0.2)
|
24
|
-
builder (3.
|
22
|
+
builder (3.1.3)
|
25
23
|
coderay (1.0.7)
|
26
24
|
diff-lcs (1.1.3)
|
27
25
|
eeepub-with-cover-support (0.8.7)
|
28
26
|
builder
|
29
27
|
rubyzip
|
30
|
-
i18n (0.6.
|
28
|
+
i18n (0.6.1)
|
31
29
|
method_source (0.8)
|
32
30
|
multi_json (1.3.6)
|
33
31
|
nokogiri (1.5.5)
|
@@ -36,6 +34,8 @@ GEM
|
|
36
34
|
coderay (~> 1.0.5)
|
37
35
|
method_source (~> 0.8)
|
38
36
|
slop (~> 3.3.1)
|
37
|
+
pry-nav (0.2.2)
|
38
|
+
pry (~> 0.9.10)
|
39
39
|
rake (0.9.2.2)
|
40
40
|
rdiscount (1.6.8)
|
41
41
|
rspec (2.11.0)
|
@@ -51,7 +51,6 @@ GEM
|
|
51
51
|
test_notifier (1.0.0)
|
52
52
|
notifier
|
53
53
|
thor (0.16.0)
|
54
|
-
watchr (0.7)
|
55
54
|
|
56
55
|
PLATFORMS
|
57
56
|
ruby
|
@@ -60,6 +59,7 @@ DEPENDENCIES
|
|
60
59
|
awesome_print
|
61
60
|
kitabu!
|
62
61
|
pry
|
62
|
+
pry-nav
|
63
63
|
rake
|
64
64
|
rspec
|
65
65
|
test_notifier
|
data/README.rdoc
CHANGED
@@ -15,7 +15,7 @@ While Prince is too expensive (495USD for a single user license), the free versi
|
|
15
15
|
To install Kitabu, you’ll need a working Ruby 1.9+ installation.
|
16
16
|
If you’re cool with it, just run the following command to install it.
|
17
17
|
|
18
|
-
gem install kitabu
|
18
|
+
gem install kitabu
|
19
19
|
|
20
20
|
After installing Kitabu, run the following command to check your external
|
21
21
|
dependencies.
|
data/kitabu.gemspec
CHANGED
@@ -26,13 +26,12 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_dependency "i18n"
|
27
27
|
s.add_dependency "thor"
|
28
28
|
s.add_dependency "eeepub-with-cover-support"
|
29
|
-
s.add_dependency "watchr"
|
30
|
-
s.add_dependency "notifier"
|
31
29
|
s.add_dependency "coderay"
|
32
30
|
|
33
31
|
s.add_development_dependency "rspec"
|
34
32
|
s.add_development_dependency "test_notifier"
|
35
33
|
s.add_development_dependency "rake"
|
36
34
|
s.add_development_dependency "pry"
|
35
|
+
s.add_development_dependency "pry-nav"
|
37
36
|
s.add_development_dependency "awesome_print"
|
38
37
|
end
|
data/lib/kitabu.rb
CHANGED
data/lib/kitabu/cli.rb
CHANGED
@@ -26,7 +26,6 @@ module Kitabu
|
|
26
26
|
|
27
27
|
desc "export [OPTIONS]", "Export e-book"
|
28
28
|
method_option :only, :type => :string, :desc => "Can be one of: #{FORMATS.join(", ")}"
|
29
|
-
method_option :auto, :type => :boolean, :desc => "Watch changes and automatically export files"
|
30
29
|
method_option :open, :type => :boolean, :desc => "Automatically open PDF (Mac OS X only)"
|
31
30
|
|
32
31
|
def export
|
data/lib/kitabu/exporter.rb
CHANGED
@@ -2,13 +2,7 @@ module Kitabu
|
|
2
2
|
class Exporter
|
3
3
|
def self.run(root_dir, options)
|
4
4
|
exporter = new(root_dir, options)
|
5
|
-
|
6
|
-
if options[:auto]
|
7
|
-
exporter.export!
|
8
|
-
exporter.auto! if options[:auto]
|
9
|
-
else
|
10
|
-
exporter.export!
|
11
|
-
end
|
5
|
+
exporter.export!
|
12
6
|
end
|
13
7
|
|
14
8
|
attr_accessor :root_dir
|
@@ -64,17 +58,5 @@ module Kitabu
|
|
64
58
|
def config
|
65
59
|
Kitabu.config(root_dir)
|
66
60
|
end
|
67
|
-
|
68
|
-
def auto!
|
69
|
-
script = Watchr::Script.new
|
70
|
-
|
71
|
-
script.watch(%r[(code|config|images|templates|text)/.*]) do |match|
|
72
|
-
ui.say "* #{match[0]}... ", :yellow, false
|
73
|
-
export!
|
74
|
-
end
|
75
|
-
|
76
|
-
contrl = Watchr::Controller.new(script, Watchr.handler.new)
|
77
|
-
contrl.run
|
78
|
-
end
|
79
61
|
end
|
80
62
|
end
|
data/lib/kitabu/generator.rb
CHANGED
data/lib/kitabu/parser/html.rb
CHANGED
@@ -123,18 +123,18 @@ module Kitabu
|
|
123
123
|
index = self.class.footnote_index
|
124
124
|
actual_index = fn["id"].gsub(/[^\d]/, "")
|
125
125
|
|
126
|
-
fn.set_attribute("id", "
|
126
|
+
fn.set_attribute("id", "_fn#{index}")
|
127
127
|
|
128
128
|
html.css("a[href='#fn#{actual_index}']").each do |link|
|
129
|
-
link.set_attribute("href", "#
|
129
|
+
link.set_attribute("href", "#_fn#{index}")
|
130
130
|
end
|
131
131
|
|
132
132
|
html.css("a[href='#fnr#{actual_index}']").each do |link|
|
133
|
-
link.set_attribute("href", "#
|
133
|
+
link.set_attribute("href", "#_fnr#{index}")
|
134
134
|
end
|
135
135
|
|
136
136
|
html.css("[id=fnr#{actual_index}]").each do |tag|
|
137
|
-
tag.set_attribute("id", "
|
137
|
+
tag.set_attribute("id", "_fnr#{index}")
|
138
138
|
end
|
139
139
|
|
140
140
|
self.class.footnote_index += 1
|
data/lib/kitabu/parser/pdf.rb
CHANGED
data/lib/kitabu/version.rb
CHANGED
data/spec/support/shared.rb
CHANGED
@@ -33,6 +33,10 @@ shared_examples_for "e-book" do
|
|
33
33
|
mybook.join("text/01_Welcome.md")
|
34
34
|
end
|
35
35
|
|
36
|
+
it "copies Guardfile" do
|
37
|
+
mybook.join("Guardfile")
|
38
|
+
end
|
39
|
+
|
36
40
|
it "copies html template files" do
|
37
41
|
mybook.join("templates/html/user.css").should be_file
|
38
42
|
mybook.join("templates/html/layout.css").should be_file
|
data/templates/Guardfile
ADDED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitabu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Nando Vieira
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -124,23 +124,7 @@ dependencies:
|
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- - ! '>='
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :runtime
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- - ! '>='
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: notifier
|
127
|
+
name: coderay
|
144
128
|
requirement: !ruby/object:Gem::Requirement
|
145
129
|
none: false
|
146
130
|
requirements:
|
@@ -156,14 +140,14 @@ dependencies:
|
|
156
140
|
- !ruby/object:Gem::Version
|
157
141
|
version: '0'
|
158
142
|
- !ruby/object:Gem::Dependency
|
159
|
-
name:
|
143
|
+
name: rspec
|
160
144
|
requirement: !ruby/object:Gem::Requirement
|
161
145
|
none: false
|
162
146
|
requirements:
|
163
147
|
- - ! '>='
|
164
148
|
- !ruby/object:Gem::Version
|
165
149
|
version: '0'
|
166
|
-
type: :
|
150
|
+
type: :development
|
167
151
|
prerelease: false
|
168
152
|
version_requirements: !ruby/object:Gem::Requirement
|
169
153
|
none: false
|
@@ -172,7 +156,7 @@ dependencies:
|
|
172
156
|
- !ruby/object:Gem::Version
|
173
157
|
version: '0'
|
174
158
|
- !ruby/object:Gem::Dependency
|
175
|
-
name:
|
159
|
+
name: test_notifier
|
176
160
|
requirement: !ruby/object:Gem::Requirement
|
177
161
|
none: false
|
178
162
|
requirements:
|
@@ -188,7 +172,7 @@ dependencies:
|
|
188
172
|
- !ruby/object:Gem::Version
|
189
173
|
version: '0'
|
190
174
|
- !ruby/object:Gem::Dependency
|
191
|
-
name:
|
175
|
+
name: rake
|
192
176
|
requirement: !ruby/object:Gem::Requirement
|
193
177
|
none: false
|
194
178
|
requirements:
|
@@ -204,7 +188,7 @@ dependencies:
|
|
204
188
|
- !ruby/object:Gem::Version
|
205
189
|
version: '0'
|
206
190
|
- !ruby/object:Gem::Dependency
|
207
|
-
name:
|
191
|
+
name: pry
|
208
192
|
requirement: !ruby/object:Gem::Requirement
|
209
193
|
none: false
|
210
194
|
requirements:
|
@@ -220,7 +204,7 @@ dependencies:
|
|
220
204
|
- !ruby/object:Gem::Version
|
221
205
|
version: '0'
|
222
206
|
- !ruby/object:Gem::Dependency
|
223
|
-
name: pry
|
207
|
+
name: pry-nav
|
224
208
|
requirement: !ruby/object:Gem::Requirement
|
225
209
|
none: false
|
226
210
|
requirements:
|
@@ -359,6 +343,7 @@ files:
|
|
359
343
|
- spec/support/mybook/text/TOC.textile
|
360
344
|
- spec/support/mybook/text/_00_Introduction.markdown
|
361
345
|
- spec/support/shared.rb
|
346
|
+
- templates/Guardfile
|
362
347
|
- templates/config.erb
|
363
348
|
- templates/cover.erb
|
364
349
|
- templates/cover.png
|
@@ -387,9 +372,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
387
372
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
388
373
|
none: false
|
389
374
|
requirements:
|
390
|
-
- - ! '
|
375
|
+
- - ! '>='
|
391
376
|
- !ruby/object:Gem::Version
|
392
|
-
version:
|
377
|
+
version: '0'
|
393
378
|
requirements: []
|
394
379
|
rubyforge_project:
|
395
380
|
rubygems_version: 1.8.23
|