updated syntax highlighting support for perl and objective c in code_block and include_code plugins

This commit is contained in:
Brandon Mathis 2011-07-25 20:34:52 -04:00
parent d10ba20d14
commit 20764e31ee
3 changed files with 9 additions and 3 deletions

View file

@ -50,11 +50,13 @@ module Jekyll
Dir.chdir(code_path) do
code = file.read
file_type = file.extname
@filetype = file.extname
@filetype = 'objc' if @filetype == 'm'
@filetype = 'perl' if @filetype == 'pl'
title = @title ? "#{@title} (#{file.basename})" : file.basename
url = "#{context.registers[:site].config['url']}/#{code_dir}/#{@file}"
source = "<div><figure role=code><figcaption><span>#{title}</span> <a href='#{url}'>download</a></figcaption>\n"
source += "{% highlight #{file_type} %}\n" + code + "\n{% endhighlight %}</figure></div>"
source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}</figure></div>"
partial = Liquid::Template.parse(source)
context.stack do
partial.render(context)