Sha256: 04c24092cec95ac9d2de2762c002c1c3bd283d1c1177f4e49e0796c1b6057584

Contents?: true

Size: 686 Bytes

Versions: 1

Compression:

Stored size: 686 Bytes

Contents

require 'malt/engines/abstract'

module Malt::Engine

  #
  class RedCloth < Abstract

    default :tt, :textile

    # Convert textile text to html.
    # 
    # params:
    #
    #   :format => Symbol of the format to render [:html]
    #
    def render(params={})
      case params[:format]
      when :html, nil
        intermediate(params).to_html
      else
        super(params)
      end
    end

    #
    def intermediate(params={})
      text = params[:text]
      ::RedCloth.new(text)
    end

    private

    # Load redcloth library if not already loaded.
    def initialize_engine
      return if defined? ::RedCloth
      require_library 'redcloth'
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
malt-0.1.1 lib/malt/engines/redcloth.rb