Permalink
Browse files

Merge pull request #157 from mkeveney/master

Added Option support for RedCloth template
  • Loading branch information...
2 parents 58ca74f + 252f40a commit e2c029b9ee630d4e9d04da51e5422c8b1635e5ad @judofyr judofyr 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 e2c029b

Please sign in to comment.