Backport/2.7/docs default lists (#56667)

* Improve rendering of default lists (#56041)

(cherry picked from commit 53ed1bfc49)

* Add compat tojson filter for jinja2 versions missing it (#56596)

(cherry picked from commit 3f4a22d8ef)
pull/56847/head
Alicia Cozine 6 years ago committed by GitHub
parent 9e9db8a17d
commit c452837c5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

@ -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 %}
<b>Default:</b><br/><div style="color: blue">@{ value.default | escape }@</div>
<b>Default:</b><br/><div style="color: blue">@{ value.default | tojson | escape }@</div>
{% endif %}
</td>
{# configuration #}

Loading…
Cancel
Save