From cf41e7d7444fb9d19a777a4720d9b00684e6fe7b Mon Sep 17 00:00:00 2001 From: Elrond Date: Thu, 31 Jan 2013 20:57:03 +0100 Subject: [PATCH] Improve formatting for hook template docs. --- docs/source/pluginwriter/api.rst | 3 ++- mediagoblin/tools/pluginapi.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/source/pluginwriter/api.rst b/docs/source/pluginwriter/api.rst index f700e161..42dc3a3d 100644 --- a/docs/source/pluginwriter/api.rst +++ b/docs/source/pluginwriter/api.rst @@ -20,4 +20,5 @@ Plugin API ----------------------- .. automodule:: mediagoblin.tools.pluginapi - :members: get_config, register_routes, register_template_path, register_template_hooks, get_hook_templates + :members: get_config, register_routes, register_template_path, + register_template_hooks, get_hook_templates diff --git a/mediagoblin/tools/pluginapi.py b/mediagoblin/tools/pluginapi.py index 8321d73d..784bede9 100644 --- a/mediagoblin/tools/pluginapi.py +++ b/mediagoblin/tools/pluginapi.py @@ -233,6 +233,9 @@ def register_template_hooks(template_hooks): of paths.) Example: + + .. code-block:: python + {"media_sidebar": "/plugin/sidemess/mess_up_the_side.html", "media_descriptionbox": ["/plugin/sidemess/even_more_mess.html", "/plugin/sidemess/so_much_mess.html"]} @@ -247,6 +250,8 @@ def get_hook_templates(hook_name): Note: for the most part, you access this via a template tag, not this method directly, like so: + .. code-block:: html+jinja + {% template_hook "media_sidebar" %} ... which will include all templates for you, partly using this @@ -255,9 +260,11 @@ def get_hook_templates(hook_name): However, this method is exposed to templates, and if you wish, you can iterate over templates in a template hook manually like so: + .. code-block:: html+jinja + {% for template_path in get_hook_templates("media_sidebar") %}
- {% include template_path %" + {% include template_path %}
{% endfor %} -- 2.25.1