As Lektor executes and builds it emits various events that plugins can respond to. This gives a list of all of those events.
Events are handled by implementing a method with the name of the event and
the prefix on_
on the plugin and underscores instead of dashes. So for
instance if the event is called process-template-context the method to implement is
on_process_template_context
. It's important to additionally always
catch extra parameters in a **extra
parameter so that the plugin does
not break if an event starts sending additional parameters in the future.
If you want to emit your own events you can do that from the environment's plugin controller:
self.emit('your-signal', parameter='value')
This emits a signal named your-plugin-your-signal
. The signal prefix is
taken from the plugin ID which is set in setup.py
.
This event is emitted after an individual source is built.
This event is emitted after all sources are built.
This event is emitted before an individual source is built.
This event is emitted before all sources are built.
An event that can be handled to customize the template context.
Emitted right after the server was started.
Emitted right before the server stops.
Emitted right after the plugin is associated with the environment.
Comments