From 3c218d2dcd64489e90637248bf54709720bc6229 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 4 May 2013 15:04:57 +0200 Subject: [PATCH] Only require pygments where it's needed. --- lib/jekyll.rb | 1 - lib/jekyll/converters/markdown/redcarpet_parser.rb | 2 ++ lib/jekyll/tags/highlight.rb | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 3d233517..cdd50c15 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -24,7 +24,6 @@ require 'English' # 3rd party require 'liquid' require 'maruku' -require 'pygments' require 'colorator' # internal requires diff --git a/lib/jekyll/converters/markdown/redcarpet_parser.rb b/lib/jekyll/converters/markdown/redcarpet_parser.rb index 92d8aec9..0f6f82de 100644 --- a/lib/jekyll/converters/markdown/redcarpet_parser.rb +++ b/lib/jekyll/converters/markdown/redcarpet_parser.rb @@ -9,6 +9,8 @@ module Jekyll @config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true } @renderer ||= Class.new(Redcarpet::Render::HTML) do + require 'pygments' + def block_code(code, lang) lang = lang && lang.split.first || "text" output = add_code_tags( diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index c84ea111..e8059edb 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -49,6 +49,8 @@ eos end def render_pygments(context, code) + require 'pygments' + @options[:encoding] = 'utf-8' output = add_code_tags(