From fa16c8960c8e356143c6424583dd3631b00fd408 Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Sat, 27 Oct 2012 17:58:14 -0600 Subject: [PATCH] Fix #560 --- lib/gollum/markup.rb | 4 ++++ test/test_markup.rb | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb index cb1bb7b4..a4dbf9f5 100644 --- a/lib/gollum/markup.rb +++ b/lib/gollum/markup.rb @@ -81,6 +81,10 @@ module Gollum data.gsub!(/

<\/p>/) do '' end + # fix 4 space indented code blocks + data.gsub!(/

\s*(.+)<\/code>\s*<\/pre>/m) do
+        "
#{$1}
" + end data end diff --git a/test/test_markup.rb b/test/test_markup.rb index 9dc477fd..9d033945 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -208,7 +208,7 @@ context "Markup" do DATA ), commit_details) output = @wiki.page(page).formatted_data - expected = %Q{
\n        
rot13='tr '\\''A-Za-z'\\'' '\\''N-ZA-Mn-za-m'\\'\n
\n
\n
} + expected = %Q{
      
rot13='tr '\\''A-Za-z'\\'' '\\''N-ZA-Mn-za-m'\\'\n
\n
} assert_equal expected, output end @@ -249,10 +249,20 @@ context "Markup" do assert_equal expected, output end + test "four space indented code block" do + page = 'test_four' + @wiki.write_page(page, :markdown, + %( test + test), commit_details) + output = @wiki.page(page).formatted_data + expected = %(
test\ntest\n
) + assert_equal expected, output + end + test "wiki link within code block" do @wiki.write_page("Potato", :markdown, " sed -i '' 's/[[:space:]]*$//'", commit_details) page = @wiki.page("Potato") - assert_equal "
\n  sed -i '' 's/[[:space:]]*$//'\n\n
", page.formatted_data + assert_equal "
sed -i '' 's/[[:space:]]*$//'\n
", page.formatted_data end test "piped wiki link within code block" do