kitabu 1.0.1 → 1.0.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/Gemfile.lock CHANGED
@@ -1,13 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kitabu (1.0.1)
4
+ kitabu (1.0.2)
5
5
  RedCloth
6
6
  activesupport
7
7
  coderay
8
8
  eeepub-with-cover-support
9
9
  i18n
10
- listen
11
10
  nokogiri
12
11
  notifier
13
12
  rdiscount
@@ -17,7 +16,7 @@ GEM
17
16
  remote: http://rubygems.org/
18
17
  specs:
19
18
  RedCloth (4.2.9)
20
- activesupport (3.2.8)
19
+ activesupport (3.2.11)
21
20
  i18n (~> 0.6)
22
21
  multi_json (~> 1.0)
23
22
  awesome_print (1.1.0)
@@ -28,27 +27,26 @@ GEM
28
27
  builder
29
28
  rubyzip
30
29
  i18n (0.6.1)
31
- listen (0.5.3)
32
30
  method_source (0.8.1)
33
- multi_json (1.3.7)
34
- nokogiri (1.5.5)
31
+ multi_json (1.5.0)
32
+ nokogiri (1.5.6)
35
33
  notifier (0.4.1)
36
34
  pry (0.9.10)
37
35
  coderay (~> 1.0.5)
38
36
  method_source (~> 0.8)
39
37
  slop (~> 3.3.1)
40
- pry-nav (0.2.2)
38
+ pry-nav (0.2.3)
41
39
  pry (~> 0.9.10)
42
- rake (0.9.2.2)
40
+ rake (10.0.3)
43
41
  rdiscount (1.6.8)
44
- rspec (2.11.0)
45
- rspec-core (~> 2.11.0)
46
- rspec-expectations (~> 2.11.0)
47
- rspec-mocks (~> 2.11.0)
48
- rspec-core (2.11.1)
49
- rspec-expectations (2.11.3)
42
+ rspec (2.12.0)
43
+ rspec-core (~> 2.12.0)
44
+ rspec-expectations (~> 2.12.0)
45
+ rspec-mocks (~> 2.12.0)
46
+ rspec-core (2.12.2)
47
+ rspec-expectations (2.12.1)
50
48
  diff-lcs (~> 1.1.3)
51
- rspec-mocks (2.11.3)
49
+ rspec-mocks (2.12.1)
52
50
  rubyzip (0.9.9)
53
51
  slop (3.3.3)
54
52
  test_notifier (1.0.1)
data/kitabu.gemspec CHANGED
@@ -28,7 +28,6 @@ Gem::Specification.new do |s|
28
28
  s.add_dependency "eeepub-with-cover-support"
29
29
  s.add_dependency "coderay"
30
30
  s.add_dependency "notifier"
31
- s.add_dependency "listen"
32
31
 
33
32
  s.add_development_dependency "rspec"
34
33
  s.add_development_dependency "test_notifier"
data/lib/kitabu.rb CHANGED
@@ -13,7 +13,6 @@ require "tempfile"
13
13
  require "pathname"
14
14
  require "thor"
15
15
  require "thor/group"
16
- require "listen"
17
16
  require "yaml"
18
17
  require "cgi"
19
18
 
@@ -7,15 +7,19 @@ module RedCloth
7
7
 
8
8
  module Inline
9
9
  FN_RE = /
10
- (\s+)? # getting spaces
11
- %\{ # opening
12
- (.*?) # footnote
13
- \}# # closing
10
+ (\s+)? # getting spaces
11
+ (\\)?%\{ # opening
12
+ (.*?) # footnote
13
+ \}# # closing
14
14
  /xm
15
15
 
16
16
  def footnote(text)
17
17
  text.gsub!(FN_RE) do |m|
18
- %(<span class="footnote">#{$2}</span>)
18
+ if $2
19
+ %[#{$1}%{#{$3}}]
20
+ else
21
+ %(<span class="footnote">#{$3}</span>)
22
+ end
19
23
  end
20
24
  end
21
25
 
data/lib/kitabu/stream.rb CHANGED
@@ -21,7 +21,7 @@ module Kitabu
21
21
  end
22
22
 
23
23
  def emit(node)
24
- listener.send(:tag, node) if node.name =~ /h[2-6]/
24
+ listener.send(:tag, node) if node.name =~ /h[1-6]/
25
25
  end
26
26
  end
27
27
  end
@@ -16,7 +16,7 @@ module Kitabu
16
16
  def self.normalize(content)
17
17
  counter = {}
18
18
  html = Nokogiri::HTML.parse(content)
19
- html.search("h2, h3, h4, h5, h6").each do |tag|
19
+ html.search("h1, h2, h3, h4, h5, h6").each do |tag|
20
20
  title = tag.inner_text
21
21
  permalink = title.to_permalink
22
22
 
@@ -2,7 +2,7 @@ module Kitabu
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- PATCH = 1
5
+ PATCH = 2
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -41,6 +41,11 @@ describe RedCloth do
41
41
  html = RedCloth.convert("Writing some text with a footnote %{this is a footnote}")
42
42
  html.should == %[<p>Writing some text with a footnote<span class="footnote">this is a footnote</span></p>]
43
43
  end
44
+
45
+ it "ignores escaped notations" do
46
+ html = RedCloth.convert("It must skip \\%{this}")
47
+ html.should == %[<p>It must skip %{this}</p>]
48
+ end
44
49
  end
45
50
 
46
51
  context "custom url helper" do
@@ -26,6 +26,7 @@ describe Kitabu::TOC::HTML do
26
26
  end
27
27
 
28
28
  it "generates toc" do
29
+ html.should have_tag("div.level1.item-1", "Item 1")
29
30
  html.should have_tag("div.level2.item-1-2", "Item 1.2")
30
31
  html.should have_tag("div.level3.item-1-1-3", "Item 1.1.3")
31
32
  html.should have_tag("div.level4.item-1-1-1-4", "Item 1.1.1.4")
@@ -39,6 +40,7 @@ describe Kitabu::TOC::HTML do
39
40
  end
40
41
 
41
42
  it "adds id attribute to content" do
43
+ content.should have_tag("h1#item-1", "Item 1")
42
44
  content.should have_tag("h2#item-1-2", "Item 1.2")
43
45
  content.should have_tag("h3#item-1-1-3", "Item 1.1.3")
44
46
  content.should have_tag("h4#item-1-1-1-4", "Item 1.1.1.4")
data/templates/Guardfile CHANGED
@@ -2,7 +2,11 @@ notification :off
2
2
  interactor :off
3
3
 
4
4
  guard :shell do
5
- watch %r[^(?!output)] do |m|
5
+ watch %r[^(?!output|templates/scss)] do |m|
6
6
  `kitabu export`
7
7
  end
8
+
9
+ watch %r[^templates/scss] do |m|
10
+ `sass --unix-newlines templates/scss:templates`
11
+ end
8
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitabu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-05 00:00:00.000000000 Z
12
+ date: 2013-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -155,22 +155,6 @@ dependencies:
155
155
  - - ! '>='
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
- - !ruby/object:Gem::Dependency
159
- name: listen
160
- requirement: !ruby/object:Gem::Requirement
161
- none: false
162
- requirements:
163
- - - ! '>='
164
- - !ruby/object:Gem::Version
165
- version: '0'
166
- type: :runtime
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
- requirements:
171
- - - ! '>='
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
158
  - !ruby/object:Gem::Dependency
175
159
  name: rspec
176
160
  requirement: !ruby/object:Gem::Requirement