Template slot family of plugin hooks - top_homepage() and others

New plugin hooks:

top_homepage
top_database
top_table
top_row
top_query
top_canned_query

New datasette.utils.make_slot_function()

Closes #1191
This commit is contained in:
Simon Willison 2024-01-30 19:54:03 -08:00 committed by GitHub
commit c3caf36af7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 324 additions and 7 deletions

View file

@ -41,7 +41,9 @@ def plugin_hooks_content():
"plugin", [name for name in dir(app.pm.hook) if not name.startswith("_")]
)
def test_plugin_hooks_are_documented(plugin, plugin_hooks_content):
headings = get_headings(plugin_hooks_content, "-")
headings = set()
headings.update(get_headings(plugin_hooks_content, "-"))
headings.update(get_headings(plugin_hooks_content, "~"))
assert plugin in headings
hook_caller = getattr(app.pm.hook, plugin)
arg_names = [a for a in hook_caller.spec.argnames if a != "__multicall__"]