Sha256: ad7f5623321f99f45dd8e37b6af05aba86df1d07ef6dd70da6da0e463196290f

Contents?: true

Size: 689 Bytes

Versions: 2

Compression:

Stored size: 689 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]
      into = params[:to]
      case into
      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

2 entries across 2 versions & 1 rubygems

Version Path
malt-0.3.0 lib/malt/engines/bluecloth.rb
malt-0.2.0 lib/malt/engines/bluecloth.rb