Skip to content

Commit

Permalink
stubber: Docstubs tweak no-clean-rst actions.
Browse files Browse the repository at this point in the history
Signed-off-by: Jos Verlinde <[email protected]>
  • Loading branch information
Josverl committed Aug 23, 2024
1 parent 1a52519 commit bc9f58c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/stubber/rst/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ class Fix:
# also applies correction for some classes are documented as functions

RST_DOC_FIXES: List[Tuple[str, str]] = [
# remove rst highlights from docstrings
(":class: attention\n", ""),
# ------------------------------------------------------------------------------------------------
# re.rst - function and class with the same name
# done: issue https://github.com/micropython/micropython/issues/8273
Expand Down
6 changes: 5 additions & 1 deletion src/stubber/rst/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ def clean_docstr(self, block: List[str]):
return block

def add_link_to_docstr(self, block: List[str]):
"""Add clickable hyperlinks to CPython docpages"""
"""Add clickable hyperlinks to CPython docpages,
and clean the docstring from rst constructs"""
if not self.clean_rst:
return block

Expand All @@ -348,6 +349,9 @@ def add_link_to_docstr(self, block: List[str]):
_l = _l.replace(".. note:: ", "``Note:`` ")
_l = _l.replace(".. data:: ", "")
_l = _l.replace(".. admonition:: ", "Admonition:")
# remove rst highlights from docstrings
_l = _l.replace(":class: attention\n", "")
# Sphinx directive to link to CPython documentation
_l = _l.replace("|see_cpython_module|", "CPython module:")
# clean up unsupported escape sequences in rst
_l = _l.replace(r"\ ", " ")
Expand Down

0 comments on commit bc9f58c

Please sign in to comment.