Permalink
Browse files

Option support for RedCloth templates

  • Loading branch information...
1 parent 58ca74f commit 252f40a363a83c59a67269324bce5e8fc2709524 @mkeveney mkeveney committed Oct 5, 2012
Showing with 8 additions and 0 deletions.
  1. +1 −0 lib/tilt/textile.rb
  2. +7 −0 test/tilt_redclothtemplate_test.rb
View
@@ -14,6 +14,7 @@ def initialize_engine
def prepare
@engine = RedCloth.new(data)
+ options.each {|k, v| @engine.send("#{k}=", v)}
@output = nil
end
@@ -18,6 +18,13 @@ class RedClothTemplateTest < Test::Unit::TestCase
template = Tilt::RedClothTemplate.new { |t| "h1. Hello World!" }
3.times { assert_equal "<h1>Hello World!</h1>", template.render }
end
+
+ test "passes in RedCloth options" do
+ template = Tilt::RedClothTemplate.new { |t| "Hard breaks are\ninserted by default." }
+ assert_equal "<p>Hard breaks are<br />\ninserted by default.</p>", template.render
+ template = Tilt::RedClothTemplate.new(:hard_breaks => false) { |t| "But they can be\nturned off." }
+ assert_equal "<p>But they can be\nturned off.</p>", template.render
+ end
end
rescue LoadError => boom
warn "Tilt::RedClothTemplate (disabled)"

0 comments on commit 252f40a

Please sign in to comment.