Skip to content

Commit

Permalink
compatible for jinja2 3.0 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
HarrisChu authored Nov 26, 2021
1 parent 277b279 commit ca20eba
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions filter_plugins/map_format.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# -*- encoding: utf-8 -*-

from jinja2.utils import soft_unicode
try:
from jinja2.utils import soft_unicode
except:
from markupsafe import soft_unicode


def map_format(value, pattern):
"""
e.g.
e.g.
"{{ groups['metad']|map('map_format', '%s:9559')|join(',') }}"
"""
return soft_unicode(pattern) % (value)


class FilterModule(object):
""" jinja2 filters """
"""jinja2 filters"""

def filters(self):
return {
Expand Down

0 comments on commit ca20eba

Please sign in to comment.