Last active
January 15, 2022 21:23
-
-
Save davidrpmorris/698e1ccb969a713dc2906c1b5d0355e3 to your computer and use it in GitHub Desktop.
Jinja2 Filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jinja2.filters import environmentfilter | |
@environmentfilter | |
def wrap_email(environment, s): | |
'''Return an email at '@' with a line break''' | |
email = s.split('@') | |
return email[0] + '@<br>' + email[1] | |
# after app is declared | |
app.jinja_env.filters['wrap_email'] = wrap_email |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment