comparison doc/text-templates.txt @ 693:35e143388705 trunk

Enable use of expressions in include directives of text templates. Closes #194. Thanks to Oliver Cope for reporting the issue.
author cmlenz
date Mon, 17 Mar 2008 11:09:56 +0000
parents 1da8de3e5e51
children
comparison
equal deleted inserted replaced
692:e162edb680cf 693:35e143388705
213 any Python expression, so the path to the included template can be determined 213 any Python expression, so the path to the included template can be determined
214 dynamically: 214 dynamically:
215 215
216 .. code-block:: genshitext 216 .. code-block:: genshitext
217 217
218 {% include '%s.txt' % filename %} 218 {% include ${'%s.txt' % filename} %}
219 219
220 Note that a ``TemplateNotFound`` exception is raised if an included file can't 220 Note that a ``TemplateNotFound`` exception is raised if an included file can't
221 be found. 221 be found.
222 222
223 .. note:: The include directive for text templates was added in Genshi 0.5. 223 .. note:: The include directive for text templates was added in Genshi 0.5.
347 Beyond the requirement of putting directives on separate lines prefixed with 347 Beyond the requirement of putting directives on separate lines prefixed with
348 dollar signs, the language itself is very similar to the new one. Except that 348 dollar signs, the language itself is very similar to the new one. Except that
349 comments are lines that start with two ``#`` characters, and a line-break at the 349 comments are lines that start with two ``#`` characters, and a line-break at the
350 end of a directive is removed automatically. 350 end of a directive is removed automatically.
351 351
352 .. note:: If you're using this old syntax, it is strongly recommended to migrate 352 .. note:: If you're using this old syntax, it is strongly recommended to
353 to the new syntax. Simply replace any references to ``TextTemplate`` 353 migrate to the new syntax. Simply replace any references to
354 by ``NewTextTemplate``. On the other hand, if you want to stick with 354 ``TextTemplate`` by ``NewTextTemplate`` (and also change the
355 the old syntax for a while longer, replace references to 355 text templates, of course). On the other hand, if you want to stick
356 with the old syntax for a while longer, replace references to
356 ``TextTemplate`` by ``OldTextTemplate``; while ``TextTemplate`` is 357 ``TextTemplate`` by ``OldTextTemplate``; while ``TextTemplate`` is
357 still an alias for the old language at this point, that will change 358 still an alias for the old language at this point, that will change
358 in a future release. 359 in a future release. But also note that the old syntax may be
360 dropped entirely in a future release.
Copyright (C) 2012-2017 Edgewall Software