Move jinja2-related code into a separate module.