Skip to content

block

Source

Hook for blocks of hooks. This is a special case where items are parsed like a normal context with the added benefit of maintaining a temporary_context so that items on the same level can be accessed in memory / rendered. Normally executed via a macro with an arrow. This the only hook the core parser is aware of as it is parsing.

Inputs

Name Type Default Required Description
items Union[dict, list] True Items to be parsed like a normal input.

Returns

Union[dict, list]

Examples

Full form

This is the full form of block and generally is not advised. See short form example.

stuff: things
block hook:
  ->: block
  items:
    stuff: other things
    things->: var stuff --if "{{ stuff == 'other things' }}"

stuff: things
block hook:
  stuff: other things
  things: more things

Short form

Because block hooks are so common, there is a macro that allows calling the hook without an expanded or compact form with simply writine an arrow.

block hook->:
  merge: true  # This merges the output up one level
  stuff: other things
  things->: var stuff

stuff: other things
things: other things