8000 gh-105812: [PoC] add :deco: role and adapt some rst files by erlend-aasland · Pull Request #118743 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-105812: [PoC] add :deco: role and adapt some rst files #118743

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

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use an inner node class to override the text representation
I'm probably butchering the Sphinx/docutils API here; apologies in advance
  • Loading branch information
erlend-aasland committed May 20, 2024
commit 9a2ed057c448e3b6421c1040f1fbae8443d9a3e4
9 changes: 6 additions & 3 deletions Doc/tools/extensions/pyspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,12 @@ def patch_pairindextypes(app, _env) -> None:


class PyDecoratorRole(PyXRefRole):
def process_link(self, *args, **kwds):
title, target = super().process_link(*args, **kwds)
return f"@{title}", target
class inner(nodes.literal):
def __init__(self, raw, text, *args, **kwds):
super().__init__(raw, f"@{text}", *args, **kwds)

def __init__(self, *args, **kwds):
super().__init__(*args, innernodeclass=PyDecoratorRole.inner, **kwds)


def setup(app):
Expand Down
0