Skip to content

Commit

Permalink
Merge pull request #157 from mkeveney/master
Browse files Browse the repository at this point in the history
Added Option support for RedCloth template
  • Loading branch information
judofyr committed Oct 5, 2012
2 parents 58ca74f + 252f40a commit e2c029b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/tilt/textile.rb
Expand Up @@ -14,6 +14,7 @@ def initialize_engine

def prepare
@engine = RedCloth.new(data)
options.each {|k, v| @engine.send("#{k}=", v)}
@output = nil
end

Expand Down
7 changes: 7 additions & 0 deletions test/tilt_redclothtemplate_test.rb
Expand Up @@ -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)"
Expand Down

0 comments on commit e2c029b

Please sign in to comment.