From 674980afcc30ca1a3b03ecd576a7a67e00e9ab7c Mon Sep 17 00:00:00 2001
From: Alicia Cozine <879121+acozine@users.noreply.github.com>
Date: Tue, 21 May 2019 11:51:56 -0500
Subject: [PATCH] Backport/2.6/docs default lists (#56666)
* 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 53433e373cc..e76b2d8b8d8 100755
--- a/docs/bin/plugin_formatter.py
+++ b/docs/bin/plugin_formatter.py
@@ -24,6 +24,7 @@ __metaclass__ = type
import datetime
import glob
+import json
import optparse
import os
import re
@@ -334,6 +335,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['convert_symbols_to_format'] = rst_ify
diff --git a/docs/templates/plugin.rst.j2 b/docs/templates/plugin.rst.j2
index fc521614895..8caf13ee0bf 100644
--- a/docs/templates/plugin.rst.j2
+++ b/docs/templates/plugin.rst.j2
@@ -153,7 +153,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: