jinja2 templates: Enable the 'do' and 'loopcontrols' extensions

See http://jinja.pocoo.org/docs/extensions/ for their documentation
Merge pull request #5162 from minaguib/develop

jinja2 templates: Enable the 'do' and 'loopcontrols' extensions