Skip to content

Commit

Permalink
Compatibility with Jinja2 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin committed Mar 25, 2022
1 parent f725e22 commit 310cfa5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mkdocs/utils/filters.py
@@ -1,9 +1,14 @@
import jinja2
try:
from jinja2 import pass_context as contextfilter
print('a')
except ImportError:
from jinja2 import contextfilter
print('b')

from mkdocs.utils import normalize_url


@jinja2.contextfilter
@contextfilter
def url_filter(context, value):
""" A Template filter to normalize URLs. """
return normalize_url(value, page=context['page'], base=context['base_url'])

0 comments on commit 310cfa5

Please sign in to comment.