Class: Tilt::KramdownTemplate

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

Overview

Kramdown Markdown implementation. See: kramdown.rubyforge.org/

Constant Summary

DUMB_QUOTES =
[39, 39, 34, 34]

Instance Attribute Summary

Attributes inherited from Template

#data, #file, #line, #options

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Template

#basename, cached_evaluate, #compile_template_method, #eval_file, #evaluate_source, #initialize, #name, #render

Constructor Details

This class inherits a constructor from Tilt::Template

Class Method Details

+ (Boolean) engine_initialized?

Returns:

  • (Boolean)


171
172
173
# File 'lib/tilt/markdown.rb', line 171

def self.engine_initialized?
  defined? ::Kramdown
end

Instance Method Details

- (Object) evaluate(scope, locals, &block)



185
186
187
# File 'lib/tilt/markdown.rb', line 185

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

- (Object) initialize_engine



175
176
177
# File 'lib/tilt/markdown.rb', line 175

def initialize_engine
  require_template_library 'kramdown'
end

- (Object) prepare



179
180
181
182
183
# File 'lib/tilt/markdown.rb', line 179

def prepare
  options[:smart_quotes] = DUMB_QUOTES unless options[:smartypants]
  @engine = Kramdown::Document.new(data, options)
  @output = nil
end