diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1ca11df..6669e06 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v6.0.0 hooks: - id: trailing-whitespace exclude: ^tests/fixtures/.* @@ -16,14 +16,14 @@ repos: - id: check-added-large-files - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.1 + rev: v0.14.4 hooks: - id: ruff args: [--fix] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.18.2 hooks: - id: mypy additional_dependencies: diff --git a/python/sphinx_rust/directives/_core.py b/python/sphinx_rust/directives/_core.py index c6570c4..8fd9c5c 100644 --- a/python/sphinx_rust/directives/_core.py +++ b/python/sphinx_rust/directives/_core.py @@ -178,7 +178,7 @@ def create_object_xref( "reftarget": full_name, } ref = addnodes.pending_xref(full_name, **options) - name = full_name.split("::")[-1] + name = full_name.rsplit("::", maxsplit=1)[-1] ref += nodes.literal(name, name) return ref @@ -207,7 +207,7 @@ def create_source_xref( "classes": classes or [], } ref = addnodes.pending_xref(full_name, **options) - text = full_name.split("::")[-1] if text is None else text + text = full_name.rsplit("::", maxsplit=1)[-1] if text is None else text ref += nodes.literal(text, text) return ref