Class: Awestruct::Handlers::HamlHandler
Constant Summary
collapse
- CHAIN =
Awestruct::HandlerChain.new( /\.haml$/,
Awestruct::Handlers::FileHandler,
Awestruct::Handlers::FrontMatterHandler,
Awestruct::Handlers::HamlHandler,
Awestruct::Handlers::LayoutHandler
)
Instance Attribute Summary
Attributes inherited from BaseHandler
#delegate, #site
Instance Method Summary
collapse
Methods inherited from BaseHandler
#content_line_offset, #content_syntax, #dependencies, #execute_shell, #front_matter, #inherit_front_matter, #input_mtime, #output_path, #path, #raw_content, #relative_source_path, #stale?, #to_chain
Constructor Details
#initialize(site, delegate) ⇒ HamlHandler
Returns a new instance of HamlHandler.
21
22
23
|
# File 'lib/awestruct/handlers/haml_handler.rb', line 21
def initialize(site, delegate)
super( site, delegate )
end
|
Instance Method Details
#output_extension ⇒ Object
34
35
36
|
# File 'lib/awestruct/handlers/haml_handler.rb', line 34
def output_extension
File.extname( File.basename( path, '.haml' ) )
end
|
#output_filename ⇒ Object
29
30
31
32
|
# File 'lib/awestruct/handlers/haml_handler.rb', line 29
def output_filename
return File.basename( relative_source_path, '.haml' ) unless relative_source_path.nil?
nil
end
|
#rendered_content(context, with_layouts = true) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/awestruct/handlers/haml_handler.rb', line 38
def rendered_content(context, with_layouts=true)
options = context.site.haml? ? context.site.haml : {}
options = options.inject({}){ |hash,(key,value)|
hash[key.to_sym] = value
hash
}
options[:relative_source_path] = context.page.relative_source_path
options[:filename] = delegate.path.to_s
options[:line] = delegate.content_line_offset + 1
options[:site] = context.site
haml_engine = Haml::Engine.new( delegate.raw_content, options )
haml_engine.render( context )
end
|
#simple_name ⇒ Object
25
26
27
|
# File 'lib/awestruct/handlers/haml_handler.rb', line 25
def simple_name
File.basename( self.path, "#{output_extension}.haml" )
end
|