lib/webgen/plugins/filehandler/template.rb in webgen-0.3.3 vs lib/webgen/plugins/filehandler/template.rb in webgen-0.3.4
- old
+ new
@@ -1,9 +1,9 @@
#
#--
#
-# $Id: template.rb 249 2005-04-13 19:23:51Z thomas $
+# $Id: template.rb 275 2005-05-11 17:30:20Z thomas $
#
# webgen: template based static website generator
# Copyright (C) 2004 Thomas Leitner
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU
@@ -30,10 +30,12 @@
summary "Represents the template files for the page generation in the tree"
extension 'template'
add_param 'defaultTemplate', 'default.template', 'The default file name for the template file.'
depends_on 'FileHandler'
+ used_meta_info 'template'
+
def create_node( srcName, parent )
node = Node.new( parent )
node['title'] = 'Template'
node['src'] = node['dest'] = File.basename( srcName )
node['processor'] = self
@@ -66,10 +68,10 @@
end
# Return the default template for +node+. If the template node is not found in the directory of
# the node, the parent directories are searched.
def get_default_template( node )
- node = node.parent until node.kind_of?( FileHandlers::DirHandler::DirNode )
+ node = node.parent until node['int:directory?']
templateNode = node.find { |child| child['src'] == get_param( 'defaultTemplate' ) }
if templateNode.nil?
if node.parent.nil?
self.logger.error { "Template file #{get_param( 'defaultTemplate' )} in root directory not found, creating dummy!" }
templateNode = DummyTemplateNode.new( node )