mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #7387 from jakobandersen/before_content
Add ObjectDescription.transform_content()
This commit is contained in:
commit
faf7280f97
2
CHANGES
2
CHANGES
@ -13,6 +13,8 @@ Deprecated
|
|||||||
Features added
|
Features added
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
* Added ``ObjectDescription.transform_content()``.
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
@ -126,6 +126,15 @@ class ObjectDescription(SphinxDirective):
|
|||||||
"""
|
"""
|
||||||
pass
|
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:
|
def after_content(self) -> None:
|
||||||
"""
|
"""
|
||||||
Called after parsing content. Used to reset information about the
|
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.env.temp_data['object'] = self.names[0]
|
||||||
self.before_content()
|
self.before_content()
|
||||||
self.state.nested_parse(self.content, self.content_offset, contentnode)
|
self.state.nested_parse(self.content, self.content_offset, contentnode)
|
||||||
|
self.transform_content(contentnode)
|
||||||
self.env.app.emit('object-description-transform',
|
self.env.app.emit('object-description-transform',
|
||||||
self.domain, self.objtype, contentnode)
|
self.domain, self.objtype, contentnode)
|
||||||
DocFieldTransformer(self).transform_all(contentnode)
|
DocFieldTransformer(self).transform_all(contentnode)
|
||||||
|
Loading…
Reference in New Issue
Block a user