Sha256: 6119b5effcf8ee524431dcea848749a42971a115fd5e51c6f1f10c65c603cc9a

Contents?: true

Size: 700 Bytes

Versions: 1

Compression:

Stored size: 700 Bytes

Contents

require 'malt/engines/abstract'

module Malt::Engines

  #
  class BlueCloth < Abstract

    register :markdown, :md

    # Convert Markdown text to HTML text.
    def render(params)
      text   = params[:text]
      format = params[:format]
      case format
      when :html, nil
        intermediate(params).to_html
      else
        super(params)
      end
    end

    # Convert Markdown text to intermediate object.
    def intermediate(params)
      text = params[:text]
      ::BlueCloth.new(text)
    end

    private

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

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
malt-0.1.0 lib/malt/engines/bluecloth.rb