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
(cherry picked from commit 3f4a22d)
  • Loading branch information
sivel authored and acozine committed May 20, 2019
1 parent 01d4d22 commit 40f8fde
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 @@ -365,6 +366,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 40f8fde

Please sign in to comment.