diff --git a/lib/jekyll/converters/textile.rb b/lib/jekyll/converters/textile.rb index 4b507996..814b2080 100644 --- a/lib/jekyll/converters/textile.rb +++ b/lib/jekyll/converters/textile.rb @@ -28,7 +28,11 @@ module Jekyll 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 diff --git a/test/test_redcloth.rb b/test/test_redcloth.rb index 9fd32be1..2b43fe24 100644 --- a/test/test_redcloth.rb +++ b/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 "
line1
\nline2
line1
\nline2