Sha256: 8ee8cd1e5fc9c1d943ba311a93269cf97c7a407688d0e44673235bdf0deed8ac

Contents?: true

Size: 1019 Bytes

Versions: 5

Compression:

Stored size: 1019 Bytes

Contents

load_optional_part( 'content-converter-maruku',
                    :needed_gems => ['maruku'],
                    :error_msg => "Markdown not available as content format as Maruku could not be loaded",
                    :info => "Markdown + (extra) can be used as content format" ) do

  require 'maruku'
  load_plugin 'webgen/plugins/contentconverters/default'

  module ContentConverters

    # Converts text formatted in Markdown format using Maruku to HTML.
    class MarukuConverter < DefaultContentConverter

      infos( :name => 'ContentConverter/Maruku',
             :author => "Andrea Censi",
             :summary => "Handles content formatted in Markdown format using Maruku "+
                          "http://maruku.rubyforge.org/"
             )

      register_handler 'maruku'

      def call( content )
        Maruku.new( content ).to_html
      rescue Exception => e
        log(:error) { "Error converting Markdown text to HTML: #{e.message}" }
        content
      end

    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
webgen-0.4.3 lib/webgen/plugins/contentconverters/maruku.rb
webgen-0.4.4 lib/webgen/plugins/contentconverters/maruku.rb
webgen-0.4.5 lib/webgen/plugins/contentconverters/maruku.rb
webgen-0.4.7 lib/webgen/plugins/contentconverters/maruku.rb
webgen-0.4.6 lib/webgen/plugins/contentconverters/maruku.rb