Skip to content

Commit

Permalink
Add compat tojson filter for jinja2 versions missing it (ansible#56596)
Browse files Browse the repository at this point in the history
  • Loading branch information
sivel authored and acozine committed May 18, 2019
1 parent b8c170a commit 3f4a22d
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 3f4a22d

Please sign in to comment.