Change template captures to Jinja2 macros