tilt 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/TEMPLATES.md +2 -0
- data/lib/tilt.rb +1 -1
- data/lib/tilt/css.rb +2 -3
- data/lib/tilt/nokogiri.rb +1 -1
- data/test/tilt_markdown_test.rb +5 -6
- data/test/tilt_nokogiritemplate_test.rb +11 -0
- data/test/tilt_redcarpettemplate_test.rb +1 -1
- data/test/tilt_sasstemplate_test.rb +0 -12
- data/tilt.gemspec +3 -2
- metadata +18 -4
data/TEMPLATES.md
CHANGED
@@ -40,6 +40,7 @@ implementations (depending on which are available on your system):
|
|
40
40
|
|
41
41
|
* [Markdown](#markdown) - Generic Markdown implementation
|
42
42
|
* [RDiscount](#rdiscount) - `Tilt::RDiscountTemplate`
|
43
|
+
* Redcarpet - `Tilt::RedcarpetTemplate`
|
43
44
|
* BlueCloth - `Tilt::BlueClothTemplate`
|
44
45
|
* Kramdown - `Tilt::KramdownTemplate`
|
45
46
|
* Maruku - `Tilt::MarukuTemplate`
|
@@ -427,6 +428,7 @@ formatted texts are readable.
|
|
427
428
|
Markdown formatted texts are converted to HTML with one of these libraries:
|
428
429
|
|
429
430
|
* [RDiscount](#rdiscount) - `Tilt::RDiscountTemplate`
|
431
|
+
* Redcarpet - `Tilt::RedcarpetTemplate`
|
430
432
|
* BlueCloth - `Tilt::BlueClothTemplate`
|
431
433
|
* Kramdown - `Tilt::KramdownTemplate`
|
432
434
|
* Maruku - `Tilt::MarukuTemplate`
|
data/lib/tilt.rb
CHANGED
data/lib/tilt/css.rb
CHANGED
@@ -9,16 +9,15 @@ module Tilt
|
|
9
9
|
self.default_mime_type = 'text/css'
|
10
10
|
|
11
11
|
def self.engine_initialized?
|
12
|
-
defined?
|
12
|
+
defined? ::Sass::Engine
|
13
13
|
end
|
14
14
|
|
15
15
|
def initialize_engine
|
16
16
|
require_template_library 'sass'
|
17
|
-
require_template_library 'sass/plugin'
|
18
17
|
end
|
19
18
|
|
20
19
|
def prepare
|
21
|
-
@engine = ::Sass::Engine.new(data,
|
20
|
+
@engine = ::Sass::Engine.new(data, sass_options)
|
22
21
|
end
|
23
22
|
|
24
23
|
def evaluate(scope, locals, &block)
|
data/lib/tilt/nokogiri.rb
CHANGED
data/test/tilt_markdown_test.rb
CHANGED
@@ -36,6 +36,9 @@ module MarkdownTests
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_escape_html_true
|
39
|
+
if self.class.template == Tilt::RedcarpetTemplate
|
40
|
+
flunk "redcarpet doesn't support :escape_html yet"
|
41
|
+
end
|
39
42
|
html = nrender "Hello <b>World</b>", :escape_html => true
|
40
43
|
assert_equal "<p>Hello <b>World</b></p>", html
|
41
44
|
end
|
@@ -66,12 +69,8 @@ module MarkdownTests
|
|
66
69
|
end
|
67
70
|
|
68
71
|
def test_smarty_pants_true
|
69
|
-
|
70
|
-
|
71
|
-
else
|
72
|
-
html = nrender "Hello ``World'' -- This is --- a test ...", :smartypants => true
|
73
|
-
assert_equal "<p>Hello “World” — This is —– a test …</p>", html
|
74
|
-
end
|
72
|
+
html = nrender "Hello ``World'' -- This is --- a test ...", :smartypants => true
|
73
|
+
assert_equal "<p>Hello “World” — This is —– a test …</p>", html
|
75
74
|
end
|
76
75
|
end
|
77
76
|
|
@@ -70,6 +70,17 @@ begin
|
|
70
70
|
assert_equal 'strong', doc.root.name
|
71
71
|
end
|
72
72
|
end
|
73
|
+
|
74
|
+
test "doesn't modify self when template is a string" do
|
75
|
+
template = Tilt::NokogiriTemplate.new { "xml.root { xml.child @hello }" }
|
76
|
+
scope = Object.new
|
77
|
+
scope.instance_variable_set(:@hello, "Hello World!")
|
78
|
+
|
79
|
+
3.times do
|
80
|
+
doc = Nokogiri.XML(template.render(scope))
|
81
|
+
assert_equal "Hello World!", doc.text.strip
|
82
|
+
end
|
83
|
+
end
|
73
84
|
end
|
74
85
|
rescue LoadError
|
75
86
|
warn "Tilt::NokogiriTemplate (disabled)"
|
@@ -47,7 +47,7 @@ begin
|
|
47
47
|
test "stripping HTML when :filter_html is set" do
|
48
48
|
template = Tilt::RedcarpetTemplate.new(:filter_html => true) { |t|
|
49
49
|
"HELLO <blink>WORLD</blink>" }
|
50
|
-
assert_equal "<p>HELLO
|
50
|
+
assert_equal "<p>HELLO WORLD</p>\n", template.render
|
51
51
|
end
|
52
52
|
end
|
53
53
|
rescue LoadError => boom
|
@@ -2,7 +2,6 @@ require 'contest'
|
|
2
2
|
require 'tilt'
|
3
3
|
|
4
4
|
begin
|
5
|
-
require 'haml'
|
6
5
|
require 'sass'
|
7
6
|
|
8
7
|
class SassTemplateTest < Test::Unit::TestCase
|
@@ -19,17 +18,6 @@ begin
|
|
19
18
|
template = Tilt::SassTemplate.new { |t| "#main\n :background-color #0000f1" }
|
20
19
|
3.times { assert_equal "#main {\n background-color: #0000f1; }\n", template.render }
|
21
20
|
end
|
22
|
-
|
23
|
-
test "uses configuration from Sass::Plugin.engine_options" do
|
24
|
-
begin
|
25
|
-
orig_style = Sass::Plugin.options[:style]
|
26
|
-
Sass::Plugin.options[:style] = :compressed
|
27
|
-
template = Tilt::SassTemplate.new { |t| "#main\n :background-color #0000f1" }
|
28
|
-
assert_equal "#main{background-color:#0000f1}\n", template.render
|
29
|
-
ensure
|
30
|
-
Sass::Plugin.options[:style] = orig_style
|
31
|
-
end
|
32
|
-
end
|
33
21
|
end
|
34
22
|
|
35
23
|
class ScssTemplateTest < Test::Unit::TestCase
|
data/tilt.gemspec
CHANGED
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
4
4
|
|
5
5
|
s.name = 'tilt'
|
6
|
-
s.version = '1.3.
|
7
|
-
s.date = '2011-05-
|
6
|
+
s.version = '1.3.2'
|
7
|
+
s.date = '2011-05-26'
|
8
8
|
|
9
9
|
s.description = "Generic interface to multiple Ruby template engines"
|
10
10
|
s.summary = s.description
|
@@ -90,6 +90,7 @@ Gem::Specification.new do |s|
|
|
90
90
|
s.add_development_dependency 'maruku'
|
91
91
|
s.add_development_dependency 'creole'
|
92
92
|
s.add_development_dependency 'kramdown'
|
93
|
+
s.add_development_dependency 'redcarpet'
|
93
94
|
|
94
95
|
s.homepage = "http://github.com/rtomayko/tilt/"
|
95
96
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Tilt", "--main", "Tilt"]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tilt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 2
|
10
|
+
version: 1.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Tomayko
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-26 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -244,6 +244,20 @@ dependencies:
|
|
244
244
|
version: "0"
|
245
245
|
type: :development
|
246
246
|
version_requirements: *id016
|
247
|
+
- !ruby/object:Gem::Dependency
|
248
|
+
name: redcarpet
|
249
|
+
prerelease: false
|
250
|
+
requirement: &id017 !ruby/object:Gem::Requirement
|
251
|
+
none: false
|
252
|
+
requirements:
|
253
|
+
- - ">="
|
254
|
+
- !ruby/object:Gem::Version
|
255
|
+
hash: 3
|
256
|
+
segments:
|
257
|
+
- 0
|
258
|
+
version: "0"
|
259
|
+
type: :development
|
260
|
+
version_requirements: *id017
|
247
261
|
description: Generic interface to multiple Ruby template engines
|
248
262
|
email: r@tomayko.com
|
249
263
|
executables:
|