diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb index fe35c476..7602b7fd 100644 --- a/lib/gollum/markup.rb +++ b/lib/gollum/markup.rb @@ -488,8 +488,10 @@ module Gollum # extract lang from { .ruby } or { #stuff .ruby .indent } # see http://johnmacfarlane.net/pandoc/README.html#delimited-code-blocks - lang = lang.match(/\.([^}\s]+)/) - lang = lang[1] unless lang.nil? + if lang + lang = lang.match(/\.([^}\s]+)/) + lang = lang[1] unless lang.nil? + end @codemap[id] = cached ? { :output => cached } : diff --git a/test/test_markup.rb b/test/test_markup.rb index 056028ff..13b05708 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -212,6 +212,19 @@ context "Markup" do assert_equal expected, output end + # Issue #568 + test "tilde code blocks without a language" do + page = 'test_rgx' + @wiki.write_page(page, :markdown, + %Q(~~~ +'hi' +~~~ + ), commit_details) + output = @wiki.page(page).formatted_data + expected = %Q{
'hi'\n