Properly wrap and encode non-pygmentized code.
This commit is contained in:
parent
f69c39c3ac
commit
739f752580
|
@ -23,10 +23,17 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
module WithoutPygments
|
module WithoutPygments
|
||||||
|
require 'cgi'
|
||||||
|
|
||||||
include CommonMethods
|
include CommonMethods
|
||||||
|
|
||||||
|
def code_wrap(code)
|
||||||
|
"<div class=\"highlight\"><pre>#{CGI::escapeHTML(code)}</pre></div>"
|
||||||
|
end
|
||||||
|
|
||||||
def block_code(code, lang)
|
def block_code(code, lang)
|
||||||
lang = lang && lang.split.first || "text"
|
lang = lang && lang.split.first || "text"
|
||||||
output = add_code_tags(code, lang)
|
output = add_code_tags(code_wrap(code), lang)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue