diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/zorglub/config.rb | 7 | ||||
| -rw-r--r-- | lib/zorglub/engines/haml.rb | 20 | 
2 files changed, 26 insertions, 1 deletions
| diff --git a/lib/zorglub/config.rb b/lib/zorglub/config.rb index d38e7fc..d648958 100644 --- a/lib/zorglub/config.rb +++ b/lib/zorglub/config.rb @@ -12,7 +12,12 @@ module Zorglub              :session_on => false,              :session_key => 'zorglub.sid',              :session_secret => 'session-secret-secret', -            :session_sid_len => 64 +            :session_sid_len => 64, +            :haml_options => { +                :format => :html5, +                :ugly => false, +                :encoding => 'utf-8' +            }          #          }          @engines = { } diff --git a/lib/zorglub/engines/haml.rb b/lib/zorglub/engines/haml.rb new file mode 100644 index 0000000..8c7bce0 --- /dev/null +++ b/lib/zorglub/engines/haml.rb @@ -0,0 +1,20 @@ +# -*- coding: UTF-8 -*- +# +require 'haml/util' +require 'haml/engine' +# +module Zorglub +    module Engines +        module Haml +            def self.proc path,obj +                haml = ::Haml::Engine.new( File.open(path,'r').read, Zorglub::Config.haml_options ) +                html = haml.render(obj) +                return html, 'text/html' +            end +        end +    end +end +# +Zorglub::Config.register_engine :haml, 'haml', Zorglub::Engines::Haml.method(:proc) +# +# EOF | 
