Sha256: 36d109b1fdd8b1d3fe27134f41d093a7e6875ae94dcea9439620c7eb80cb4445

Contents?: true

Size: 936 Bytes

Versions: 3

Compression:

Stored size: 936 Bytes

Contents

# Render text via the Haml library
if try_require('haml', 'haml')

  Loquacious.configuration_for(:webby) {
    desc <<-__
      A hash of options that will be passed to the Haml::Engine when procesing
      content through the 'haml' filter. See the Haml rdoc documentation for
      the list of available options.

      Note: webby will set the :filename to the current page being rendered.
    __
    haml_options Hash.new
  }

  Webby::Filters.register :haml do |input, cursor|
    opts = ::Webby.site.haml_options.merge(cursor.page.haml_options || {})
    opts = opts.symbolize_keys
    opts.merge!(:filename => cursor.page.destination)
    b = cursor.renderer.get_binding
    Haml::Engine.new(input, opts).to_html(b)
  end

# Otherwise raise an error if the user tries to use haml
else
  Webby::Filters.register :haml do |input, cursor|
    raise Webby::Error, "'haml' must be installed to use the haml filter"
  end
end

# EOF

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
TwP-webby-0.9.4.1 lib/webby/filters/haml.rb
webby-0.9.4-x86-mswin32 lib/webby/filters/haml.rb
webby-0.9.4 lib/webby/filters/haml.rb