Switch to pygments.rb
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
||||
|
||||
s.add_dependency('grit', "~> 2.4.1")
|
||||
s.add_dependency('github-markup', [">= 0.4.0", "< 1.0.0"])
|
||||
s.add_dependency('albino', "~> 1.3.2")
|
||||
s.add_dependency('pygments.rb', "~> 0.2.0")
|
||||
s.add_dependency('sinatra', "~> 1.0")
|
||||
s.add_dependency('mustache', [">= 0.11.2", "< 1.0.0"])
|
||||
s.add_dependency('sanitize', "~> 2.0.0")
|
||||
|
||||
@@ -16,7 +16,6 @@ require File.expand_path('../gollum/wiki', __FILE__)
|
||||
require File.expand_path('../gollum/page', __FILE__)
|
||||
require File.expand_path('../gollum/file', __FILE__)
|
||||
require File.expand_path('../gollum/markup', __FILE__)
|
||||
require File.expand_path('../gollum/albino', __FILE__)
|
||||
require File.expand_path('../gollum/sanitization', __FILE__)
|
||||
|
||||
module Gollum
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
require 'albino/multi'
|
||||
|
||||
class Gollum::Albino < Albino::Multi
|
||||
self.bin = ::Albino::Multi.bin
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
require 'digest/sha1'
|
||||
require 'cgi'
|
||||
require 'pygments'
|
||||
|
||||
module Gollum
|
||||
|
||||
@@ -398,9 +399,8 @@ module Gollum
|
||||
end
|
||||
|
||||
highlighted = begin
|
||||
blocks.size.zero? ? [] : Gollum::Albino.colorize(blocks)
|
||||
rescue ::Albino::ShellArgumentError, ::Albino::TimeoutExceeded,
|
||||
::Albino::MaximumOutputExceeded
|
||||
blocks.map { |lang, code| Pygments.highlight(code, :lexer => lang) }
|
||||
rescue ::RubyPython::PythonError
|
||||
[]
|
||||
end
|
||||
|
||||
@@ -467,8 +467,9 @@ module Gollum
|
||||
|
||||
doc.search('pre').each do |node|
|
||||
next unless lang = node['lang']
|
||||
next unless lexer = Pygments::Lexer[lang]
|
||||
text = node.inner_text
|
||||
html = Gollum::Albino.colorize(text, lang)
|
||||
html = lexer.highlight(text)
|
||||
node.replace(html)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user