Changes between Version 17 and Version 18 of TracDev/PortingFromGenshiToJinja
- Timestamp:
- Mar 17, 2016, 3:46:20 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracDev/PortingFromGenshiToJinja
v17 v18 207 207 {{{#!html+jinja 208 208 # 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>`) 213 214 214 215 If 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.