Skip to content

Commit

Permalink
Merge pull request rtomayko#139 from DAddYE/master
Browse files Browse the repository at this point in the history
Redcarpet 2
  • Loading branch information
rkh committed Feb 25, 2012
2 parents 7233eef + 87f0358 commit 10a8ffa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/tilt/markdown.rb
Expand Up @@ -53,7 +53,7 @@ def initialize_engine
end

def prepare
klass = [Redcarpet1, Redcarpet2].detect { |e| e.engine_initialized? }
klass = [Redcarpet2, Redcarpet1].detect { |e| e.engine_initialized? }
@engine = klass.new(file, line, options) { data }
end

Expand Down
2 changes: 1 addition & 1 deletion test/tilt_markdown_test.rb
Expand Up @@ -98,7 +98,7 @@ class MarkdownRedcarpetTest < Test::Unit::TestCase

def test_smarty_pants_true
html = nrender "Hello ``World'' -- This is --- a test ...", :smartypants => true
assert_equal "<p>Hello “World – This is — a test …</p>", html
assert_equal "<p>Hello “World'' – This is — a test …</p>", html
end
end
rescue LoadError => boom
Expand Down
9 changes: 7 additions & 2 deletions test/tilt_redcarpettemplate_test.rb
Expand Up @@ -37,6 +37,11 @@ class RedcarpetTemplateTest < Test::Unit::TestCase
end
end

test "redcarpet2 is our default choice" do
template = Tilt::RedcarpetTemplate.new {}
assert_equal Tilt::RedcarpetTemplate::Redcarpet2, template.prepare.class
end

test "preparing and evaluating templates on #render" do
template = Tilt::RedcarpetTemplate.new { |t| "# Hello World!" }
assert_equal "<h1>Hello World!</h1>\n", template.render
Expand All @@ -48,9 +53,9 @@ class RedcarpetTemplateTest < Test::Unit::TestCase
end

test "smartypants when :smart is set" do
template = Tilt::RedcarpetTemplate.new(:smart => true) { |t|
template = Tilt::RedcarpetTemplate.new(:smartypants => true) { |t|
"OKAY -- 'Smarty Pants'" }
assert_match /<p>OKAY &[nm]dash; &lsquo;Smarty Pants&rsquo;<\/p>/,
assert_match /<p>OKAY &ndash; &#39;Smarty Pants&#39;<\/p>/,
template.render
end
end
Expand Down

0 comments on commit 10a8ffa

Please sign in to comment.