Properly wrap and encode non-pygmentized code.

This commit is contained in:
Parker Moore 2013-05-08 00:45:55 +02:00
parent f69c39c3ac
commit 739f752580
1 changed files with 8 additions and 1 deletions

View File

@ -23,10 +23,17 @@ module Jekyll
end
module WithoutPygments
require 'cgi'
include CommonMethods
def code_wrap(code)
"<div class=\"highlight\"><pre>#{CGI::escapeHTML(code)}</pre></div>"
end
def block_code(code, lang)
lang = lang && lang.split.first || "text"
output = add_code_tags(code, lang)
output = add_code_tags(code_wrap(code), lang)
end
end