From b2a1d61c0407d6612450fe7d90a9a1a397aaa28e Mon Sep 17 00:00:00 2001 From: Tom Bell Date: Thu, 31 May 2012 15:51:34 -0400 Subject: [PATCH 1/2] Swap out albino for pygments.rb --- jekyll.gemspec | 2 +- lib/jekyll.rb | 2 +- lib/jekyll/tags/highlight.rb | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index 88655609..55201ae8 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -27,7 +27,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency('directory_watcher', "~> 1.1") s.add_runtime_dependency('maruku', "~> 0.5") s.add_runtime_dependency('kramdown', "~> 0.13.4") - s.add_runtime_dependency('albino', "~> 1.3") + s.add_runtime_dependency('pygments.rb', "~> 0.2.12") s.add_development_dependency('rake', "~> 0.9") s.add_development_dependency('rdoc', "~> 3.11") diff --git a/lib/jekyll.rb b/lib/jekyll.rb index fd455fb5..30da18a7 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -24,7 +24,7 @@ require 'English' # 3rd party require 'liquid' require 'maruku' -require 'albino' +require 'pygments' # internal requires require 'jekyll/core_ext' diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index ed3a0f70..9ad69b3e 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -48,7 +48,13 @@ module Jekyll end def render_pygments(context, code) - output = add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) + @options[:encoding] = 'utf-8' + + output = add_code_tags( + Pygments.highlight(code, :lexer => @lang, :options => @options), + @lang + ) + output = context["pygments_prefix"] + output if context["pygments_prefix"] output = output + context["pygments_suffix"] if context["pygments_suffix"] output From 58654176de6e1dfaa845cf08d1a096442338a9d7 Mon Sep 17 00:00:00 2001 From: Tom Bell Date: Thu, 31 May 2012 16:06:49 -0400 Subject: [PATCH 2/2] No longer need pygments locally --- Rakefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Rakefile b/Rakefile index a1f4b161..8eb1360d 100644 --- a/Rakefile +++ b/Rakefile @@ -50,10 +50,6 @@ task :default => [:test, :features] require 'rake/testtask' Rake::TestTask.new(:test) do |test| - if `which pygmentize` == '' - puts "You must have Pygments installed to run the tests." - exit 1 - end test.libs << 'lib' << 'test' test.pattern = 'test/**/test_*.rb' test.verbose = true @@ -163,4 +159,4 @@ task :gemspec do spec = [head, manifest, tail].join(" # = MANIFEST =\n") File.open(gemspec_file, 'w') { |io| io.write(spec) } puts "Updated #{gemspec_file}" -end \ No newline at end of file +end