Only require pygments where it's needed.

This commit is contained in:
Parker Moore 2013-05-04 15:04:57 +02:00
parent 1c4f5b4ee5
commit 3c218d2dcd
3 changed files with 4 additions and 1 deletions

View File

@ -24,7 +24,6 @@ require 'English'
# 3rd party # 3rd party
require 'liquid' require 'liquid'
require 'maruku' require 'maruku'
require 'pygments'
require 'colorator' require 'colorator'
# internal requires # internal requires

View File

@ -9,6 +9,8 @@ module Jekyll
@config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true } @config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true }
@renderer ||= Class.new(Redcarpet::Render::HTML) do @renderer ||= Class.new(Redcarpet::Render::HTML) do
require 'pygments'
def block_code(code, lang) def block_code(code, lang)
lang = lang && lang.split.first || "text" lang = lang && lang.split.first || "text"
output = add_code_tags( output = add_code_tags(

View File

@ -49,6 +49,8 @@ eos
end end
def render_pygments(context, code) def render_pygments(context, code)
require 'pygments'
@options[:encoding] = 'utf-8' @options[:encoding] = 'utf-8'
output = add_code_tags( output = add_code_tags(