From 0a46d060691c903935596cfc445044318c0a6e20 Mon Sep 17 00:00:00 2001 From: Kevin Simper Date: Wed, 4 Feb 2015 15:44:30 +0100 Subject: [PATCH] Organize and show value types --- doc/api.rst | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/doc/api.rst b/doc/api.rst index cdeaffdb0..2724bc287 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -72,29 +72,43 @@ options as the constructor second argument:: The following options are available: -* ``debug``: When set to ``true``, the generated templates have a +* ``debug`` *boolean* + + When set to ``true``, the generated templates have a ``__toString()`` method that you can use to display the generated nodes (default to ``false``). -* ``charset``: The charset used by the templates (default to ``utf-8``). +* ``charset`` *string (default to ``utf-8``)* -* ``base_template_class``: The base template class to use for generated - templates (default to ``Twig_Template``). + The charset used by the templates. -* ``cache``: An absolute path where to store the compiled templates, or +* ``base_template_class`` *(default to ``Twig_Template``)* + + The base template class to use for generated + templates. + +* ``cache`` *boolean* + + An absolute path where to store the compiled templates, or ``false`` to disable caching (which is the default). -* ``auto_reload``: When developing with Twig, it's useful to recompile the +* ``auto_reload`` *boolean* + + When developing with Twig, it's useful to recompile the template whenever the source code changes. If you don't provide a value for the ``auto_reload`` option, it will be determined automatically based on the ``debug`` value. -* ``strict_variables``: If set to ``false``, Twig will silently ignore invalid +* ``strict_variables`` *boolean* + + If set to ``false``, Twig will silently ignore invalid variables (variables and or attributes/methods that do not exist) and replace them with a ``null`` value. When set to ``true``, Twig throws an exception instead (default to ``false``). -* ``autoescape``: If set to ``true``, HTML auto-escaping will be enabled by +* ``autoescape`` *boolean* + + If set to ``true``, HTML auto-escaping will be enabled by default for all templates (default to ``true``). As of Twig 1.8, you can set the escaping strategy to use (``html``, ``js``, @@ -110,7 +124,9 @@ The following options are available: strategy does not incur any overhead at runtime as auto-escaping is done at compilation time.) -* ``optimizations``: A flag that indicates which optimizations to apply +* ``optimizations`` *integer* + + A flag that indicates which optimizations to apply (default to ``-1`` -- all optimizations are enabled; set it to ``0`` to disable).