Class: Magneto::RedClothFilter
- Defined in:
- lib/magneto/filters/redcloth.rb
Instance Method Summary collapse
Methods inherited from Filter
inherited, #initialize, subclasses
Constructor Details
This class inherits a constructor from Magneto::Filter
Instance Method Details
#apply(content, ivars) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/magneto/filters/redcloth.rb', line 9 def apply(content, ivars) begin require 'redcloth' rescue LoadError => ex $stderr.puts "#{File.basename($PROGRAM_NAME)}: #{ex.to_s}" $stderr.puts "You're missing a library required to use RedCloth. Try running:" $stderr.puts ' $ [sudo] gem install RedCloth' raise 'Missing dependency: RedCloth' end textile_doc = RedCloth.new(content) ivars[:redcloth].each { |rule, value| textile_doc.send((rule.to_s + '=').to_sym, value) } textile_doc.to_html end |
#name ⇒ Object
5 6 7 |
# File 'lib/magneto/filters/redcloth.rb', line 5 def name 'redcloth' end |