class Malt::Engine::Maruku

Redcarpet Markdown implementation.

http://maruku.rubyforge.org/

Constants

ENGINE_OPTION_NAMES

Supported engine options.

@todo Add more options.

@see maruku.rubyforge.org/exd.html

Public Instance Methods

create_engine(params={}) click to toggle source

Convert Markdown text to intermediate object.

@param [Hash] params

A hash containing the Markdown extensions which the parser
will identify. The following extensions are accepted.

@option params [Symbol] :on_error

If :raise, then raise error.
# File lib/malt/engines/maruku.rb, line 55
def create_engine(params={})
  text = parameters(params, :text)
  opts = engine_options(params)

  ::Maruku.new(text, opts)
end
render(params={}) click to toggle source

Convert Markdown text to HTML text.

@param [Hash] params

@option params [String] :text

Template text

@option params [String,Symbol] :to ('html')

Type or file extension to convert template into.
Calls superclass method Malt::Engine::Abstract#render
# File lib/malt/engines/maruku.rb, line 23
def render(params={})
  into, text, part = parameters(params, :to, :text, :partial)

  engine = prepare_engine(params)

  case into
  when :html, nil
    if part
      engine.to_html
    else
      engine.to_html_document
    end
  when :latex #, :pdf
    if part
      engine.to_latex
    else
      engine.to_latex_document
    end
  else
    super(params)
  end
end

Private Instance Methods

engine_option_names() click to toggle source
# File lib/malt/engines/maruku.rb, line 81
def engine_option_names
  ENGINE_OPTION_NAMES
end
require_engine() click to toggle source

Load rdoc makup library if not already loaded.

# File lib/malt/engines/maruku.rb, line 75
def require_engine
  return if defined? ::Maruku
  require_library 'maruku'
end