mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 06:22:24 +01:00
Fix normalize_whitespace double escaping text
This commit is contained in:
parent
e5f669ccb6
commit
a0491216b9
@ -1,3 +1,6 @@
|
|||||||
|
import jinja2.nodes
|
||||||
|
from markupsafe import Markup
|
||||||
|
|
||||||
from . import app, utils
|
from . import app, utils
|
||||||
from .models import Permission, Package, PackageState, PackageRelease
|
from .models import Permission, Package, PackageState, PackageRelease
|
||||||
from .utils import abs_url_for, url_set_query, url_set_anchor, url_current
|
from .utils import abs_url_for, url_set_query, url_set_anchor, url_current
|
||||||
@ -37,9 +40,13 @@ def throw(err):
|
|||||||
raise Exception(err)
|
raise Exception(err)
|
||||||
|
|
||||||
|
|
||||||
|
def persist_safe(ret, original):
|
||||||
|
return Markup(ret) if isinstance(original, Markup) else ret
|
||||||
|
|
||||||
|
|
||||||
@app.template_filter()
|
@app.template_filter()
|
||||||
def normalize_whitespace(str):
|
def normalize_whitespace(str):
|
||||||
return do_normalize_whitespace(str).strip()
|
return persist_safe(do_normalize_whitespace(str).strip(), str)
|
||||||
|
|
||||||
|
|
||||||
@app.template_filter()
|
@app.template_filter()
|
||||||
|
Loading…
Reference in New Issue
Block a user