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 +13 -15
- data/kitabu.gemspec +0 -1
- data/lib/kitabu.rb +0 -1
- data/lib/kitabu/extensions/redcloth.rb +9 -5
- data/lib/kitabu/stream.rb +1 -1
- data/lib/kitabu/toc/html.rb +1 -1
- data/lib/kitabu/version.rb +1 -1
- data/spec/kitabu/extensions/redcloth_spec.rb +5 -0
- data/spec/kitabu/toc/html_spec.rb +2 -0
- data/templates/Guardfile +5 -1
- metadata +2 -18
data/Gemfile.lock
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kitabu (1.0.
|
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.
|
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.
|
34
|
-
nokogiri (1.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.
|
38
|
+
pry-nav (0.2.3)
|
41
39
|
pry (~> 0.9.10)
|
42
|
-
rake (0.
|
40
|
+
rake (10.0.3)
|
43
41
|
rdiscount (1.6.8)
|
44
|
-
rspec (2.
|
45
|
-
rspec-core (~> 2.
|
46
|
-
rspec-expectations (~> 2.
|
47
|
-
rspec-mocks (~> 2.
|
48
|
-
rspec-core (2.
|
49
|
-
rspec-expectations (2.
|
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.
|
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
data/lib/kitabu.rb
CHANGED
@@ -7,15 +7,19 @@ module RedCloth
|
|
7
7
|
|
8
8
|
module Inline
|
9
9
|
FN_RE = /
|
10
|
-
(\s+)?
|
11
|
-
|
12
|
-
(.*?)
|
13
|
-
\}#
|
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
|
-
|
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
data/lib/kitabu/toc/html.rb
CHANGED
@@ -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
|
|
data/lib/kitabu/version.rb
CHANGED
@@ -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
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.
|
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:
|
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
|