Add compat tojson filter for jinja2 versions missing it (#56596)

pull/54778/head
Matt Martz 5 years ago committed by Alicia Cozine
parent b8c170a322
commit 3f4a22d8ef

@ -11,6 +11,7 @@ __metaclass__ = type
import datetime
import glob
import json
import optparse
import os
import re
@ -399,6 +400,10 @@ def jinja2_environment(template_dir, typ, plugin_type):
# Jinja < 2.10
env.filters['max'] = do_max
if 'tojson' not in env.filters:
# Jinja < 2.9
env.filters['tojson'] = json.dumps
templates = {}
if typ == 'rst':
env.filters['rst_ify'] = rst_ify

Loading…
Cancel
Save