生成器事件参考

Antora 扩展会监听 Antora 运行时生成器发出的事件。每个监听器都能访问事件发生时处于作用域内的变量。下表列出了生成器事件的发生顺序,以及与每个事件相对应的上下文(作用域内)变量。如果变量被锁定,即不能被替换,则以斜体显示。

Table 1. Antora extension events and in-scope variables
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)

除了本表中列出的内置上下文变量外,您的扩展还可以访问其他扩展记录和发布的上下文变量。


1. The register function isn’t an event, but rather the function Antora calls on an extension so it can register listeners.
2. The built-in generator functions are not available until this event is emitted.
3. The order of the contentAggregated and uiLoaded events relative to each other is not guaranteed.
4. The siteMapped event is only emitted if the site URL is specified in the playbook.
5. Listeners of the contextClosed event are expected to catch their own errors so all listeners are notified.