mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
The extra_css_urls and extra_js_urls hooks now take additional optional parameters. Also refactored them out of the Datasette class and into RenderMixin. Plus improved plugin documentation to explicitly list parameters.
40 lines
997 B
Python
40 lines
997 B
Python
from pluggy import HookimplMarker
|
|
from pluggy import HookspecMarker
|
|
|
|
hookspec = HookspecMarker("datasette")
|
|
hookimpl = HookimplMarker("datasette")
|
|
|
|
|
|
@hookspec
|
|
def prepare_connection(conn):
|
|
"Modify SQLite connection in some way e.g. register custom SQL functions"
|
|
|
|
|
|
@hookspec
|
|
def prepare_jinja2_environment(env):
|
|
"Modify Jinja2 template environment e.g. register custom template tags"
|
|
|
|
|
|
@hookspec
|
|
def extra_css_urls(template, database, table, datasette):
|
|
"Extra CSS URLs added by this plugin"
|
|
|
|
|
|
@hookspec
|
|
def extra_js_urls(template, database, table, datasette):
|
|
"Extra JavaScript URLs added by this plugin"
|
|
|
|
|
|
@hookspec
|
|
def extra_body_script(template, database, table, datasette):
|
|
"Extra JavaScript code to be included in <script> at bottom of body"
|
|
|
|
|
|
@hookspec
|
|
def publish_subcommand(publish):
|
|
"Subcommands for 'datasette publish'"
|
|
|
|
|
|
@hookspec(firstresult=True)
|
|
def render_cell(value, column, table, database, datasette):
|
|
"Customize rendering of HTML table cell values"
|