Skip to content

Commit

Permalink
Fixed PEP8 role usage in changelog for PyPI description
Browse files Browse the repository at this point in the history
  • Loading branch information
runfalk committed May 9, 2017
1 parent 0e9d837 commit 4ce4f5b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ def role_simplifier(processor, role, argument, content):
return format.get(role, "``{}``").format(content + extra.get(role, ""))


@rst_pre_processor.add_role("pep8")
def pep_simplifier(processor, role, argument, content):
matches = re.match(r"(?P<pep>\d+)(?P<anchor>#[^$]+)?", content)

if matches is None:
return "``PEP{}``".format(content)

fmt = "`PEP{pep} <https://www.python.org/dev/peps/pep-{pep:>04}/{anchor}>`_"
print(matches.groupdict())
return fmt.format(**matches.groupdict())


@rst_pre_processor.add_block("include")
def includer(processor, block, args, extra, content):
with open(args) as fp:
Expand Down

0 comments on commit 4ce4f5b

Please sign in to comment.