summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--lib/zorglub/config.rb7
-rw-r--r--lib/zorglub/engines/haml.rb20
3 files changed, 27 insertions, 2 deletions
diff --git a/TODO b/TODO
index f1e9eb0..6604f42 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,5 @@
-- engines
- compiled templates cache
- static pages
- development and production modes
- minimized html/js/css
+- encoding mime-type
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