Backport/2.7/docs default lists (#56667)
* Improve rendering of default lists (#56041) (cherry picked from commit53ed1bfc49
) * Add compat tojson filter for jinja2 versions missing it (#56596) (cherry picked from commit3f4a22d8ef
)
This commit is contained in:
parent
9e9db8a17d
commit
c452837c5d
2 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
|
|
2
docs/templates/plugin.rst.j2
vendored
2
docs/templates/plugin.rst.j2
vendored
|
@ -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…
Reference in a new issue