Edgewall Software

Changes between Version 20 and Version 21 of TracDev/Proposals/Jinja


Ignore:
Timestamp:
Mar 17, 2016, 5:57:52 PM (8 years ago)
Author:
Christian Boos
Comment:

added #Status info, + links to CI pages

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/Proposals/Jinja

    v20 v21  
    66So one solution would be to switch once again, to a template engine 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]**.
    77
    8 There's an experimental branch which supports this proposal: [source:cboos.git@jinja2] (mirror available in [https://github.com/cboos/trac.git github]).
    9 
    10 Several points remain to be clarified:
    11  * what will be the upgrade path for plugins that came to rely on `ITemplateStreamFilter`s?
    12    - 127/898 plugins (14.1%) on trac-hacks.org use `filter_stream()`
    13    - -> [PortingFromGenshiToJinja#ReplacingITemplateStreamFilter replacing ITemplateStreamFilter]
    14  * how to handle themeing? -> see HtmlTemplates#Jinjaarchitecture
    15  * should we rewrite tag builders or use lightweight string templates? -> [PortingFromGenshiToJinja#tag tag] `Fragment`/`Element` builder has been reimplemented
     8There's an experimental branch which supports this proposal: [source:cboos.git@jinja2] \\
     9(mirror available in [https://github.com/cboos/trac.git github] -
     10[[Image(https://travis-ci.org/cboos/trac.svg?branch=jinja2,link=https://travis-ci.org/cboos/trac,valign=bottom)]] on Travis,
     11[[Image(https://ci.appveyor.com/api/projects/status/kqgv4awct01hsl7t/branch/jinja2,link=https://ci.appveyor.com/project/cboos/trac/branch/jinja2,valign=bottom)]] on AppVeyor)
     12
     13[=#Status Status] of the branch (2016-03-17):
     14 - ported **63%** of the Genshi templates, 2 unit-tests failure (with mysql and psql), 8 functional tests failures
     15 - clarify upgrade path for plugins that came to rely on `ITemplateStreamFilter`s?
     16   (127/898 plugins (14.1%) on trac-hacks.org use `filter_stream()`)
     17   DONE -> see [PortingFromGenshiToJinja#ReplacingITemplateStreamFilter replacing ITemplateStreamFilter]
     18 * clarify how to handle themeing? DONE -> see HtmlTemplates#Jinjaarchitecture
     19 * rewrite tag builders ~~or use lightweight string templates~~? DONE -> [PortingFromGenshiToJinja#tag tag] `Fragment`/`Element` builder API has been reimplemented
     20 - accesskey support TODO
     21 - hack `ITemplateStreamFilter` support for Jinja2 templates TODO
     22 - site.html replacement (e.g. try to reproduce t.e.o customizations) TODO
    1623 * others?
    1724
     
    1926[gmessage:trac-users:PYqQ4UDRnl8/wg8lQzrGDAAJ Genshi question] on Trac-Users.
    2027
     28The topic is now (Feb / March 2016) again discussed on [gdiscussion:trac-dev:KqWPQWuZ63k  trac-dev].
    2129
    2230
     
    2533Nothing like a few numbers to make a point ;-)
    2634
    27 These are the timings for rendering !r3871, with the diff options set to side-by-side, in place modifications, served by tracd on my development laptop. This generates a page weighing 11.5MB (Genshi) to 10.3MB (Jinja2) in size.
     35These are the timings for rendering !r3871 (//don't try this one here, please//), with the diff options set to side-by-side, in place modifications, served by tracd on my development laptop. This generates a page weighing from 11.5MB (Genshi) to 10.3MB (Jinja2) in size.
    2836
    2937||       ||||||||= Genshi                             ||||||||||||||||||||||||= Jinja2                                                                                     ||
     
    6674== Genshi to Jinja2 Migration
    6775
    68 Some systematic comparison of the Genshi and Jinja2 template syntax can be seen in PortingFromGenshiToJinja#Changesinthetemplatesyntax (modeled after the old PortingFromClearSilverToGenshi page).
     76Some systematic comparison of the Genshi and Jinja2 template syntax can be seen in PortingFromGenshiToJinja#Changesinthetemplatesyntax (that page was modeled after the old PortingFromClearSilverToGenshi page).
    6977
    7078See also PortingFromGenshiToJinja/Example for a full example presented side-by-side.