diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb index d1fa9fa0..2f27d6fa 100644 --- a/lib/gollum/markup.rb +++ b/lib/gollum/markup.rb @@ -558,12 +558,12 @@ module Gollum encoding ||= 'utf-8' begin hl_code = Pygments.highlight(code, :lexer => lang, :options => {:encoding => encoding.to_s}) - rescue ::RubyPython::PythonError + rescue hl_code = code end highlighted << hl_code end - + @codemap.each do |id, spec| body = spec[:output] || begin if (body = highlighted.shift.to_s).size > 0 diff --git a/test/test_markup.rb b/test/test_markup.rb index 3424e92a..285be397 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -534,6 +534,14 @@ np.array([[2,2],[1,3]],np.float) assert_equal %Q{

a\n

<p>a\n!rel</p>\n
\n}, output end + test "code block in unsupported language" do + @wiki.write_page("a", :markdown, "a\n```nonexistent\ncode\n```\nb", commit_details) + + page = @wiki.page("a") + output = page.formatted_data + assert_equal %Q{

a\ncode\nb

}, output + end + ######################################################################### # # Web Sequence Diagrams