The `env-updated` event can now return a value, which is interpreted as an iterable of additional docnames that need to be rewritten.

(reference: #1683)
This commit is contained in:
Georg Brandl 2015-01-25 16:13:04 +01:00
parent d6e1b58b7f
commit accb32ff07
3 changed files with 15 additions and 2 deletions

View File

@ -11,6 +11,8 @@ Features added
* Added ``highlight_options`` configuration value.
* The ``language`` config value is now available in the HTML templates.
* The ``env-updated`` event can now return a value, which is interpreted
as an iterable of additional docnames that need to be rewritten.
Bugs fixed
----------

View File

@ -530,8 +530,15 @@ handlers to the events. Example:
Emitted when the :meth:`update` method of the build environment has
completed, that is, the environment and all doctrees are now up-to-date.
You can return an iterable of docnames from the handler. These documents
will then be considered updated, and will be (re-)written during the writing
phase.
.. versionadded:: 0.5
.. versionchanged:: 1.3
The handlers' return value is now used.
.. event:: html-collect-pages (app)
Emitted when the HTML builder is starting to write non-document pages. You

View File

@ -589,8 +589,12 @@ class BuildEnvironment:
self.doc2path(config.master_doc))
self.app = None
app.emit('env-updated', self)
return docnames
for retval in app.emit('env-updated', self):
if retval is not None:
docnames.extend(retval)
return sorted(docnames)
def _read_serial(self, docnames, app):
for docname in app.status_iterator(docnames, 'reading sources... ',