From 20764e31eefcc077341a7dab649e37dcd361a8d0 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Mon, 25 Jul 2011 20:34:52 -0400 Subject: updated syntax highlighting support for perl and objective c in code_block and include_code plugins --- plugins/code_block.rb | 2 ++ plugins/include_code.rb | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/code_block.rb b/plugins/code_block.rb index 4264d197..4cf2817b 100644 --- a/plugins/code_block.rb +++ b/plugins/code_block.rb @@ -73,6 +73,8 @@ module Jekyll source = "
" source += @caption if @caption if @filetype + @filetype = 'objc' if @filetype == 'm' + @filetype = 'perl' if @filetype == 'pl' source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}
" else source += "
" + code.lstrip.rstrip.gsub(/
" diff --git a/plugins/include_code.rb b/plugins/include_code.rb index 6a7d786e..b0258a4c 100644 --- a/plugins/include_code.rb +++ b/plugins/include_code.rb @@ -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 = "
#{title} download
\n" - source += "{% highlight #{file_type} %}\n" + code + "\n{% endhighlight %}
" + source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}" partial = Liquid::Template.parse(source) context.stack do partial.render(context) -- cgit v1.2.1