]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
doc/_ext: do not require "mgr_module" at end of document
authorKefu Chai <kchai@redhat.com>
Mon, 10 May 2021 03:43:41 +0000 (11:43 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 11 May 2021 07:43:59 +0000 (15:43 +0800)
before this change,

.. mgr_module:: None

is required at end of a mgr module document to reset the context, so
the builder env is not polluted when processing the next document.

after this change, this ending directive is not needed anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
doc/_ext/ceph_confval.py

index d824f384ef99b049cdc3c2e4159cabe781cf76e7..44ef0bbf3faa6477d413bd8abd45fa791e8262e4 100644 (file)
@@ -398,6 +398,10 @@ class CephOption(ObjectDescription):
         std.note_object(self.objtype, name, node_id, location=signode)
 
 
+def _reset_ref_context(app, env, docname):
+    env.ref_context.pop('ceph:module', None)
+
+
 def setup(app) -> Dict[str, Any]:
     app.add_config_value('ceph_confval_imports',
                          default=[],
@@ -430,6 +434,7 @@ def setup(app) -> Dict[str, Any]:
     )
     app.add_directive_to_domain('std', 'mgr_module', CephModule)
     app.add_directive_to_domain('std', 'confval', CephOption, override=True)
+    app.connect('env-purge-doc', _reset_ref_context)
 
     return {
         'version': 'builtin',