Order of evaluation

In order to understand the details of how custom content is processed, it is important to understand the order in which events take place.

Mappings

When a tag is mapped, the mapping is processed as follows:

  1. If requested, the content of the tag is scanned.

  2. The table and box styles are initialised.

  3. The start tag options are applied.

  4. The paragraph and font styling is applied.

  5. The custom pre-content is interpreted.

  6. If an external image has been referenced, then it is included.

  7. Any scanned content assignments (for example, footnotes) are applied.

  8. The tag content is processed, unless it has been suppressed.

  9. The custom post-content is interpreted.

  10. The end tag options are applied.

Custom content

All custom content is interpreted as follows:

  • The content is processed sequentially as a series of text, commands, and markup.

  • If the content of a custom marker is scanned, all variable references within that content are resolved when the content is scanned.

  • Variable references within unscanned text are resolved as they are encountered.

  • Commands are processed as they are encountered, but variable expansion within attribute values takes place first.

  • Flow control (<if>, <while>, <switch>) blocks affect which content is processed, but not the order of evaluation. For example, when an <if> command is processed, only those variables within its own attributes are expanded. Any variables contained within the block will not be expanded until immediately before they are used.

If you have any doubts as to the order of execution, just run in debug mode. The log file will tell you exactly what is done and in what order (see Troubleshooting).