Mercurial > genshi > mirror
diff doc/upgrade.txt @ 713:5420fe9d99a9 trunk
The `Markup` class now supports mappings for right hand of the `%` (modulo) operator in the same way the Python string classes do, except that the substituted values are escape. Also, the special constructor which took positional arguments that would be substituted was removed. Thus the `Markup` class now supports the same arguments as that of its `unicode` base class. Closes #211. Many thanks to Christian Boos for the patch!
author | cmlenz |
---|---|
date | Tue, 08 Apr 2008 18:18:18 +0000 |
parents | 07e3f6f0ef57 |
children | fc6d9d2a3527 |
line wrap: on
line diff
--- a/doc/upgrade.txt +++ b/doc/upgrade.txt @@ -1,3 +1,4 @@ +================ Upgrading Genshi ================ @@ -7,19 +8,12 @@ .. sectnum:: +------------------------------------ Upgrading from Genshi 0.4.x to 0.5.x ------------------------------------ -Genshi 0.5 introduces a new, alternative syntax for text templates, -which is more flexible and powerful compared to the old syntax. For -backwards compatibility, this new syntax is not used by default, -though it will be in a future version. It is recommended that you -migrate to using this new syntax. To do so, simply rename any -references in your code to ``TextTemplate`` to ``NewTextTemplate``. To -explicitly use the old syntax, use ``OldTextTemplate`` instead, so -that you can be sure you'll be using the same language when the -default in Genshi is changed (at least until the old implementation is -completely removed). +Error Handling +-------------- The default error handling mode has been changed to "strict". This means that accessing variables not defined in the template data will @@ -30,6 +24,9 @@ warned that lenient error handling may be removed completely in a future release. +Match Template Processing +------------------------- + There has also been a subtle change to how ``py:match`` templates are processed: in previous versions, all match templates would be applied to the content generated by the matching template, and only the @@ -42,7 +39,39 @@ have any effect on most applications, but you may want to check your use of match templates to make sure. +Text Templates +-------------- +Genshi 0.5 introduces a new, alternative syntax for text templates, +which is more flexible and powerful compared to the old syntax. For +backwards compatibility, this new syntax is not used by default, +though it will be in a future version. It is recommended that you +migrate to using this new syntax. To do so, simply rename any +references in your code to ``TextTemplate`` to ``NewTextTemplate``. To +explicitly use the old syntax, use ``OldTextTemplate`` instead, so +that you can be sure you'll be using the same language when the +default in Genshi is changed (at least until the old implementation is +completely removed). + +``Markup`` Constructor +---------------------- + +The ``Markup`` class now longer has a specialized constructor. The old +(undocumented) constructor provided a shorthand for doing positional +substitutions. If you have code like this: + +.. code-block:: python + + Markup('<b>%s</b>', name) + +You can simply replace it by the more explicit: + +.. code-block:: python + + Markup('<b>%s</b>') % name + + +------------------------------------ Upgrading from Genshi 0.3.x to 0.4.x ------------------------------------ @@ -66,6 +95,7 @@ information. +--------------------- Upgrading from Markup ---------------------