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 }
|
# extract lang from { .ruby } or { #stuff .ruby .indent }
|
||||||
# see http://johnmacfarlane.net/pandoc/README.html#delimited-code-blocks
|
# see http://johnmacfarlane.net/pandoc/README.html#delimited-code-blocks
|
||||||
|
|
||||||
lang = lang.match(/\.([^}\s]+)/)
|
if lang
|
||||||
lang = lang[1] unless lang.nil?
|
lang = lang.match(/\.([^}\s]+)/)
|
||||||
|
lang = lang[1] unless lang.nil?
|
||||||
|
end
|
||||||
|
|
||||||
@codemap[id] = cached ?
|
@codemap[id] = cached ?
|
||||||
{ :output => cached } :
|
{ :output => cached } :
|
||||||
|
|||||||
@@ -212,6 +212,19 @@ context "Markup" do
|
|||||||
assert_equal expected, output
|
assert_equal expected, output
|
||||||
end
|
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
|
test "tilda code blocks #537" do
|
||||||
page = 'test_rgx'
|
page = 'test_rgx'
|
||||||
@wiki.write_page(page, :markdown,
|
@wiki.write_page(page, :markdown,
|
||||||
|
|||||||
Reference in New Issue
Block a user