Sha256: 934a192cff505414e213dbe2a7f18a3eaa4a9a0e65a064c2c1ce1c10e57d532a

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

Stored size: 736 Bytes

Contents

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

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 in <#{context.ref_node.absolute_lcn}>: #{e.message}", e.backtrace
    end

  end

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
gettalong-webgen-0.5.7.20090227 lib/webgen/contentprocessor/haml.rb
webgen-0.5.7 lib/webgen/contentprocessor/haml.rb