Codeblock regex improved to better detect extensions fixes #96, added support for tableizing non highlighted code blocks from liquid codeblock tag and backtick code blocks

This commit is contained in:
Brandon Mathis 2011-08-16 02:40:47 -04:00
parent 59521e3db8
commit ef4a42f977
3 changed files with 21 additions and 13 deletions

View file

@ -64,7 +64,7 @@ module Jekyll
@file = $1
@caption = "<figcaption><span>#{$1}</span></figcaption>\n"
end
if @file =~ /\S[\S\s]*\.(\w+)/
if @file =~ /\S[\S\s]*\w+\.(\w+)/
@filetype = $1
end
super
@ -82,7 +82,7 @@ module Jekyll
@filetype = 'yaml' if @filetype == 'yml'
source += " #{highlight(code, @filetype)}</figure></div>"
else
source += "<pre><code>" + code.lstrip.rstrip.gsub(/</,'&lt;') + "</code></pre></figure></div>"
source += "#{tableize_code(code.lstrip.rstrip.gsub(/</,'&lt;'))}</figure></div>"
end
source = source + context['pygments_suffix'] if context['pygments_suffix']
end