module Webgen::ContentProcessor::Blocks
Replaces special XML tags with the rendered content of a node block.
The module provides a ::call
method so that it can be used by the content processor extension. However, it also provides the ::render_block
method that contains the actual logic for rendering a block of a node given a render context.
Public Class Methods
Replace the webgen:block xml tags with the rendered content of the specified node.
Render a block of a page node and return the result.
The Webgen::Context
object context
is used as the render context and the options
hash needs to hold all relevant information, that is:
- :name (mandatory)
-
The name of the block that should be used.
- :chain
-
The node chain used for rendering. If this is not specified, the node chain from the context is used. It needs to be a String in the format '(A)LCN;(A)LCN;…' or an array of nodes.
- :node
-
Defines which node in the node chain should be used. Valid values are
next
(= default value; the next node in the node chain),first
(the first node in the node chain with a block calledname
) orcurrent
(the currently rendered node, ignores thechain
option). - :notfound
-
If this property is set to
ignore
, a missing block will not raise an error. It is unset by default, so missing blocks will raise errors.