diff --git a/docs/bin/plugin_formatter.py b/docs/bin/plugin_formatter.py index 330a7540ab8..53433e373cc 100755 --- a/docs/bin/plugin_formatter.py +++ b/docs/bin/plugin_formatter.py @@ -29,7 +29,7 @@ import os import re import sys import warnings -from collections import defaultdict +from collections import defaultdict, Sequence from distutils.version import LooseVersion from pprint import PrettyPrinter @@ -154,6 +154,12 @@ def rst_xline(width, char="="): return char * width +def test_list(value): + ''' Return true if the object is a list or tuple ''' + + return isinstance(value, Sequence) and not isinstance(value, string_types) + + def write_data(text, output_dir, outputname, module=None): ''' dumps module output to a file or the screen, as requested ''' @@ -334,6 +340,7 @@ def jinja2_environment(template_dir, typ, plugin_type): env.filters['html_ify'] = html_ify env.filters['fmt'] = rst_fmt env.filters['xline'] = rst_xline + env.tests['list'] = test_list templates['plugin'] = env.get_template('plugin.rst.j2') if plugin_type == 'module': diff --git a/docs/templates/plugin.rst.j2 b/docs/templates/plugin.rst.j2 index b9eabb50c01..ec25785e0d4 100644 --- a/docs/templates/plugin.rst.j2 +++ b/docs/templates/plugin.rst.j2 @@ -143,7 +143,7 @@ Parameters {% elif choice is sameas false %} {% set choice = 'no' %} {% endif %} - {% if (value.default is string and value.default == choice) or (value.default is iterable and value.default is not string and choice in value.default) %} + {% if (value.default is not list and value.default == choice) or (value.default is list and choice in value.default) %}