Generator Lifecycle Events Reference
Antora extensions listen for events emitted by the generator when Antora runs. Each listener can access variables that are in scope at the time the event is emitted. The following table lists the generator events in the order they’re emitted and the context (in-scope) variables that correspond to each event. If the variable is locked, meaning it cannot be replaced, it’s italicized.
Event name | In-scope variables |
---|---|
register()[1] |
playbook, config |
contextStarted[2] |
playbook |
playbookBuilt |
playbook |
beforeProcess |
playbook, siteAsciiDocConfig, siteCatalog |
contentAggregated[3] |
playbook, siteAsciiDocConfig, siteCatalog, contentAggregate |
uiLoaded[3] |
playbook, siteAsciiDocConfig, siteCatalog, uiCatalog |
contentClassified |
playbook, siteAsciiDocConfig, siteCatalog, uiCatalog, contentCatalog |
documentsConverted |
playbook, siteAsciiDocConfig, siteCatalog, uiCatalog, contentCatalog |
navigationBuilt |
playbook, siteAsciiDocConfig, siteCatalog, uiCatalog, contentCatalog, navigationCatalog |
pagesComposed |
playbook, siteAsciiDocConfig, siteCatalog, uiCatalog, contentCatalog |
redirectsProduced |
playbook, siteAsciiDocConfig, siteCatalog, uiCatalog, contentCatalog |
siteMapped[4] |
playbook, siteAsciiDocConfig, siteCatalog, uiCatalog, contentCatalog |
beforePublish |
playbook, siteAsciiDocConfig, siteCatalog, uiCatalog, contentCatalog |
sitePublished |
playbook, siteAsciiDocConfig, siteCatalog, uiCatalog, contentCatalog, publications |
contextStopped |
(any variable still in scope at the time the context is stopped) |
contextClosed[5] |
(any variable still in scope at the time the context is closed) |
The playbook object (i.e., the parsed data from the playbook file) is available at the time the register
function is called (which acts like the register
event).
However, at this stage, the playbook is still just a raw data model.
The Antora extensions have yet to be registered.
When the contextStarted
is emitted, all the initialization of the playbook, including registering Antora extensions and generator functions, is complete.
When modifying the content sources in an Antora extension, it’s customary to use the playbookBuilt
event.
After that, the playbook object cannot be modified or updated.
In addition to the built-in context variables listed in this table, your extension can also access context variables documented and promoted by other extensions.
siteMapped
event is only emitted if the site URL is specified in the playbook.
contextClosed
event are expected to catch their own errors so all listeners are notified.