fnando-kitabu 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/kitabu.gemspec +2 -2
- data/lib/kitabu/base.rb +3 -2
- data/lib/kitabu/blackcloth.rb +2 -1
- data/lib/kitabu/markup.rb +5 -1
- data/lib/kitabu.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.8
|
data/kitabu.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{kitabu}
|
5
|
-
s.version = "0.3.
|
5
|
+
s.version = "0.3.8"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Nando Vieira"]
|
9
|
-
s.date = %q{2009-08-
|
9
|
+
s.date = %q{2009-08-14}
|
10
10
|
s.default_executable = %q{kitabu}
|
11
11
|
s.description = %q{A framework for creating e-books from Markdown/Textile text markup using Ruby.
|
12
12
|
Using the Prince PDF generator, you'll be able to get high quality PDFs.
|
data/lib/kitabu/base.rb
CHANGED
@@ -113,6 +113,7 @@ module Kitabu
|
|
113
113
|
begin
|
114
114
|
if markup_file =~ /\.textile$/
|
115
115
|
markup = BlackCloth.new(markup_contents)
|
116
|
+
markup.no_span_caps = true
|
116
117
|
else
|
117
118
|
markup = markdown_processor_class.new(markup_contents)
|
118
119
|
end
|
@@ -129,7 +130,7 @@ module Kitabu
|
|
129
130
|
# textile
|
130
131
|
parsed_contents.gsub!(/@syntax:([0-9]+)/m) do |m|
|
131
132
|
syntax, code = markup.syntax_blocks[$1.to_i]
|
132
|
-
Kitabu::Markup.syntax(code, syntax)
|
133
|
+
Kitabu::Markup.syntax(code, syntax, :textile)
|
133
134
|
end
|
134
135
|
else
|
135
136
|
# markdown
|
@@ -164,7 +165,7 @@ module Kitabu
|
|
164
165
|
})
|
165
166
|
end
|
166
167
|
|
167
|
-
Kitabu::Markup.syntax(code, syntax)
|
168
|
+
Kitabu::Markup.syntax(code, syntax, :markdown)
|
168
169
|
end
|
169
170
|
end
|
170
171
|
end
|
data/lib/kitabu/blackcloth.rb
CHANGED
@@ -82,6 +82,7 @@ class BlackCloth < RedCloth
|
|
82
82
|
:from_line => from_line,
|
83
83
|
:to_line => to_line
|
84
84
|
})
|
85
|
+
|
85
86
|
@@syntax_blocks << [syntax, content]
|
86
87
|
position = @@syntax_blocks.size - 1
|
87
88
|
%(@syntax:#{position})
|
@@ -169,7 +170,7 @@ class BlackCloth < RedCloth
|
|
169
170
|
retrieve text
|
170
171
|
|
171
172
|
text.gsub!( /<\/?notextile>/, '' )
|
172
|
-
text.gsub!( /x%x
|
173
|
+
text.gsub!( /x%x%/sm, '&' )
|
173
174
|
clean_html text if filter_html
|
174
175
|
text.strip!
|
175
176
|
text
|
data/lib/kitabu/markup.rb
CHANGED
@@ -46,14 +46,18 @@ module Kitabu
|
|
46
46
|
code
|
47
47
|
end
|
48
48
|
|
49
|
-
def syntax(code, syntax
|
49
|
+
def syntax(code, syntax, processor)
|
50
50
|
# get chosen theme
|
51
51
|
theme = Kitabu::Base.config['theme']
|
52
52
|
theme = Kitabu::Base.default_theme unless Kitabu::Base.theme?(theme)
|
53
53
|
|
54
|
+
syntax = "plain_text" if syntax.to_s =~ /^\s*$/
|
55
|
+
|
54
56
|
# get syntax
|
55
57
|
syntax = Kitabu::Base.default_syntax unless Kitabu::Base.syntax?(syntax)
|
56
58
|
|
59
|
+
code.gsub!(/x%x%/sm, "&") if processor == :textile
|
60
|
+
|
57
61
|
code = Uv.parse(code, "xhtml", syntax, false, theme)
|
58
62
|
code.gsub!(/<pre class="(.*?)"/sim, %(<pre class="\\1 #{syntax}"))
|
59
63
|
code.gsub!(/<pre>/sim, %(<pre class="#{syntax} #{theme}"))
|
data/lib/kitabu.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fnando-kitabu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-14 00:00:00 -07:00
|
13
13
|
default_executable: kitabu
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|