]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
doc/_ext: print "default" using "literal" filter
authorKefu Chai <kchai@redhat.com>
Tue, 11 May 2021 07:50:02 +0000 (15:50 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 11 May 2021 08:05:04 +0000 (16:05 +0800)
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>
doc/_ext/ceph_confval.py

index ffe036a6b93f1fd96f38a7a0f3894c2576befee5..524c6bc2b75b659d7118f1226ae27fc39e106b71 100644 (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 %}