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.

All mappings are processed as follows:

  1. Start tag options are executed.

  2. Paragraph, font, box, table styles etc. are set up.

  3. Pre content is processed.

  4. Image (if any) is rendered.

  5. Content (if any) is processed.

  6. Post content is processed.

  7. End tag options are executed.

Pre content and Post content box are processed using the following rules:

  • Content is processed sequentially.

  • Text is emitted immediately.

  • Variables are expanded as they are encountered. Any internal processing takes place immediately.

  • Commands are executed 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).