Sha256: 8428c127b796a9b3f6966457e743ae7974a6ee0de47969b51742dec261f15ed5

Contents?: true

Size: 508 Bytes

Versions: 23

Compression:

Stored size: 508 Bytes

Contents

module Plate
  # Generic markdown template, currently uses RedCarpet2
  class MarkdownTemplate < Tilt::Template
    self.default_mime_type = 'text/html'

    def self.engine_initialized?
      defined? ::Redcarpet::Render
    end

    def initialize_engine
      require_template_library 'redcarpet'
    end

    def prepare
      @engine = ::Redcarpet::Markdown.new(Redcarpet::Render::HTML, options)
    end
  
    def evaluate(scope, locals, &block)
      @output ||= @engine.render(data)
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
plate-0.5.2 lib/plate/markdown_template.rb
plate-0.5.1 lib/plate/markdown_template.rb
plate-0.5.0 lib/plate/markdown_template.rb