Files
zulip/zproject/jinja2/__init__.py
Anders Kaseorg becef760bf cleanup: Delete leading newlines.
Previous cleanups (mostly the removals of Python __future__ imports)
were done in a way that introduced leading newlines.  Delete leading
newlines from all files, except static/assets/zulip-emoji/NOTICE,
which is a verbatim copy of the Apache 2.0 license.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-06 23:29:11 -07:00

29 lines
854 B
Python

from typing import Any
from django.template.defaultfilters import slugify, pluralize
from django.urls import reverse
from django.utils import translation
from django.utils.timesince import timesince
from jinja2 import Environment
from two_factor.templatetags.two_factor import device_action
from zerver.templatetags.app_filters import display_list, render_markdown_path
def environment(**options: Any) -> Environment:
env = Environment(**options)
env.globals.update({
'url': reverse,
'render_markdown_path': render_markdown_path,
})
env.install_gettext_translations(translation, True)
env.filters['slugify'] = slugify
env.filters['pluralize'] = pluralize
env.filters['display_list'] = display_list
env.filters['device_action'] = device_action
env.filters['timesince'] = timesince
return env