Sha256: ddd9699c03ae1d216dc8fa23f0e21fcc9f0dd0d37d9be84c9d2edab32eea6c02
Contents?: true
Size: 660 Bytes
Versions: 1
Compression:
Stored size: 660 Bytes
Contents
module Nanoc::Filter::Haml class Context def initialize(hash) hash.each_pair do |key, value| instance_variable_set('@' + key.to_s, value) end end def get_binding binding end end class HamlFilter < Nanoc::Filter identifiers :haml def run(content) nanoc_require 'haml' # Get options options = @page.haml_options || {} # Get assigns/locals assigns = { :page => @page, :pages => @pages, :config => @config, :site => @site } context = Context.new(assigns) # Get result ::Haml::Engine.new(content, options).render(context, assigns) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nanoc-2.0.4 | lib/nanoc/filters/haml.rb |