Edgewall Software

Changes between Version 28 and Version 29 of TracDev/Proposals/Jinja


Ignore:
Timestamp:
Jul 13, 2016, 12:53:17 PM (8 years ago)
Author:
figaro
Comment:

Cosmetic changes

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/Proposals/Jinja

    v28 v29  
    33= Switch to the Jinja2 Template Engine
    44
    5 We've decided some time ago to remove the legacy support for the ClearSilver template engine for Trac 1.0 (r10570). Clearsilver had its share of inconveniences, enough that we decided to switch to the nicer [http://genshi.edgewall.org/ Genshi template engine] in 0.11, but ClearSilver was **very** fast and memory lenient. 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).
     5== Background
    66
    7 So one solution would be to switch template engine once again, to one that would combine the advantages of Genshi (pure Python, nice templates, flexible) and ClearSilver (speed!). Such a beast seems to exist now: **[http://jinja.pocoo.org/2/documentation/ Jinja2]**.
     7**[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!).
     8
     9We'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.
     10
     11The Jinja2 template engine has the peripheral benefit of being used by the Django community: [gdiscussion:trac-dev/KqWPQWuZ63k/GPfda0_PDgAJ].
    812
    913== Overview of activities and progress
    1014
    11 There's an experimental branch which supports this proposal: [source:cboos.git@jinja2] \\
    12 (mirror available in [https://github.com/cboos/trac.git github] -
    13 [[Image(https://travis-ci.org/cboos/trac.svg?branch=jinja2,link=https://travis-ci.org/cboos/trac,valign=bottom)]] on Travis,
    14 [[Image(https://ci.appveyor.com/api/projects/status/kqgv4awct01hsl7t/branch/jinja2?svg=true,link=https://ci.appveyor.com/project/cboos/trac/branch/jinja2,valign=bottom)]] on AppVeyor)
     15There is an experimental branch which supports this proposal: [source:cboos.git@jinja2]. A mirror is available in [https://github.com/cboos/trac.git github].
     16
     17Automatic builds: [[Image(https://travis-ci.org/cboos/trac.svg?branch=jinja2,link=https://travis-ci.org/cboos/trac,valign=bottom)]] on Travis,
     18[[Image(https://ci.appveyor.com/api/projects/status/kqgv4awct01hsl7t/branch/jinja2?svg=true,link=https://ci.appveyor.com/project/cboos/trac/branch/jinja2,valign=bottom)]] on AppVeyor.
    1519
    1620[=#Status Status] of the branch (2016-03-20):
    17  - ported **77.8%** of the Genshi templates, the automated tests should stays green
     21 - ported **77.8%** of the Genshi templates, the automated tests should stay green
    1822 - detailed porting guide: **PortingFromGenshiToJinja**
     23 - TODO accesskey support
    1924 - DONE clarify upgrade path for plugins that came to rely on `ITemplateStreamFilter`s? 127/898 plugins (14.1%) on trac-hacks.org use `filter_stream()` -> see [PortingFromGenshiToJinja#ReplacingITemplateStreamFilter replacing ITemplateStreamFilter]
    2025 * DONE clarify how to handle themeing? -> see HtmlTemplates#Jinjaarchitecture
    2126 * DONE rewrite tag builders ~~or use lightweight string templates~~? -> [PortingFromGenshiToJinja#tag tag] `Fragment`/`Element` builder API has been reimplemented
    22  - TODO accesskey support
    2327 - DONE hack `ITemplateStreamFilter` support for Jinja2 templates
    2428 - DONE site.html replacement, for example try to reproduce t.e.o customizations -> [./TracInterfaceCustomization]
     
    2933
    3034The topic is now (Feb / March 2016) again discussed on [gdiscussion:trac-dev:KqWPQWuZ63k trac-dev].
    31 
    32 The Jinja2 template engine has the peripheral benefit of being used by the Django community: [gdiscussion:trac-dev/KqWPQWuZ63k/GPfda0_PDgAJ].
    3335
    3436== Experimenting with Jinja2 (2.8)