From 949c35911e92b5bce1d21c7ed93425ccddd527fd Mon Sep 17 00:00:00 2001
From: Matt Martz <matt@sivel.net>
Date: Fri, 17 May 2019 12:48:58 -0500
Subject: [PATCH] Add compat tojson filter for jinja2 versions missing it
---
docs/bin/plugin_formatter.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/docs/bin/plugin_formatter.py b/docs/bin/plugin_formatter.py
index 1774aca70281..83a00639ee88 100755
--- a/docs/bin/plugin_formatter.py
+++ b/docs/bin/plugin_formatter.py
@@ -11,6 +11,7 @@
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