* ``outdent()``: Outdents the generated code (see ``Twig_Node_Block`` for a
usage example).
-Creating a Twig Extension
--------------------------
+.. _creating_extensions:
+
+Creating an Extension
+---------------------
The main motivation for writing an extension is to move often used code into a
reusable class like adding support for internationalization. An extension can
{{ article.to_html|raw }}
You can also change the escaping mode locally by using the ``autoescape`` tag
-(see the :doc:`autoescape<../tags/autoescape>` doc for the syntax used before
+(see the :doc:`autoescape<tags/autoescape>` doc for the syntax used before
Twig 1.8):
.. code-block:: jinja
templates
api
advanced
- extensions
- hacking
+ internals
recipes
coding_standards
tags/index
The ``autoescape`` option determines the default escaping strategy to use when
no escaping is applied on a variable. When Twig is used to mostly generate
HTML files, you can set it to ``html`` and explicitly change it to ``js`` when
-you have some dynamic JavaScript files thanks to the ``autoescape`` tag::
+you have some dynamic JavaScript files thanks to the ``autoescape`` tag:
.. code-block:: jinja
If you are looking for new tags, filters, or functions, have a look at the Twig official
`extension repository`_.
-If you want to create your own, read :doc:`extensions`.
+If you want to create your own, read the :ref:`Creating an
+Extension<creating_extensions>` chapter.
.. _`Twig bundle`: https://github.com/Anomareh/PHP-Twig.tmbundle
.. _`Jinja syntax plugin`: http://jinja.pocoo.org/2/documentation/integration