Child pages
  • Generator cookbook

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0


What macros are available in the templates?

  • property macro - computes a value for a property
  • reference macro - computes the target (node) of a reference
  • node macro - is used to control template filling at generation time
    • $IF$ - conditional generation
    • $INCLUDE$ - insert another template at the current position and process it passing in the current node
    • $LOOP$ - iterate over a collection of nodes and set the current node for each iteration
    • $COPY_SRC$ - copies the specified node and replaces the wrapped node. Reduction rules are applied to the copied node and its children during the process
    • $COPY_SRCL$ - copies the specified collection of nodes and replaces the wrapped code. Reduction rules are applied to the copied nodes and their children during the process
    • $MAP_SRC$ - sets a node to be used as the current node inside the wrapped code
    • $MAP_SRCL$ - sets a collection of nodes, each of which should to be used in turn as the current nodes inside the wrapped code
    • $SWITCH$ - chooses the template to use for generation from multiple choices
    • $LABEL$ - stores the wrapped node in a mapping label for easy discovery by other macros
    • $VAR$ - sets a value into a variable, which will then be accessible in the wrapped nodes through genContext.varName
    • $TRACE$ - 
    • $WEAVE$ - inserts children into a node (or a collection of nodes) by applying the supplied template
    • $INSERT$ - inserts a node into the output model at the current position
    • $EXPOSE$ - saves a node for cross-model reference, so it can be retrieved when generating other models

Where shall I put utility classes?