Merge pull request #569 from dekimsey/issue-568
Fixed #568, triple tilde without language causes Gollum to crash
This commit is contained in:
@@ -488,8 +488,10 @@ module Gollum
|
||||
# extract lang from { .ruby } or { #stuff .ruby .indent }
|
||||
# see http://johnmacfarlane.net/pandoc/README.html#delimited-code-blocks
|
||||
|
||||
if lang
|
||||
lang = lang.match(/\.([^}\s]+)/)
|
||||
lang = lang[1] unless lang.nil?
|
||||
end
|
||||
|
||||
@codemap[id] = cached ?
|
||||
{ :output => cached } :
|
||||
|
||||
@@ -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{<div class=\"highlight\"><pre><span class=\"s\">'hi'</span>\n</pre></div>}
|
||||
assert_equal expected, output
|
||||
end
|
||||
|
||||
test "tilda code blocks #537" do
|
||||
page = 'test_rgx'
|
||||
@wiki.write_page(page, :markdown,
|
||||
|
||||
Reference in New Issue
Block a user