Skip to content

Commit

Permalink
Infra: Link topic index pages in rendered PEP topic headers (#2689)
Browse files Browse the repository at this point in the history
  • Loading branch information
CAM-Gerlach authored Jun 29, 2022
1 parent dd1d44c commit 135e66f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pep_sphinx_extensions/pep_processor/transforms/pep_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ def apply(self) -> None:
target = self.document.settings.pep_url.format(int(pep_str))
new_body += [nodes.reference("", pep_str, refuri=target), nodes.Text(", ")]
para[:] = new_body[:-1] # drop trailing space
elif name == "topic":
new_body = []
for topic_name in body.astext().split(","):
if topic_name:
target = f"/topic/{topic_name.lower().strip()}/"
new_body += [
nodes.reference("", topic_name, refuri=target),
nodes.Text(", "),
]
if new_body:
para[:] = new_body[:-1] # Drop trailing space/comma
elif name in {"last-modified", "content-type", "version"}:
# Mark unneeded fields
fields_to_remove.append(field)
Expand Down

0 comments on commit 135e66f

Please sign in to comment.