Skip to content

Commit

Permalink
[stable-2.8] Add compat tojson filter for jinja2 versions missing it (#…
Browse files Browse the repository at this point in the history
…56596) (#56606)

(cherry picked from commit 3f4a22d)

Co-authored-by: Matt Martz <matt@sivel.net>
  • Loading branch information
2 people authored and acozine committed May 19, 2019
1 parent c99ee40 commit 40dbb28
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/bin/plugin_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import datetime
import glob
import json
import optparse
import os
import re
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 40dbb28

Please sign in to comment.