Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #490 #493

Merged
merged 3 commits into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

- Switch from `setup.py` to `pyproject.toml` for pdoc itself. Please file an issue if that causes any problems.
([#474](https://github.com/mitmproxy/pdoc/issues/474), @mhils)
- Fix broken links for inherited methods if both parent and subclass have the same name.
([#493](https://github.com/mitmproxy/pdoc/pull/493), @mhils)

## 2022-11-15: pdoc 12.3.0

Expand Down
14 changes: 12 additions & 2 deletions pdoc/render_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,18 @@ def link(context: Context, spec: tuple[str, str], text: str | None = None) -> st
modulename, qualname = spec

# Check if the object we are interested is also imported and re-exposed in the current namespace.
doc = mod.get(qualname)
if doc and doc.taken_from == spec and context["is_public"](doc).strip():
# https://github.com/mitmproxy/pdoc/issues/490: We need to do this for every level, not just the tail.
doc: pdoc.doc.Doc | None = mod
for part in qualname.split("."):
doc = doc.get(part) if isinstance(doc, pdoc.doc.Namespace) else None
if not (
doc
and doc.taken_from[0] == modulename
and context["is_public"](doc).strip()
):
break
else:
# everything down to the tail is imported and re-exposed.
if text:
text = text.replace(f"{modulename}.", f"{mod.modulename}.")
modulename = mod.modulename
Expand Down
Loading