Sha256: f98876c28c11fc5678d82cead1583c51fd5efca65f5f91e40d07880a1895b800

Contents?: true

Size: 797 Bytes

Versions: 18

Compression:

Stored size: 797 Bytes

Contents

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

require 'webgen/content_processor'
require 'rexml/parsers/baseparser'
webgen_require 'maruku'


# :stopdoc:
# Fixes a problem when parsing Markdown with <webgen>-tags in Maruku.
class REXML::Parsers::BaseParser

  alias_method :"old_stream=", :"stream="

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

end
# :startdoc:


module Webgen
  class ContentProcessor

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

      # Convert the content in +context+ to HTML.
      def self.call(context)
        $uid = 0 # fix for invalid fragment IDs on second run
        context.content = ::Maruku.new(context.content, :on_error => :raise).to_html
        context
      end

    end

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
webgen-1.7.3 lib/webgen/content_processor/maruku.rb
webgen-1.7.2 lib/webgen/content_processor/maruku.rb
webgen-1.7.1 lib/webgen/content_processor/maruku.rb
webgen-1.7.0 lib/webgen/content_processor/maruku.rb
webgen-1.6.0 lib/webgen/content_processor/maruku.rb
webgen-1.5.2 lib/webgen/content_processor/maruku.rb
webgen-1.5.1 lib/webgen/content_processor/maruku.rb
webgen-1.5.0 lib/webgen/content_processor/maruku.rb
webgen-1.4.1 lib/webgen/content_processor/maruku.rb
webgen-1.4.0 lib/webgen/content_processor/maruku.rb
webgen-1.3.0 lib/webgen/content_processor/maruku.rb
webgen-1.2.1 lib/webgen/content_processor/maruku.rb
webgen-1.2.0 lib/webgen/content_processor/maruku.rb
webgen-1.1.0 lib/webgen/content_processor/maruku.rb
webgen-1.0.0 lib/webgen/content_processor/maruku.rb
webgen-1.0.0.beta3 lib/webgen/content_processor/maruku.rb
webgen-1.0.0.beta2 lib/webgen/content_processor/maruku.rb
webgen-1.0.0.beta1 lib/webgen/content_processor/maruku.rb