Sha256: 5a0bc56c3c341d431c224d41e2c3523901356430f812fed5db1249b3ebb515e9

Contents?: true

Size: 1.24 KB

Versions: 12

Compression:

Stored size: 1.24 KB

Contents

module Webgen

  class Context

    # Return the node which represents the file into which everything gets rendered. This is normally
    # the same node as <tt>#content_node</tt> but can differ in special cases. For example, when
    # rendering the content of node called <tt>my.page</tt> into the output of the node
    # <tt>this.page</tt>, <tt>this.page</tt> would be the +dest_node+ and <tt>my.page</tt> would be
    # the +content_node+.
    #
    # The +dest_node+ is not included in the chain but can be set via the option <tt>:dest_node</tt>!
    #
    # The returned node should be used as source node for calculating relative paths to other nodes.
    def dest_node
      @options[:dest_node] || self.content_node
    end

    # 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.
    def ref_node
      @options[:chain] && @options[:chain].first
    end

    # Return the node that is ultimately rendered.
    #
    # This node should be used, for example, for retrieving meta information.
    def content_node
      @options[:chain] && @options[:chain].last
    end
    alias :node :content_node

  end

end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
gettalong-webgen-0.5.8.20090507 lib/webgen/context/nodes.rb
gettalong-webgen-0.5.9.20090620 lib/webgen/context/nodes.rb
gettalong-webgen-0.5.9.20090626 lib/webgen/context/nodes.rb
webgen-0.5.17 lib/webgen/context/nodes.rb
webgen-0.5.15 lib/webgen/context/nodes.rb
webgen-0.5.14 lib/webgen/context/nodes.rb
webgen-0.5.13 lib/webgen/context/nodes.rb
webgen-0.5.12 lib/webgen/context/nodes.rb
webgen-0.5.11 lib/webgen/context/nodes.rb
webgen-0.5.10 lib/webgen/context/nodes.rb
webgen-0.5.9 lib/webgen/context/nodes.rb
webgen-0.5.8 lib/webgen/context/nodes.rb