module Webgen::Context::Nodes

Provides quick access to special nodes of the node chain of a context object.

Public Instance Methods

content_node() click to toggle source

Return the node that is ultimately rendered.

This node should be used, for example, for retrieving meta information.

   # File lib/webgen/context/nodes.rb
32 def content_node
33   @options[:chain][-1]
34 end
Also aliased as: node
dest_node() click to toggle source

Return the node which represents the file into which everything gets rendered.

This is normally the same node as content_node but can differ in special cases. For example, when rendering the content of node called 'my.page' into the output of the node 'this.page', 'this.page' would be the dest_node and 'my.page' would be the content_node.

The dest_node is not included in the chain but can be set via the option :dest_node!

The returned node should be used as source node for calculating relative paths to other nodes.

   # File lib/webgen/context/nodes.rb
17 def dest_node
18   @options[:dest_node] || content_node
19 end
node()
Alias for: content_node
ref_node() click to toggle source

Return the reference node, ie. the node which provided the original content for this context object.

The returned node should be used, for example, for resolving relative paths.

   # File lib/webgen/context/nodes.rb
25 def ref_node
26   @options[:chain][0]
27 end