Class: Tilt::RedcarpetTemplate::Redcarpet2

### Home Classes Methods

### In Files

- lib/tilt/markdown.rb

### Parent

Template

### Methods

- ::engine_initialized?
- #allows_script?
- #evaluate
- #generate_renderer
- #prepare

### Included Modules

- ::Redcarpet::Render::SmartyPants

### Class/Module Index

Quicksearch

- Tilt
- Tilt::AsciidoctorTemplate
- Tilt::BlueClothTemplate
- Tilt::BuilderTemplate
- Tilt::CSVTemplate
- Tilt::Cache
- Tilt::CoffeeScriptTemplate
- Tilt::CompileSite
- Tilt::CreoleTemplate
- Tilt::ERBTemplate
- Tilt::ErubisTemplate
- Tilt::EtanniTemplate
- Tilt::HamlTemplate
- Tilt::KramdownTemplate
- Tilt::LessTemplate
- Tilt::LiquidTemplate
- Tilt::MarkabyTemplate
- Tilt::MarukuTemplate
- Tilt::NokogiriTemplate
- Tilt::PlainTemplate
- Tilt::RDiscountTemplate
- Tilt::RDocTemplate
- Tilt::RadiusTemplate
- Tilt::RedClothTemplate
- Tilt::RedcarpetTemplate
- Tilt::RedcarpetTemplate::Redcarpet1
- Tilt::RedcarpetTemplate::Redcarpet2
- Tilt::SassTemplate
- Tilt::ScssTemplate
- Tilt::StringTemplate
- Tilt::Template
- Tilt::WikiClothTemplate
- Tilt::YajlTemplate

No matching classes.

# Tilt::RedcarpetTemplate::Redcarpet2

Future proof mode for Redcarpet 2.x (not yet released)

### Public Class Methods

engine_initialized?() click to toggle source

    # File lib/tilt/markdown.rb, line 90
    def self.engine_initialized?
      defined? ::Redcarpet::Render and defined? ::Redcarpet::Markdown
    end

### Public Instance Methods

allows_script?() click to toggle source

    # File lib/tilt/markdown.rb, line 128
    def allows_script?
      false
    end

evaluate(scope, locals, &block) click to toggle source

    # File lib/tilt/markdown.rb, line 124
    def evaluate(scope, locals, &block)
      @output ||= @engine.render(data)
    end

generate_renderer() click to toggle source

    # File lib/tilt/markdown.rb, line 94
    def generate_renderer
      renderer = options.delete(:renderer) || ::Redcarpet::Render::HTML
      return renderer unless options.delete(:smartypants)
      return renderer if renderer.is_a?(Class) && renderer <= ::Redcarpet::Render::SmartyPants

      if renderer == ::Redcarpet::Render::XHTML
        ::Redcarpet::Render::SmartyHTML.new(:xhtml => true)
      elsif renderer == ::Redcarpet::Render::HTML
        ::Redcarpet::Render::SmartyHTML
      elsif renderer.is_a? Class
        Class.new(renderer) { include ::Redcarpet::Render::SmartyPants }
      else
        renderer.extend ::Redcarpet::Render::SmartyPants
      end
    end

prepare() click to toggle source

    # File lib/tilt/markdown.rb, line 110
    def prepare
      # try to support the same aliases
      RDiscountTemplate::ALIAS.each do |opt, aka|
        next if options.key? opt or not options.key? aka
        options[opt] = options.delete(aka)
      end

      # only raise an exception if someone is trying to enable :escape_html
      options.delete(:escape_html) unless options[:escape_html]

      @engine = ::Redcarpet::Markdown.new(generate_renderer, options)
      @output = nil
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.