diff --git a/app/models/textile_article.rb b/app/models/textile_article.rb index cf793ad..f6773c5 100644 --- a/app/models/textile_article.rb +++ b/app/models/textile_article.rb @@ -28,7 +28,9 @@ class TextileArticle < TextArticle def convert_to_html(textile) @@sanitizer ||= HTML::WhiteListSanitizer.new - @@sanitizer.sanitize(RedCloth.new(textile|| '').to_html) + converter = RedCloth.new(textile|| '') + converter.hard_breaks = false + @@sanitizer.sanitize(converter.to_html) end end diff --git a/test/unit/textile_article_test.rb b/test/unit/textile_article_test.rb index e6758a2..e734dcf 100644 --- a/test/unit/textile_article_test.rb +++ b/test/unit/textile_article_test.rb @@ -182,6 +182,10 @@ class TextileArticleTest < Test::Unit::TestCase assert_not_equal '', build_article(nil, :abstract => '').lead end + should 'not add hard breaks for single line breaks' do + assert_equal "

one\nparagraph

", build_article("one\nparagraph").to_html + end + protected def build_article(input = nil, options = {}) -- libgit2 0.21.2