From 23bfce0ea0fae605f67547f7b12e91fbe329d506 Mon Sep 17 00:00:00 2001 From: Blaise Laflamme Date: Sun, 28 Nov 2010 02:21:38 -0500 Subject: Narrative doc cleanup --- docs/narr/templates.rst | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'docs/narr/templates.rst') diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst index f7929b44e..e11f69ab1 100644 --- a/docs/narr/templates.rst +++ b/docs/narr/templates.rst @@ -543,7 +543,9 @@ you can create templates that are entirely composed of text except for Here's an example usage of a Chameleon text template. Create a file on disk named ``mytemplate.txt`` in your project's ``templates`` -directory with the following contents:: +directory with the following contents: + +.. code-block:: text Hello, ${name}! @@ -590,7 +592,7 @@ should cause it to ignore these files. Here's the contents of the author's ``svn propedit svn:ignore .`` in each of my ``templates`` directories. -.. code-block:: bash +.. code-block:: text :linenos: *.pt.py @@ -620,13 +622,17 @@ environment variable setting or a configuration file setting. To use an environment variable, start your application under a shell using the ``BFG_DEBUG_TEMPLATES`` operating system environment -variable set to ``1``, For example:: +variable set to ``1``, For example: + +.. code-block:: text $ BFG_DEBUG_TEMPLATES=1 bin/paster serve myproject.ini To use a setting in the application ``.ini`` file for the same purpose, set the ``debug_templates`` key to ``true`` within the -application's configuration section, e.g.:: +application's configuration section, e.g.: + +.. code-block:: guess [app:main] use = egg:MyProject#app @@ -634,7 +640,9 @@ application's configuration section, e.g.:: With template debugging off, a :exc:`NameError` exception resulting from rendering a template with an undefined variable -(e.g. ``${wrong}``) might end like this:: +(e.g. ``${wrong}``) might end like this: + +.. code-block:: python File "...", in __getitem__ raise NameError(key) @@ -642,7 +650,9 @@ from rendering a template with an undefined variable Note that the exception has no information about which template was being rendered when the error occured. But with template debugging -on, an exception resulting from the same problem might end like so:: +on, an exception resulting from the same problem might end like so: + +.. code-block:: text RuntimeError: Caught exception rendering template. - Expression: ``wrong`` @@ -774,13 +784,17 @@ environment variable setting or a configuration file setting. To use an environment variable, start your application under a shell using the ``BFG_RELOAD_TEMPLATES`` operating system environment -variable set to ``1``, For example:: +variable set to ``1``, For example: + +.. code-block:: text $ BFG_RELOAD_TEMPLATES=1 bin/paster serve myproject.ini To use a setting in the application ``.ini`` file for the same purpose, set the ``reload_templates`` key to ``true`` within the -application's configuration section, e.g.:: +application's configuration section, e.g.: + +.. code-block:: guess [app:main] use = egg:MyProject#app -- cgit v1.2.3 From 16cd50c1a5beef98c3297d105c1ccffccb8872c5 Mon Sep 17 00:00:00 2001 From: Blaise Laflamme Date: Sun, 28 Nov 2010 12:28:30 -0500 Subject: Normalized narrative doc, code with linenos while text+bash don't --- docs/narr/templates.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'docs/narr/templates.rst') diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst index e11f69ab1..c1c2fe31e 100644 --- a/docs/narr/templates.rst +++ b/docs/narr/templates.rst @@ -593,7 +593,6 @@ author's ``svn propedit svn:ignore .`` in each of my ``templates`` directories. .. code-block:: text - :linenos: *.pt.py *.txt.py @@ -632,7 +631,8 @@ To use a setting in the application ``.ini`` file for the same purpose, set the ``debug_templates`` key to ``true`` within the application's configuration section, e.g.: -.. code-block:: guess +.. code-block:: ini + :linenos: [app:main] use = egg:MyProject#app @@ -642,7 +642,7 @@ With template debugging off, a :exc:`NameError` exception resulting from rendering a template with an undefined variable (e.g. ``${wrong}``) might end like this: -.. code-block:: python +.. code-block:: text File "...", in __getitem__ raise NameError(key) @@ -794,7 +794,8 @@ To use a setting in the application ``.ini`` file for the same purpose, set the ``reload_templates`` key to ``true`` within the application's configuration section, e.g.: -.. code-block:: guess +.. code-block:: ini + :linenos: [app:main] use = egg:MyProject#app -- cgit v1.2.3