Skip to content

Commit

Permalink
move more directives
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Dec 24, 2023
1 parent 339aa20 commit 3e6555d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions papyri/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
6 changes: 2 additions & 4 deletions papyri/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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 = []
Expand Down

0 comments on commit 3e6555d

Please sign in to comment.