When rendering text, a plan(which functions like a stack) is created. Here are the steps taken to produce the final output.

  1. The text resource requested is added to the stack.
  2. It's template attribute is tokenized, and all found values are resolved, then added to the stack in order.
  3. Any given templates passed in during the macro call are added.
  4. If this is the first resource, then it's wrapper attribute is added. If none is specified, a default is used. It is also resolved against the current resource.
  5. Any resource in the plan can make use of additional sections, for extending and altering the output. Sections are similiar to the object-oriented capability of overriding selected parts of the output. For instance, a wrapper could have a default Title section, and then a few resources could override that section with something that is more appropriate for them.

    When the wrapper/template tries to display a named section, it walks the stack, finding the most-specific section value. Whatever resource defines that section is used at the base for resolving the value.