doc/_ext: print "default" using "literal" filter

there is chance that the default value of an option is empty, before
this change the rendered result would be "````", and sphinx is confused
at seeing this:

Unexpected section title or transition.

as it takes it as a notion of section title. after this change,
the "literal" filter is always applied to the default value, so an empty
string is rendered like "<empty string>" instead.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2021-05-11 15:50:02 +08:00
parent 44e611ce30
commit 80eb4f42fb

View File

@ -41,7 +41,7 @@ TEMPLATE = '''
{%- elif opt.type == 'bool' %}
:default: ``{{ default | string | lower }}``
{%- else %}
:default: ``{{ default }}``
:default: {{ default | literal }}
{%- endif -%}
{%- endif %}
{%- if opt.enum_values %}