class Webgen::PathHandler::PageUtils::Node

Custom Node class that provides easy access to the blocks of the parsed page file and methods for rendering a block.

Public Instance Methods


Return the blocks (see PageUtils#parse_as_page!) for this node.

render_block(name, context, pipeline = nil)

Render the block name of this node using the provided Context object.

Uses the content processors specified for the block via the blocks meta information key if the pipeline parameter is not set.

Returns the given context with the rendered content.

template_chain(lang = @lang)

Return the template chain for this node.

When invoked directly, the lang parameter should not be used. This parameter is necessary for the recursive invocation of the method so that the correct templates are used. Consider the following path hierarchy:

/                  template: custom.template
/                  template: custom.template

The template chains for and are therefore

/default.en.template → /custom.template
/ → /custom.template

This means that the /custom.template needs to reference different templates depending on the language.

Protected Instance Methods

default_template(dir, lang)

Return the default template for the directory node dir and language lang.

If the template node is not found, the parent directories are searched.