Skip to content

Commit

Permalink
Remove special PEP 0 post-processing
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed May 21, 2022
1 parent 57f9d35 commit eff422b
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions pep_sphinx_extensions/pep_processor/transforms/pep_zero.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def __init__(self, document: nodes.document):
super().__init__(document)
self.pep_table: int = 0
self.entry: int = 0
self.ref: str | None = None

def unknown_visit(self, node: nodes.Node) -> None:
"""No processing for undefined node types."""
Expand Down Expand Up @@ -58,30 +57,13 @@ def visit_colspec(self, node: nodes.colspec) -> None:

def visit_row(self, _node: nodes.row) -> None:
self.entry = 0 # reset column number
self.ref = None # Reset PEP URL

def visit_entry(self, node: nodes.entry) -> None:
self.entry += 1
if not self.pep_table:
return
if self.entry == 2 and len(node) == 1:
node["classes"].append("num")
# if this is the PEP number column, replace the number with a link to the PEP
para = node[0]
if isinstance(para, nodes.paragraph) and len(para) == 1:
pep_str = para.astext()
try:
pep_num = int(pep_str)
except ValueError:
return
self.ref = self.document.settings.pep_url.format(pep_num)
para[0] = nodes.reference("", pep_str, refuri=self.ref)
elif self.entry == 3 and len(node) == 1 and self.ref:
# If this is the PEP title column, add a link to the PEP
para = node[0]
if isinstance(para, nodes.paragraph) and len(para) == 1:
pep_title = para.astext()
para[0] = nodes.reference("", pep_title, refuri=self.ref)


def _mask_email(ref: nodes.reference) -> nodes.reference:
Expand Down

0 comments on commit eff422b

Please sign in to comment.