Sha256: af930118d19181978f3c2a5cb4a397937a85ece047db3c8655ef65efa19bd039

Contents?: true

Size: 699 Bytes

Versions: 1

Compression:

Stored size: 699 Bytes

Contents

require 'malt/engines/abstract'

module Malt::Engine

  #
  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.1 lib/malt/engines/bluecloth.rb