Skip to content

Commit 135e66f

Browse files
authored
Infra: Link topic index pages in rendered PEP topic headers (#2689)
1 parent dd1d44c commit 135e66f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pep_sphinx_extensions/pep_processor/transforms/pep_headers.py

+11
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@ def apply(self) -> None:
9898
target = self.document.settings.pep_url.format(int(pep_str))
9999
new_body += [nodes.reference("", pep_str, refuri=target), nodes.Text(", ")]
100100
para[:] = new_body[:-1] # drop trailing space
101+
elif name == "topic":
102+
new_body = []
103+
for topic_name in body.astext().split(","):
104+
if topic_name:
105+
target = f"/topic/{topic_name.lower().strip()}/"
106+
new_body += [
107+
nodes.reference("", topic_name, refuri=target),
108+
nodes.Text(", "),
109+
]
110+
if new_body:
111+
para[:] = new_body[:-1] # Drop trailing space/comma
101112
elif name in {"last-modified", "content-type", "version"}:
102113
# Mark unneeded fields
103114
fields_to_remove.append(field)

0 commit comments

Comments
 (0)