require "haml" module Capcode module Helpers @@__HAML_PATH__ = File.expand_path( "." ) def self.haml_path=( p ) @@__HAML_PATH__ = File.expand_path( p ) end def render_haml( f ) #:nodoc: f = f.to_s if f.include? '..' return [403, {}, '403 - Invalid path'] end f = f + ".haml" if File.extname( f ) != ".haml" file = File.join( @@__HAML_PATH__, f ) Haml::Engine.new( open( file ).read ).to_html( self ) end end end