From b3cdcc68ca8a7831855d0c87f82006f73041c86f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 5 Jan 2012 15:35:10 +0100 Subject: add file engine --- lib/zorglub/engines/file.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/zorglub/engines/file.rb diff --git a/lib/zorglub/engines/file.rb b/lib/zorglub/engines/file.rb new file mode 100644 index 0000000..fd9fe1e --- /dev/null +++ b/lib/zorglub/engines/file.rb @@ -0,0 +1,20 @@ +# -*- coding: UTF-8 -*- +# +require 'haml/util' +require 'haml/engine' +# +module Zorglub + module Engines + module File + def self.proc path,obj + content = ::File.open(path,'r'){|f| f.read } + ext = path.sub /.*\.(.+)$/,'\1' + return content, "text/#{ext}" + end + end + end +end +# +Zorglub::Config.register_engine :file, nil, Zorglub::Engines::File.method(:proc) +# +# EOF -- cgit v1.1-2-g2b99