]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
doc/_ext: extract confval into an extension 40847/head
authorKefu Chai <kchai@redhat.com>
Wed, 14 Apr 2021 16:03:10 +0000 (00:03 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 14 Apr 2021 16:37:45 +0000 (00:37 +0800)
better readability this way

Signed-off-by: Kefu Chai <kchai@redhat.com>
doc/_ext/ceph_confval.py [new file with mode: 0644]
doc/conf.py

diff --git a/doc/_ext/ceph_confval.py b/doc/_ext/ceph_confval.py
new file mode 100644 (file)
index 0000000..e30f374
--- /dev/null
@@ -0,0 +1,43 @@
+from sphinx.domains.python import PyField
+from sphinx.locale import _
+from sphinx.util.docfields import Field
+
+
+def setup(app):
+    app.add_object_type(
+        'confval',
+        'confval',
+        objname='configuration value',
+        indextemplate='pair: %s; configuration value',
+        doc_field_types=[
+            PyField(
+                'type',
+                label=_('Type'),
+                has_arg=False,
+                names=('type',),
+                bodyrolename='class'
+            ),
+            Field(
+                'default',
+                label=_('Default'),
+                has_arg=False,
+                names=('default',),
+            ),
+            Field(
+                'required',
+                label=_('Required'),
+                has_arg=False,
+                names=('required',),
+            ),
+            Field(
+                'example',
+                label=_('Example'),
+                has_arg=False,
+            )
+        ]
+    )
+    return {
+        'version': 'builtin',
+        'parallel_read_safe': True,
+        'parallel_write_safe': True,
+    }
index ad36c0950f8d1bcb75fcce0ccb4cf45f90cfd944..682294db212f6e4953dfb1219cdc09dd02f8f274 100644 (file)
@@ -6,10 +6,6 @@ import sys
 import yaml
 import sphinx.util
 
-from sphinx.domains.python import PyField
-from sphinx.locale import _
-from sphinx.util.docfields import Field
-
 
 top_level = \
     os.path.dirname(
@@ -123,6 +119,7 @@ extensions = [
     'breathe',
     'ceph_commands',
     'ceph_releases',
+    'ceph_confval',
     'sphinxcontrib.openapi'
     ]
 
@@ -240,36 +237,3 @@ def setup(app):
                 generate_state_diagram(['src/osd/PeeringState.h',
                                         'src/osd/PeeringState.cc'],
                                        'doc/dev/peering_graph.generated.dot'))
-
-    app.add_object_type(
-        'confval',
-        'confval',
-        objname='configuration value',
-        indextemplate='pair: %s; configuration value',
-        doc_field_types=[
-            PyField(
-                'type',
-                label=_('Type'),
-                has_arg=False,
-                names=('type',),
-                bodyrolename='class'
-            ),
-            Field(
-                'default',
-                label=_('Default'),
-                has_arg=False,
-                names=('default',),
-            ),
-            Field(
-                'required',
-                label=_('Required'),
-                has_arg=False,
-                names=('required',),
-            ),
-            Field(
-                'example',
-                label=_('Example'),
-                has_arg=False,
-            )
-        ]
-    )