Commit 5c507f04 authored by Matthias Braun's avatar Matthias Braun
Browse files

the trailing newline hack is no longer necessary with a new jinja

parent 001d52d2
......@@ -152,7 +152,7 @@ def format_escape_keywords(word):
def format_parameters(string):
return format_arguments(string, voidwhenempty = True)
env = Environment(loader=FileSystemLoader([".", "/"]))
env = Environment(loader=FileSystemLoader([".", "/"]), keep_trailing_newline=True)
env.filters['a_an'] = format_a_an
env.filters['parameterlist'] = format_parameterlist
env.filters['nodearguments'] = format_nodearguments
......@@ -286,9 +286,7 @@ def main(argv):
env.globals['warning'] = "/* Warning: automatically generated file */"
template = env.get_template(templatefile)
result = template.render().encode("utf-8")
if result[-1] != "\n":
result += "\n"
result = template.render()
sys.stdout.write(result)
if __name__ == "__main__":
......
......@@ -26,7 +26,7 @@ def format_block(node):
else:
return "block"
env = Environment(loader=FileSystemLoader([".", "/"]))
env = Environment(loader=FileSystemLoader([".", "/"]), keep_trailing_newline=True)
env.filters['args'] = format_args
env.filters['block'] = format_block
env.filters['arguments'] = format_arguments
......@@ -159,7 +159,8 @@ def main(argv):
env.globals['hasattr'] = hasattr
template = env.get_template(templatefile)
sys.stdout.write(template.render().encode("utf-8"))
result = template.render()
sys.stdout.write(result)
if __name__ == "__main__":
main(sys.argv)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment