Class: Tilt::Redcarpet1Template

Inherits:
Template
  • Object
show all
Defined in:
lib/tilt/redcarpet.rb

Overview

Compatibility mode for Redcarpet 1.x

Constant Summary collapse

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

Instance Attribute Summary

Attributes inherited from Template

#data, #file, #line, #options

Instance Method Summary collapse

Methods inherited from Template

#basename, default_mime_type, default_mime_type=, #eval_file, #initialize, metadata, #metadata, #name, #render

Constructor Details

This class inherits a constructor from Tilt::Template

Instance Method Details

#allows_script?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/tilt/redcarpet.rb', line 29

def allows_script?
  false
end

#evaluate(scope, locals, &block) ⇒ Object



25
26
27
# File 'lib/tilt/redcarpet.rb', line 25

def evaluate(scope, locals, &block)
  @output ||= @engine.to_html
end

#flagsObject



16
17
18
# File 'lib/tilt/redcarpet.rb', line 16

def flags
  FLAGS.select { |flag| options[flag] }.map { |flag| ALIAS[flag] || flag }
end

#prepareObject



20
21
22
23
# File 'lib/tilt/redcarpet.rb', line 20

def prepare
  @engine = RedcarpetCompat.new(data, *flags)
  @output = nil
end