lib/keydown/lib/slide.rb in keydown-0.5.2 vs lib/keydown/lib/slide.rb in keydown-0.7.0
- old
+ new
@@ -1,7 +1,6 @@
require 'digest/sha1'
-require 'albino'
module Keydown
class Slide
attr_reader :content
@@ -22,11 +21,11 @@
extract_notes!
extract_content!
extract_code!
extract_background_image!
- pygmentize_code!
+ highlight_code!
end
def classnames
@classnames.join(' ')
end
@@ -107,18 +106,22 @@
:service => split_line[2],
:attribution_link => split_line[3]})
end
end
- def pygmentize_code!
- @codemap.each do |id, spec|
- lang = spec[:lang]
- code = spec[:code]
+ require "coderay"
+
+ def highlight_code!
+ @codemap.each do |id, code_block|
+ lang = code_block[:lang]
+ code = code_block[:code]
if code.all? { |line| line =~ /\A\r?\n\Z/ || line =~ /^( |\t)/ }
code.gsub!(/^( |\t)/m, '')
end
- @content.gsub!(id, Albino.new(code, lang).colorize)
+ tokens = CodeRay.scan code, lang.to_sym
+
+ @content.gsub!(id, tokens.html.div)
end
end
end
end
\ No newline at end of file