From c452837c5dc38698034f6b94c9588bcd5ed93888 Mon Sep 17 00:00:00 2001
From: Alicia Cozine <879121+acozine@users.noreply.github.com>
Date: Tue, 21 May 2019 11:48:59 -0500
Subject: [PATCH] Backport/2.7/docs default lists (#56667)
* Improve rendering of default lists (#56041)
(cherry picked from commit 53ed1bfc49a14b17f86af3f1a0009417ea840d72)
* Add compat tojson filter for jinja2 versions missing it (#56596)
(cherry picked from commit 3f4a22d8efe22484ba5b5df6bb14a9929d899a6a)
---
docs/bin/plugin_formatter.py | 5 +++++
docs/templates/plugin.rst.j2 | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/docs/bin/plugin_formatter.py b/docs/bin/plugin_formatter.py
index bebc33d29e4..c3a36cfa8cf 100755
--- a/docs/bin/plugin_formatter.py
+++ b/docs/bin/plugin_formatter.py
@@ -11,6 +11,7 @@ __metaclass__ = type
import datetime
import glob
+import json
import optparse
import os
import re
@@ -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
diff --git a/docs/templates/plugin.rst.j2 b/docs/templates/plugin.rst.j2
index c10471d5dc0..6c3b13c2a0a 100644
--- a/docs/templates/plugin.rst.j2
+++ b/docs/templates/plugin.rst.j2
@@ -155,7 +155,7 @@ Parameters
{% endif %}
{# Show default value, when multiple choice or no choices #}
{% if value.default is defined and value.default not in value.choices %}
- Default: