Fix problems in documentation generation (#40050)

* Treat C(...) as inline literal (as opposed to interpreted text).

* Making test for true and false more precise, to avoid matching 1, 1.0, etc.

* The 'is sameas' test already takes care of definedness.
pull/39204/merge
Felix Fontein 7 years ago committed by Dag Wieers
parent 6e639b591f
commit f16933492d

@ -94,7 +94,7 @@ def rst_ify(text):
t = _MODULE.sub(r":ref:`\1 <\1_module>`", t) t = _MODULE.sub(r":ref:`\1 <\1_module>`", t)
t = _LINK.sub(r"`\1 <\2>`_", t) t = _LINK.sub(r"`\1 <\2>`_", t)
t = _URL.sub(r"\1", t) t = _URL.sub(r"\1", t)
t = _CONST.sub(r"`\1`", t) t = _CONST.sub(r"``\1``", t)
t = _RULER.sub(r"------------", t) t = _RULER.sub(r"------------", t)
except Exception as e: except Exception as e:
raise AnsibleError("Could not process (%s) : %s" % (text, e)) raise AnsibleError("Could not process (%s) : %s" % (text, e))

@ -116,12 +116,10 @@ Parameters
<td> <td>
<div class="cell-border"> <div class="cell-border">
{# Turn boolean values in 'yes' and 'no' values #} {# Turn boolean values in 'yes' and 'no' values #}
{% if value.default is defined %} {% if value.default is sameas true %}
{% if value.default == true %} {% set _x = value.update({'default': 'yes'}) %}
{% set _x = value.update({'default': 'yes'}) %} {% elif value.default is sameas false %}
{% elif value.default == false %} {% set _x = value.update({'default': 'no'}) %}
{% set _x = value.update({'default': 'no'}) %}
{% endif %}
{% endif %} {% endif %}
{% if value.type == 'bool' %} {% if value.type == 'bool' %}
{% set _x = value.update({'choices': ['no', 'yes']}) %} {% set _x = value.update({'choices': ['no', 'yes']}) %}
@ -131,9 +129,9 @@ Parameters
<ul><b>Choices:</b> <ul><b>Choices:</b>
{% for choice in value.choices %} {% for choice in value.choices %}
{# Turn boolean values in 'yes' and 'no' values #} {# Turn boolean values in 'yes' and 'no' values #}
{% if choice == true %} {% if choice is sameas true %}
{% set choice = 'yes' %} {% set choice = 'yes' %}
{% elif choice == false %} {% elif choice is sameas false %}
{% set choice = 'no' %} {% set choice = 'no' %}
{% endif %} {% 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 string and value.default == choice) or (value.default is iterable and value.default is not string and choice in value.default) %}

Loading…
Cancel
Save