I have this template in Mako templating system:
from mako.template import Template
tmpl = """
% if name:
Hello ${name}
% else:
Hello world
% endif
"""
t = Template(tmpl)
t.render(name="Me")
I want to modify template to have simply one line conditional. Something like this (in jinja syntax):
Hello {% if name %} {{name}} {% else %} world {% endif %}
It seems like Mako needs a line before control structures. I tried put new line with \
but it did not work:
tmpl = """% if name:\ Hello ${name} \ % else:\ Hello world\ % endif"""