Class: Template::Handlers::Markdown

Inherits:
ERB
  • Object
show all
Defined in:
lib/action_view/template/handlers/markdown.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(template) ⇒ Object



4
5
6
# File 'lib/action_view/template/handlers/markdown.rb', line 4

def self.call(template)
  new.compile(template)
end

Instance Method Details

#compile(template) ⇒ Object



8
9
10
11
12
# File 'lib/action_view/template/handlers/markdown.rb', line 8

def compile(template)
  html = ::RDiscount.new(template.source).to_html
  erb = html.gsub /\{\{(.*?)\}\}/, '<%= \1 %>'
  self.class.erb_implementation.new(erb).src
end