Skip to content

Commit

Permalink
Merge pull request jekyll#1 from cgroner/master
Browse files Browse the repository at this point in the history
(cgroner) Missing test cases for defaults.
  • Loading branch information
Thomas Jespersen committed Nov 4, 2011
2 parents a78f86f + 69e7f4a commit bb9f106
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/jekyll/converters/textile.rb
Expand Up @@ -28,7 +28,11 @@ def output_ext(ext)
def convert(content)
setup
r = RedCloth.new(content)
r.hard_breaks = @config['redcloth']['hard_breaks']

if !@config['redcloth'].nil? and !@config['redcloth']['hard_breaks'].nil?
r.hard_breaks = @config['redcloth']['hard_breaks']
end

r.to_html
end
end
Expand Down
24 changes: 24 additions & 0 deletions test/test_redcloth.rb
@@ -1,6 +1,30 @@
require File.dirname(__FILE__) + '/helper'

class TestRedCloth < Test::Unit::TestCase

context "RedCloth default (no explicit config) hard_breaks enabled" do
setup do
@textile = TextileConverter.new
end

should "preserve single line breaks in HTML output" do
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
end
end

context "Default hard_breaks enabled w/ redcloth section, no hard_breaks value" do
setup do
config = {
'redcloth' => {}
}
@textile = TextileConverter.new config
end

should "preserve single line breaks in HTML output" do
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
end
end

context "RedCloth with hard_breaks enabled" do
setup do
config = {
Expand Down

0 comments on commit bb9f106

Please sign in to comment.