Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added Option support for RedCloth template #157

Merged
merged 1 commit into from

2 participants

@mkeveney

Now RedCloth options like :hard_breaks or :no_span_caps can be passed through Tilt. I needed this when using Slim.

-Matt

@judofyr
Collaborator

Seems good to me.

@judofyr judofyr merged commit e2c029b into rtomayko:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 5, 2012
  1. @mkeveney
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 0 deletions.
  1. +1 −0  lib/tilt/textile.rb
  2. +7 −0 test/tilt_redclothtemplate_test.rb
View
1  lib/tilt/textile.rb
@@ -14,6 +14,7 @@ def initialize_engine
def prepare
@engine = RedCloth.new(data)
+ options.each {|k, v| @engine.send("#{k}=", v)}
@output = nil
end
View
7 test/tilt_redclothtemplate_test.rb
@@ -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)"
Something went wrong with that request. Please try again.