Class Tilt::RDiscountTemplate
In: lib/tilt/markdown.rb
Parent: Template

Discount Markdown implementation. See: github.com/rtomayko/rdiscount

RDiscount is a simple text filter. It does not support scope or locals. The +:smart+ and +:filter_html+ options may be set true to enable those flags on the underlying RDiscount object.

Methods

Constants

ALIAS = { :escape_html => :filter_html, :smartypants => :smart
FLAGS = [:smart, :filter_html, :smartypants, :escape_html]

Public Class methods

[Source]

    # File lib/tilt/markdown.rb, line 24
24:     def self.engine_initialized?
25:       defined? ::RDiscount
26:     end

Public Instance methods

[Source]

    # File lib/tilt/markdown.rb, line 41
41:     def allows_script?
42:       false
43:     end

[Source]

    # File lib/tilt/markdown.rb, line 37
37:     def evaluate(scope, locals, &block)
38:       @output ||= @engine.to_html
39:     end

[Source]

    # File lib/tilt/markdown.rb, line 20
20:     def flags
21:       FLAGS.select { |flag| options[flag] }.map { |flag| ALIAS[flag] || flag }
22:     end

[Source]

    # File lib/tilt/markdown.rb, line 28
28:     def initialize_engine
29:       require_template_library 'rdiscount'
30:     end

[Source]

    # File lib/tilt/markdown.rb, line 32
32:     def prepare
33:       @engine = RDiscount.new(data, *flags)
34:       @output = nil
35:     end

[Validate]