3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-25 12:53:11 +00:00
coope/gestion/environment.py
2019-02-28 13:18:41 +01:00

15 lines
No EOL
435 B
Python

from django_tex.environment import environment
def latex_safe(value):
"""
Filter that replace latex forbidden character by safe character
"""
return str(value).replace('_', '\_').replace('$', '\$').replace('&', '\&').replace('#', '\#').replace('{', '\{').replace('}','\}')
def my_environment(**options):
env = environment(**options)
env.filters.update({
'latex_safe': latex_safe
})
return env