Edgewall Software

Changes between Version 17 and Version 18 of TracDev/PortingFromGenshiToJinja


Ignore:
Timestamp:
Mar 17, 2016, 3:46:20 PM (8 years ago)
Author:
Christian Boos
Comment:

#setHTMLattributes: take care about the whtespace in elements

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/PortingFromGenshiToJinja

    v17 v18  
    207207{{{#!html+jinja
    208208          #   set components = plugin.modules|map(attribute='components')|flatten
    209           <tr ${{'class': 'disabled' if not components|selectattr('enabled')
    210               }|htmlattr}>
    211 
    212 }}}
     209          <tr${{'class': 'disabled' if not components|selectattr('enabled')
     210               }|htmlattr}>
     211
     212}}}
     213(the `htmlattr` filter will add a space if needed; that way, if the condition is true, you end up with `<tr class="disabled">`, otherwise with just `<tr>`)
    213214
    214215If you wonder why the `if all(...)` expression morphed into `if not components|...`, it's because Jinja2 expressions are similar to Python expressions, but not quite the same.