Edgewall Software

Changes between Version 2 and Version 3 of CookBook/Notification/Templates


Ignore:
Timestamp:
Nov 19, 2019, 9:00:45 AM (10 months ago)
Author:
Jun Omae
Comment:

Added example of Jinja2 template

Legend:

Unmodified
Added
Removed
Modified
  • CookBook/Notification/Templates

    v2 v3  
    88}}}
    99
    10 with this (requires Python 2.6 or later):
     10=== For Trac 1.4 and later, Jinja2 template: #jinja2
     11{{{
     12--------------------------------------------------------------------------
     13# set sel = ('Reporter', 'Owner', 'Type', 'Status', 'Priority', 'Milestone',
     14             'Component', 'Severity', 'Resolution', 'Keywords')
     15# for a in ticket_props.replace('|', '\n').splitlines()[1:-1]|map('trim'):
     16#   set a = a.split(':', 1)|map('trim')|list
     17#   if len(a) > 1 and a[0] in sel:
     18${'%-*s  %s'|format(12, a[0] + ':', a[1])}
     19#   endif
     20# endfor
     21--------------------------------------------------------------------------
     22}}}
     23
     24=== For Trac 1.2 and early, Genshi template: #genshi
    1125{{{
    1226--------------------------------------------------------------------------
     
    1731   sel = ['Reporter', 'Owner', 'Type', 'Status', 'Priority', 'Milestone',
    1832          'Component', 'Severity', 'Resolution', 'Keywords'] %}\
    19 ${'\n'.join('%s\t%s' % (format(p[0]+':', ' <12'), p[1]) for p in pv if p[0] in sel)}
     33${'\n'.join('%-*s  %s' % (12, p[0]+':', p[1]) for p in pv if p[0] in sel)}
    2034{% end %}\
    2135--------------------------------------------------------------------------