Module: Awestruct::Hamlable

Included in:
HamlFile
Defined in:
lib/awestruct/hamlable.rb

Instance Method Summary collapse

Instance Method Details

#contentObject



13
14
15
16
# File 'lib/awestruct/hamlable.rb', line 13

def content
  context = site.engine.create_context( self )
  render( context )
end

#render(context) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/awestruct/hamlable.rb', line 4

def render(context)
  rendered = ''
  options = (site.haml || {}).inject({}){|h,(k,v)| h[k.to_sym] = v; h } 
  options[:relative_source_path] = context.page.relative_source_path
  options[:site] = site
  haml_engine = Haml::Engine.new( raw_page_content, options )
  haml_engine.render( context )
end