Sha256: c87f1219c7d9408a0f9a81174ac52a9a41f76435a54e89f6c1fb371cd598b4c6

Contents?: true

Size: 671 Bytes

Versions: 2

Compression:

Stored size: 671 Bytes

Contents

module Webgen::ContentProcessor

  # Processes content in Haml markup using the +haml+ library.
  class Haml

    # Convert the content in +haml+ markup to HTML.
    def call(context)
      require 'haml'

      locals = {
        :context => context,
        :node => context.content_node,
        :ref_node => context.ref_node,
        :dest_node => context.dest_node,
      }
      context.content = ::Haml::Engine.new(context.content, :filename => context.ref_node.absolute_lcn).
        render(Object.new, locals)
      context
    rescue Exception => e
      raise RuntimeError, "Error converting Haml markup to HTML: #{e.message}", e.backtrace
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webgen-0.5.1 lib/webgen/contentprocessor/haml.rb
webgen-0.5.2 lib/webgen/contentprocessor/haml.rb