mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add an example how to connect events.
This commit is contained in:
parent
53abebda69
commit
c24cfbaed1
@ -379,7 +379,18 @@ Sphinx core events
|
|||||||
------------------
|
------------------
|
||||||
|
|
||||||
These events are known to the core. The arguments shown are given to the
|
These events are known to the core. The arguments shown are given to the
|
||||||
registered event handlers.
|
registered event handlers. Use :meth:`.connect` in an extension's ``setup``
|
||||||
|
function (note that ``conf.py`` can also have a ``setup`` function) to connect
|
||||||
|
handlers to the events. Example:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def source_read_handler(app, docname, source):
|
||||||
|
print('do something here...')
|
||||||
|
|
||||||
|
def setup(app):
|
||||||
|
app.connect('source-read', source_read_handler)
|
||||||
|
|
||||||
|
|
||||||
.. event:: builder-inited (app)
|
.. event:: builder-inited (app)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user