Changes between Version 7 and Version 8 of TracDev/ApiChanges/0.11
- Timestamp:
- Oct 12, 2006, 9:03:22 AM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracDev/ApiChanges/0.11
v7 v8 9 9 ClearSilver has proven a bit uncomfortable to work with, and search for better alternatives were done a few months ago. The [http://kid-templating.org/ Kid] templating language was unanimously found appealing, to the point cmlenz did a porting of Trac to Kid, during the DrProject fork. This in turn was found painful, and prompted Christopher to start his own, enhanced, version of Kid currently maturing as [http://genshi.edgewall.org/ Genshi]. 10 10 11 Migrating away from ClearSilver to use Genshi is scheduled for early [milestone:0.11], and is mostly complete in the source:sandbox/genshi branch at this point (r3728).11 The migration from ClearSilver to Genshi was done on trunk in r3832. 12 12 13 13 The following documentation is by no means a replacement for the excellent documentation you'll find in the Genshi site. … … 15 15 16 16 For migrating your own templates, a good way to start is to learn by example. 17 Compare the Clearsilver templates found in source:trunk/templates and their corresponding Genshi ones in source:sandbox/genshi/templates.17 Compare the Clearsilver templates found in source:trunk/templates@3831 and their corresponding Genshi ones in source:sandbox/genshi/templates@3831. 18 18 19 19 Then, in the same way, compare the various web_ui.py controllers you'll find in both branches. … … 186 186 - In this small example, there's no common Trac layout used (as the index is a bit special). 187 187 For how a "normal" template looks like, see for example 188 [source:sandbox/genshi/templates/diff_form.html diff_form.html], another small template.188 [source:sandbox/genshi/templates/diff_form.html@3831 diff_form.html], another small template. 189 189 190 190 Note that a Genshi template can usually be rendered directly to have a taste of how it will look like: … … 207 207 This comes from an important property of Genshi templates: '''they must themselves be well-formed XML documents'''. 208 208 209 That was not a constraint in Clearsilver, and sometimes the logic in those templates took "advantage" of that, e.g. by conditionally inserting end/start pairs of tags. Such templates are the hardest to port, because you actually have to think a bit... See for example the [source:sandbox/genshi/templates/query.html query.html] template.209 That was not a constraint in Clearsilver, and sometimes the logic in those templates took "advantage" of that, e.g. by conditionally inserting end/start pairs of tags. Such templates are the hardest to port, because you actually have to think a bit... See for example the [source:sandbox/genshi/templates/query.html@3831 query.html] template. 210 210 Of course, the great benefit of this constraint is that you'll end up quite naturally with well-formed content, which was far from being a trivial achievement using Clearsilver templates. Granted, you could still insert directly some non well-formed `Markup` data in your template, but again, if you use the [http://genshi.edgewall.org/wiki/Documentation/builder.html genshi.builder] ''tag'' facility for this, that's hardly a risk. 211 211 … … 250 250 Previously, all the data fed to a template had to be placed inside the `req.hdf` HDF wrapper object. 251 251 With Genshi, the data for the template is basically a `dict`, which has to be returned by `process_request` 252 at the same time as the template name. Check [source:sandbox/genshi/trac/wiki/web_ui.py trac.wiki.web_ui] for an example.252 at the same time as the template name. Check [source:sandbox/genshi/trac/wiki/web_ui.py@3831 trac.wiki.web_ui] for an example. 253 253 254 254 ==== Generating content ====