Class: Ace::PygmentsFilter
Instance Method Summary collapse
Methods inherited from Filter
Constructor Details
This class inherits a constructor from Ace::Filter
Instance Method Details
#call(item, content) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ace/filters/pygments.rb', line 9 def call(item, content) doc = Nokogiri::HTML(content) doc.css("pre[lang]").each do |pre| unless pre['lang'].nil? || pre['lang'].empty? # Set $VERBOSE to nil if you don't want to see this message. warn "~ Syntax highlight in '#{item.original_path}' using '#{pre['lang']}' lexer." pre.replace Albino.colorize(pre.content, pre['lang']) end end doc.to_s end |