Edgewall Software

Changes between Version 7 and Version 8 of TracDev/ApiChanges/0.11


Ignore:
Timestamp:
Oct 12, 2006, 9:03:22 AM (18 years ago)
Author:
Christian Boos
Comment:

Fixing some source: links, now that the genshi branch is gone

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/ApiChanges/0.11

    v7 v8  
    99ClearSilver 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].
    1010
    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).
     11The migration from ClearSilver to Genshi was done on trunk in r3832.
    1212
    1313The following documentation is by no means a replacement for the excellent documentation you'll find in the Genshi site.
     
    1515
    1616For 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.
     17Compare the Clearsilver templates found in source:trunk/templates@3831 and their corresponding Genshi ones in source:sandbox/genshi/templates@3831.
    1818
    1919Then, in the same way, compare the various web_ui.py controllers you'll find in both branches.
     
    186186 - In this small example, there's no common Trac layout used (as the index is a bit special).
    187187   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.
    189189
    190190Note that a Genshi template can usually be rendered directly to have a taste of how it will look like:
     
    207207This comes from an important property of Genshi templates: '''they must themselves be well-formed XML documents'''.
    208208
    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.
     209That 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.
    210210Of 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.
    211211
     
    250250Previously, all the data fed to a template had to be placed inside the `req.hdf` HDF wrapper object.
    251251With 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.
     252at the same time as the template name. Check [source:sandbox/genshi/trac/wiki/web_ui.py@3831 trac.wiki.web_ui] for an example.
    253253
    254254==== Generating content ====