Skip to content

Commit

Permalink
Fix :py: directives shown in toc
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 15, 2024
1 parent f9e1d1e commit 7919842
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion autoautosummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@

def new_extract_summary(doc: list[str], document: Any) -> str:
res = old_extract_summary(doc, document)
res = re.sub(r"\`((?!(?:None|True|False))[a-zA-Z0-9_]+)\`", r"\1", res)
# we only want to remove the surrounding ` from argument names here.
# So we don't want to match:
# - literals, e.g. None, True, False
# - :py: directives (e.g. links to other classes)
res = re.sub(r"(?<!:)`((?!None|True|False)[a-zA-Z0-9_]+)`", r"\1", res)
return res


Expand Down

0 comments on commit 7919842

Please sign in to comment.