Class: Webgen::ContentProcessor::Haml

Inherits:
Object
  • Object
show all
Includes:
WebsiteAccess
Defined in:
lib/webgen/contentprocessor/haml.rb

Overview

Processes content in Haml markup using the haml library.

Instance Method Summary collapse

Methods included from WebsiteAccess

included, website

Instance Method Details

#call(context) ⇒ Object

Convert the content in haml markup to HTML.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/webgen/contentprocessor/haml.rb', line 11

def call(context)
  require 'haml'

  locals = {
    :context => context,
    :website => website,
    :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