]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
doc/_ext: render see_also field
authorKefu Chai <kchai@redhat.com>
Sat, 17 Apr 2021 16:39:41 +0000 (00:39 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 19 Apr 2021 09:08:45 +0000 (17:08 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
doc/_ext/ceph_confval.py

index 8899542306482bf76ad63848abd0ce93014757fc..89aa6a22f73525d5a11bc031c9dfe9c21786f68d 100644 (file)
@@ -50,6 +50,9 @@ TEMPLATE = '''
 {%- elif opt.max is defined %}
    :max: ``{{ opt.max }}``
 {%- endif %}
+{%- if opt.see_also %}
+   :see also: {{ opt.see_also | map('ref_confval') | join(', ') }}
+{%- endif %}
 {% if opt.note %}
    .. note::
       {{ opt.note }}
@@ -128,12 +131,17 @@ def literal(name) -> str:
         return f'<empty string>'
 
 
+def ref_confval(name) -> str:
+    return f':confval:`{name}`'
+
+
 def jinja_template() -> jinja2.Template:
     env = jinja2.Environment()
     env.filters['eval_size'] = eval_size
     env.filters['readable_duration'] = readable_duration
     env.filters['readable_num'] = readable_num
     env.filters['literal'] = literal
+    env.filters['ref_confval'] = ref_confval
     return env.from_string(TEMPLATE)