Skip to content
Snippets Groups Projects
Commit 3f1c9534 authored by Martin Mareš's avatar Martin Mareš
Browse files

Jinja: Filtr pro escapování stringů v inline JS

parent 286b29c1
Branches
No related tags found
1 merge request!86Registrace
This commit is part of merge request !86. Comments created here will be created in the context of that merge request.
......@@ -93,6 +93,11 @@ def yes_no(a: bool) -> str:
return "ano" if a else "ne"
@app.template_filter()
def jsescape(js: Any) -> str:
return Markup(json_pretty(js))
@app.template_filter()
def json_pretty(js: Any) -> str:
return json.dumps(js, sort_keys=True, indent=4, ensure_ascii=False)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment