Skip to content

Commit ec9a9f5

Browse files
committed
pep2html: New Post-History handling
1 parent bb0368a commit ec9a9f5

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎pep2html.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,25 @@ def apply(self):
493493
para[:] = [nodes.reference('', pep_type, refuri=uri)]
494494
elif name == 'version' and len(body):
495495
utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions)
496+
elif name == 'post-history':
497+
new_nodes = []
498+
for pair in body.astext().split(","):
499+
pair = pair.strip()
500+
try:
501+
# if Post-History has no links, ``pair.split(maxsplit=1)``
502+
# will raise ValueError
503+
date, uri = pair.split(maxsplit=1)
504+
node = nodes.reference("",
505+
date.strip(),
506+
refuri=uri.strip(" \n\r\t><"),
507+
internal=False,
508+
)
509+
except ValueError:
510+
node = nodes.Text(pair)
511+
512+
new_nodes += [node, nodes.Text(", ")]
513+
514+
body[0][:] = new_nodes[:-1] # remove final ', '
496515

497516

498517
class PEPFooter(Transform):

0 commit comments

Comments
 (0)