Edgewall Software

Changes between Version 34 and Version 35 of TracDev/Proposals/Jinja


Ignore:
Timestamp:
Jan 16, 2017, 12:30:28 AM (7 years ago)
Author:
Christian Boos
Comment:

update current status; l10n for plugins now works

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/Proposals/Jinja

    v34 v35  
    11= Switch to the Jinja2 Template Engine
    22
    3  [[Image(https://travis-ci.org/cboos/trac.svg?branch=jinja2-trunk-r15341,link=https://travis-ci.org/cboos/trac,valign=bottom)]] [[Image(https://ci.appveyor.com/api/projects/status/kqgv4awct01hsl7t/branch/jinja2-trunk-r15341?svg=true,link=https://ci.appveyor.com/project/cboos/trac/branch/jinja2,valign=bottom)]] [log:cboos.git@jinja2-trunk-r15341]
     3 [[Image(https://travis-ci.org/cboos/trac.svg?branch=jinja2-trunk-r15341,link=https://travis-ci.org/cboos/trac,valign=bottom)]] [[Image(https://ci.appveyor.com/api/projects/status/kqgv4awct01hsl7t/branch/jinja2-trunk-r15341?svg=true,link=https://ci.appveyor.com/project/cboos/trac/branch/jinja2,valign=bottom)]] for [log:cboos.git@jinja2-trunk-r15341]
    44
    55\\ [[PageOutline(2-3,Contents)]]
     
    99**[http://jinja.pocoo.org/2/documentation/ Jinja2]** is a [wikipedia:Web_template_system template engine] that combines the advantages of Genshi (pure Python, nice templates, flexible) and ClearSilver (speed!).
    1010
    11 We've decided some time ago to remove the legacy support for the ClearSilver template engine for Trac 1.0 (r10570), because of its many inconveniences, and to switch to the nicer [http://genshi.edgewall.org/ Genshi template engine] in Trac 0.11. While we managed to keep Genshi memory usage somewhat in control (#6614), the speed was never really adequate, especially for big changesets and for displaying source files over a few thousand lines of code (see TracDev/Performance#Genshi for details). Hence the proposal to look into an alternative template engine.
     11A bit of history first...
    1212
    13 The Jinja2 template engine has the peripheral benefit of being used by the Django community: [gdiscussion:trac-dev/KqWPQWuZ63k/GPfda0_PDgAJ].
     13Trac started its life in 2005 as a very reactive web application, as the page content was generated with ClearSilver, a template engine written in C. However, as fast as it was, it had serious quirks, troubleshooting errors was quite difficult, installation on Windows was problematic, etc. Enters Genshi in 2006, which proved to be way more flexible, and more convenient to develop with. It was also way slower, but we were confident that this would eventually improve. Trac has been converted to use Genshi for the 0.11 release (2008), and we're using it ever since.
     14
     15While we managed to keep Genshi memory usage somewhat in control (#6614), the speed was never really adequate, especially for big changesets and for displaying source files over a few thousand lines of code (see TracDev/Performance#Genshi for details). The maintenance of Genshi itself has often proved to be problematic to work with, and some issues remain unsolved (#11184).
     16
     17Hence the proposal to look into an alternative template engine. Jinja2 had always looked like a very serious candidate. Kajiki was briefly considered, but while the performance was on par with Jinja2, it was not mature enough (see [7acf61ba/cboos.git]). As Jinja2 seemed to hold all its promises (see [7d4b6f84/cboos.git]), the migration effort started in this direction beginning of 2016.
     18
     19Besides, the Jinja2 template engine has the peripheral benefit of being used by the Django community: [gdiscussion:trac-dev/KqWPQWuZ63k/GPfda0_PDgAJ].
     20
    1421
    1522== Overview of activities and progress
     
    2027
    2128
    22 [=#Status Status] of the branch (2016-07-30):
     29[=#Status Status] of the branch (2017-01-15):
    2330 - TODO: merge on trunk (#12639)
    2431 - DONE: rebase on current trunk
    25  - TODO: verify what happens with templates in plugins (e.g. SpamFilter plugin)
     32 - DONE: support templates in plugins (e.g. SpamFilter plugin) - r15353
    2633 - ported all Genshi templates from trac/tracopt (10703 Jinja2 lines corresponding to 8059 Genshi lines)
    2734 - detailed porting guide: **PortingFromGenshiToJinja**
     
    3037 * DONE clarify how to handle themeing? -> see HtmlTemplates#Jinjaarchitecture
    3138 * DONE rewrite tag builders ~~or use lightweight string templates~~? -> [PortingFromGenshiToJinja#tag tag] `Fragment`/`Element` builder API has been reimplemented
    32  - DONE hack `ITemplateStreamFilter` support for Jinja2 templates
     39 - DONE hack `ITemplateStreamFilter` support for Jinja2 templates FIXME still a few glitches with that (CDATA gets messed up)
    3340 - DONE site.html replacement, for example try to reproduce t.e.o customizations -> [./TracInterfaceCustomization]
    34  * others?
     41 * TODO update l10n guide for plugins [[CookBook/PluginL10N]]
     42
    3543
    3644See also [googlegroups:trac-dev:fc8d8c0447140110 this Trac-Dev discussion] from 2010, which is still pertinent. While we managed to release Genshi 0.6 since then, the issue is a recurring one, see this recent (2016-01)