Class: Flue::CodeFilter
- Inherits:
-
Object
- Object
- Flue::CodeFilter
- Defined in:
- lib/flue/content_filter.rb
Instance Method Summary collapse
Instance Method Details
#call(input, options = {}) ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/flue/content_filter.rb', line 65 def call(input, ={}) doc = Nokogiri::HTML::DocumentFragment.parse(input) doc.css('code').each do |code| language = code["data-language"] || "ruby" code.replace(CodeRay.scan(code.content, language.to_sym).div) end doc.to_html end |