Sha256: 86dfee508cd644db676e527452d86066636113ff355800c815fcdb6795d9acc3
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
# -*- encoding: utf-8 -*- module Webgen::ContentProcessor # Processes content in Haml markup using the +haml+ library. class Haml include Deprecated # Convert the content in +haml+ markup to HTML. def call(context) require 'haml' locals = { :context => context, :website => deprecate('website', 'context.website', context.website), :node => deprecate('node', 'context.node', context.content_node), :ref_node => deprecate('ref_node', 'context.ref_node', context.ref_node), :dest_node => deprecate('dest_node', 'context.dest_node', context.dest_node) } context.content = ::Haml::Engine.new(context.content, :filename => context.ref_node.alcn). render(Object.new, locals) context rescue LoadError raise Webgen::LoadError.new('haml', self.class.name, context.dest_node.alcn, 'haml') rescue ::Haml::Error => e raise Webgen::RenderError.new(e, self.class.name, context.dest_node.alcn, context.ref_node.alcn, (e.line + 1 if e.line)) rescue Exception => e raise Webgen::RenderError.new(e, self.class.name, context.dest_node.alcn, context.ref_node.alcn) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webgen-0.5.10 | lib/webgen/contentprocessor/haml.rb |
webgen-0.5.9 | lib/webgen/contentprocessor/haml.rb |