Sha256: 7d03e13e03ef7b07bb617007359c2a04e1d23df1abbd4d280430d0ae80524977

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'deas/template_engine'
require 'kramdown'

require "deas-kramdown/version"
require 'deas-kramdown/source'

module Deas::Kramdown

  class TemplateEngine < Deas::TemplateEngine

    def kramdown_source
      @kramdown_source ||= Source.new(self.source_path, {
        :doc_opts => self.opts['doc_opts'],
        :cache    => self.opts['cache']
      })
    end

    # Render straight markdown templates.  As no ruby will be evaluated the view
    # handler, locals and content block will be ignored.
    def render(template_name, view_handler, locals, &content)
      self.kramdown_source.render(template_name)
    end

    # Render straight markdown partial templates.  As no ruby will be evaluated
    # the locals and content block will be ignored.
    def partial(template_name, locals, &content)
      self.kramdown_source.render(template_name)
    end

    # this is used when chaining engines where another engine initially loads the
    # template file
    def compile(template_name, compiled_content)
      self.kramdown_source.compile(template_name, compiled_content)
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
deas-kramdown-0.1.4 lib/deas-kramdown.rb
deas-kramdown-0.1.3 lib/deas-kramdown.rb
deas-kramdown-0.1.2 lib/deas-kramdown.rb
deas-kramdown-0.1.1 lib/deas-kramdown.rb
deas-kramdown-0.1.0 lib/deas-kramdown.rb