textile.rb 450 B

12345678910111213141516171819202122232425
  1. require 'tilt/template'
  2. module Tilt
  3. # RedCloth implementation. See:
  4. # http://redcloth.org/
  5. class RedClothTemplate < Template
  6. def self.engine_initialized?
  7. defined? ::RedCloth
  8. end
  9. def initialize_engine
  10. require_template_library 'redcloth'
  11. end
  12. def prepare
  13. @engine = RedCloth.new(data)
  14. @output = nil
  15. end
  16. def evaluate(scope, locals, &block)
  17. @output ||= @engine.to_html
  18. end
  19. end
  20. end