Swap out albino for pygments.rb #569

Merged
merged 2 commits into from Jun 11, 2012
Jump to file or symbol
Failed to load files and symbols.
+10 −8
Diff settings

Always

Just for now

View
@@ -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
+end
View
@@ -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")
View
@@ -24,7 +24,7 @@ def require_all(path)
# 3rd party
require 'liquid'
require 'maruku'
-require 'albino'
+require 'pygments'
# internal requires
require 'jekyll/core_ext'
@@ -48,7 +48,13 @@ def render(context)
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