Class: Tilt::KramdownTemplate

Inherits:
Template
  • Object
show all
Defined in:
lib/tilt/kramdown.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, default_mime_type, default_mime_type=, #eval_file, #initialize, metadata, #metadata, #name, #render

Constructor Details

This class inherits a constructor from Tilt::Template

Class Method Details

.engine_initialized?Boolean



10
11
12
# File 'lib/tilt/kramdown.rb', line 10

def self.engine_initialized?
  defined? ::Kramdown
end

Instance Method Details

#allows_script?Boolean



28
29
30
# File 'lib/tilt/kramdown.rb', line 28

def allows_script?
  false
end

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



24
25
26
# File 'lib/tilt/kramdown.rb', line 24

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

#initialize_engineObject



14
15
16
# File 'lib/tilt/kramdown.rb', line 14

def initialize_engine
  require_template_library 'kramdown'
end

#prepareObject



18
19
20
21
22
# File 'lib/tilt/kramdown.rb', line 18

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