3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-05-18 07:21:47 +00:00
coope/gestion/environment.py

15 lines
435 B
Python
Raw Normal View History

2019-01-05 23:01:30 +00:00
from django_tex.environment import environment
def latex_safe(value):
2019-02-28 12:18:41 +00:00
"""
Filter that replace latex forbidden character by safe character
"""
2019-01-05 23:01:30 +00:00
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