Sha256: c7979ee8a0f902f9c568250370985671113f521a6dc3790048087509e5a8d92a
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'malt/engines/abstract' require 'malt/formats/rdoc' require 'malt/formats/html' module Malt::Engine # Discount Markdown implementation. # # http://github.com/rtomayko/rdiscount # # The +:smart+ and +:filter_html+ options can be set true # to enable those flags on the underlying RDiscount object. class RDiscount < Abstract default :markdown, :md # Convert Markdown text to HTML text. def render(params) case params[:format] when :html, nil intermediate(params).to_html else super(params) end end # Convert Markdown text to intermediate engine object. def intermediate(params) text = params[:text] ::RDiscount.new(text, *flags) end private # Load rdoc makup library if not already loaded. def initialize_engine return if defined? ::RDiscount require_library 'rdiscount' end # def flags(params={}) [:smart, :filter_html].select{ |flag| params[flag] || settings[flag] } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
malt-0.1.1 | lib/malt/engines/rdiscount.rb |