include tags are now able to select between multiple templates
and take the first that exists, if a list of templates is
given.
--HG--
branch : trunk
diff --git a/docs/api.rst b/docs/api.rst
index 5a1e29a..d6d1e20 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -115,7 +115,8 @@
<jinja-extensions>`.
.. autoclass:: Environment([options])
- :members: from_string, get_template, join_path, extend, compile_expression
+ :members: from_string, get_template, select_template,
+ get_or_select_template, join_path, extend, compile_expression
.. attribute:: shared
@@ -485,6 +486,8 @@
.. autoexception:: jinja2.TemplateNotFound
+.. autoexception:: jinja2.TemplatesNotFound
+
.. autoexception:: jinja2.TemplateSyntaxError
.. attribute:: message
diff --git a/docs/templates.rst b/docs/templates.rst
index 93560af..732845a 100644
--- a/docs/templates.rst
+++ b/docs/templates.rst
@@ -768,6 +768,18 @@
{% include "sidebar.html" ignore missing with context %}
{% include "sidebar.html" ignore missing without context %}
+.. versionadded:: 2.2
+
+You can also provide a list of templates that are checked for existence
+before inclusion. The first template that exists will be included. If
+`ignore missing` is given, it will fall back to rendering nothing if
+none of the templates exist, otherwise it will raise an exception.
+
+Example::
+
+ {% include ['page_detailed.html', 'page.html'] %}
+ {% include ['special_sidebar.html', 'sidebar.html'] ignore missing %}
+
.. _import:
Import