Sha256: fc7629ce5868274ed6e3a8dd54cb182dc2bdd3dcc26cd986ad665ca72eb2588c

Contents?: true

Size: 849 Bytes

Versions: 5

Compression:

Stored size: 849 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'rexml/parsers/baseparser'

class REXML::Parsers::BaseParser

  alias :"old_stream=" :"stream="

  def stream=(source)
    self.old_stream=(source)
    @nsstack << Set.new(['webgen'])
  end

end


module Webgen::ContentProcessor

  # Processes content in Markdown format using the +maruku+ library.
  class Maruku

    # Convert the content in +context+ to HTML.
    def call(context)
      require 'maruku'
      $uid = 0 #fix for invalid fragment ids on second run
      context.content = ::Maruku.new(context.content, :on_error => :raise).to_html
      context
    rescue LoadError
      raise Webgen::LoadError.new('maruku', self.class.name, context.dest_node, 'maruku')
    rescue Exception => e
      raise Webgen::RenderError.new(e, self.class.name, context.dest_node, context.ref_node)
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
webgen-0.5.17 lib/webgen/contentprocessor/maruku.rb
webgen-0.5.15 lib/webgen/contentprocessor/maruku.rb
webgen-0.5.14 lib/webgen/contentprocessor/maruku.rb
webgen-0.5.13 lib/webgen/contentprocessor/maruku.rb
webgen-0.5.12 lib/webgen/contentprocessor/maruku.rb