Object
Create a page file from path.
# File lib/webgen/sourcehandler/page.rb, line 16 16: def create_node(path) 17: page = page_from_path(path) 18: path.meta_info['lang'] ||= website.config['website.lang'] 19: path.ext = 'html' if path.ext == 'page' 20: 21: super(path) do |node| 22: node.node_info[:sh_page_node_mi] = Webgen::Page.meta_info_from_data(path.io.data) 23: node.node_info[:page] = page 24: end 25: end
Render the block called block_name of the given node. The parameter templates is set to the default template chain for the given node but you can assign a custom template chain (an array of template nodes) if need arises. Return nil if an error occurred.
# File lib/webgen/sourcehandler/page.rb, line 30 30: def render_node(node, block_name = 'content', templates = website.blackboard.invoke(:templates_for_node, node)) 31: chain = [templates, node].flatten 32: 33: if chain.first.node_info[:page].blocks.has_key?(block_name) 34: node.node_info[:used_nodes] << chain.first.alcn 35: context = chain.first.node_info[:page].blocks[block_name].render(Webgen::Context.new(:chain => chain)) 36: context.content 37: else 38: raise Webgen::RenderError.new("No block named '#{block_name}'", 39: self.class.name, node, chain.first) 40: end 41: end
Checks if the meta information provided by the file in Webgen Page Format changed.
# File lib/webgen/sourcehandler/page.rb, line 49 49: def meta_info_changed?(node) 50: path = website.blackboard.invoke(:source_paths)[node.node_info[:src]] 51: return if node.node_info[:processor] != self.class.name || (path && !path.changed?) 52: 53: if !path 54: node.flag(:dirty_meta_info) 55: else 56: old_mi = node.node_info[:sh_page_node_mi] 57: new_mi = Webgen::Page.meta_info_from_data(path.io.data) 58: node.flag(:dirty_meta_info) if old_mi && old_mi != new_mi 59: end 60: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.