diff --git a/papyri/directives.py b/papyri/directives.py index 63e8b192..32f225e5 100644 --- a/papyri/directives.py +++ b/papyri/directives.py @@ -26,6 +26,8 @@ def block_math_handler(argument, options, content): return [MMath(content)] +# A number of directives that so far are just small wrappers around admonitions. + def admonition_helper(name, argument, options, content): """ This is a helper to return admonition. @@ -63,3 +65,7 @@ def versionadded_handler(argument, options, content): def versionchanged_handler(argument, options, content): return admonition_helper("versionchanged", argument, options, content) + + +def deprecated_handler(argument, options, content): + return admonition_helper("deprecated", argument, options, content) diff --git a/papyri/tree.py b/papyri/tree.py index 37d58bc9..32443c5d 100644 --- a/papyri/tree.py +++ b/papyri/tree.py @@ -32,11 +32,11 @@ from .utils import full_qual, FullQual, Cannonical, obj_from_qualname from textwrap import indent from .directives import ( - admonition_helper, block_math_handler, note_handler, version_added_handler, version_changed_handler, + deprecated_handler, warning_handler, ) @@ -548,6 +548,7 @@ def __init__( "note": note_handler, "versionadded": version_added_handler, "versionchanged": version_changed_handler, + "deprecated": deprecated_handler, } for k, v in config.items(): @@ -587,9 +588,6 @@ def _code_handler(self, argument, options, content): return [MCode(content)] - def _deprecated_handler(self, argument, options, content): - return admonition_helper("deprecated", argument, options, content) - def _toctree_handler(self, argument, options, content): assert not argument toc = []