Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Lykke Andersen <Jakob@caput.dk>2020-03-27 18:41:08 +0300
committerJakob Lykke Andersen <Jakob@caput.dk>2020-03-29 20:44:08 +0300
commitfc2edd29a8899e752a70d01121e4079ecba2ff46 (patch)
tree7061f645dc5cb30f8db390bb0fde5b95f8022865 /sphinx/directives
parent6a90c166008a46de95120ecc974fb16225f7a144 (diff)
Add ObjectDescription.transform_content()
Diffstat (limited to 'sphinx/directives')
-rw-r--r--sphinx/directives/__init__.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/sphinx/directives/__init__.py b/sphinx/directives/__init__.py
index 6b5df39b8..574962d81 100644
--- a/sphinx/directives/__init__.py
+++ b/sphinx/directives/__init__.py
@@ -126,6 +126,15 @@ class ObjectDescription(SphinxDirective):
"""
pass
+ def transform_content(self, contentnode: addnodes.desc_content) -> None:
+ """
+ Called after creating the content through nested parsing,
+ but before the ``object-description-transform`` event is emitted,
+ and before the info-fields are transformed.
+ Can be used to manipulate the content.
+ """
+ pass
+
def after_content(self) -> None:
"""
Called after parsing content. Used to reset information about the
@@ -198,6 +207,7 @@ class ObjectDescription(SphinxDirective):
self.env.temp_data['object'] = self.names[0]
self.before_content()
self.state.nested_parse(self.content, self.content_offset, contentnode)
+ self.transform_content(contentnode)
self.env.app.emit('object-description-transform',
self.domain, self.objtype, contentnode)
DocFieldTransformer(self).transform_all(contentnode)