From 7b81aab5ac225fb12a100d9eb463340f322704fd Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Tue, 26 Jul 2011 23:36:42 -0400 Subject: added support for pygments.rb removing dependency on pygments, added support for caching highlighted code from pygments.rb and added default line numbering. Javascript auto line numbering now only occurs for embedded gists --- plugins/code_block.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'plugins/code_block.rb') diff --git a/plugins/code_block.rb b/plugins/code_block.rb index 4cf2817b..af64e031 100644 --- a/plugins/code_block.rb +++ b/plugins/code_block.rb @@ -41,9 +41,12 @@ #
<sarcasm> Ooooh, sarcasm... How original!</sarcasm>
# # +require './plugins/pygments_code' + module Jekyll class CodeBlock < Liquid::Block + include HighlightCode CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i Caption = /(\S[\S\s]*)/ @@ -75,7 +78,7 @@ module Jekyll if @filetype @filetype = 'objc' if @filetype == 'm' @filetype = 'perl' if @filetype == 'pl' - source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}" + source += " #{highlight(code, @filetype)}" else source += "
" + code.lstrip.rstrip.gsub(/
" end -- cgit v1.2.1