Sha256: 8430fe7299308d0aaff4fb1bb2ecf7dbd7c43ac706a1ddc74716ca0a8a7c21c2

Contents?: true

Size: 919 Bytes

Versions: 2

Compression:

Stored size: 919 Bytes

Contents

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

module Webgen::ContentProcessor

  # Processes content in kramdown format (based on Markdown) using the +kramdown+ library.
  class Kramdown

    include Webgen::Loggable

    # Convert the content in +context+ to HTML.
    def call(context)
      require 'kramdown'
      require 'webgen/contentprocessor/kramdown/html'
      doc = ::Kramdown::Document.new(context.content,
                                     context.website.config['contentprocessor.kramdown.options'].merge(context.options['contentprocessor.kramdown.options'] || {}))
      context.content = KramdownHtmlConverter.convert(doc, context)
      doc.warnings.each do |warn|
        log(:warn) { "Warning while parsing <#{context.ref_node}> with kramdown: #{warn}" }
      end
      context
    rescue LoadError
      raise Webgen::LoadError.new('kramdown', self.class.name, context.dest_node, 'kramdown')
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webgen-0.5.14 lib/webgen/contentprocessor/kramdown.rb
webgen-0.5.13 lib/webgen/contentprocessor/kramdown.rb