summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/zorglub/engines/haml.rb9
-rw-r--r--lib/zorglub/node.rb10
2 files changed, 9 insertions, 10 deletions
diff --git a/lib/zorglub/engines/haml.rb b/lib/zorglub/engines/haml.rb
index 382645e..e5013f8 100644
--- a/lib/zorglub/engines/haml.rb
+++ b/lib/zorglub/engines/haml.rb
@@ -1,19 +1,18 @@
# -*- coding: UTF-8 -*-
require 'haml/util'
-require 'haml/engine'
+require 'haml/template'
module Zorglub
module Engines
module Haml
def self.proc path,obj
+ haml = ::Haml::Template.new( path )
if obj.app.opt(:engines_cache_enabled)
key = path.sub obj.app.opt(:root),''
- haml = obj.app.engines_cache[key] ||= ::Haml::Engine.new( ::File.open(path,'r'){|f| f.read }, obj.app.opt(:haml_options) )
- else
- haml = ::Haml::Engine.new( ::File.open(path,'r'){|f| f.read }, obj.app.opt(:haml_options) )
+ obj.app.engines_cache[key] ||= haml
end
- html = haml.render(obj)
+ html = haml.render(obj, obj.app.opt(:haml_options))
return html, 'text/html'
end
end
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb
index 793e81c..b360a5c 100644
--- a/lib/zorglub/node.rb
+++ b/lib/zorglub/node.rb
@@ -300,7 +300,7 @@ module Zorglub
end
def static_page! path
- if File.exists?(path) and ( @cache_lifetime.nil? or @cache_lifetime==0 or ( (Time.now-File.stat(path).mtime) < @cache_lifetime ) )
+ if File.exist?(path) and ( @cache_lifetime.nil? or @cache_lifetime==0 or ( (Time.now-File.stat(path).mtime) < @cache_lifetime ) )
$stderr << " * use cache file : #{path}\n" if @debug
content = File.open(path, 'r') {|f| f.read }
@content = content.sub /^@mime:(.*)\n/,''
@@ -318,14 +318,14 @@ module Zorglub
v, l = view, layout
if @debug
$stderr << " * "+(e ? 'use engine' : 'no engine ')+" : "+(e ? e.to_s : '')+"\n"
- $stderr << " * "+((l and File.exists?(l)) ? 'use layout' : 'no layout ')+" : "+(l ? l : '')+"\n"
- $stderr << " * "+((v and File.exists?(v)) ? 'use view ' : 'no view ')+" : "+(v ? v : '')+"\n"
+ $stderr << " * "+((l and File.exist?(l)) ? 'use layout' : 'no layout ')+" : "+(l ? l : '')+"\n"
+ $stderr << " * "+((v and File.exist?(v)) ? 'use view ' : 'no view ')+" : "+(v ? v : '')+"\n"
end
@state = ( @partial ? :partial : :view )
- @content, mime = e.call v, self if e and v and File.exists? v
+ @content, mime = e.call v, self if e and v and File.exist? v
@mime ||= mime
@state = :layout
- @content, mime = e.call l, self if e and l and File.exists? l
+ @content, mime = e.call l, self if e and l and File.exist? l
@mime = mime if @mime.nil? and not mime.nil?
end