gh-92448: Update the documentation builder to render the GitHub issue. (GH-92449)

This commit is contained in:
Dong-hee Na 2022-05-08 21:50:40 +09:00 committed by GitHub
parent d284e8b3e3
commit 45e1721d10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 15 additions and 14 deletions

View file

@ -429,7 +429,8 @@ class DeprecatedRemoved(Directive):
# Support for including Misc/NEWS
issue_re = re.compile('(?:[Ii]ssue #|bpo-)([0-9]+)')
issue_re = re.compile('(?:[Ii]ssue #|bpo-)([0-9]+)', re.I)
gh_issue_re = re.compile('(?:gh-issue-|gh-)([0-9]+)', re.I)
whatsnew_re = re.compile(r"(?im)^what's new in (.*?)\??$")
@ -456,9 +457,9 @@ class MiscNews(Directive):
text = 'The NEWS file is not available.'
node = nodes.strong(text, text)
return [node]
content = issue_re.sub(r'`bpo-\1 <https://bugs.python.org/'
r'issue?@action=redirect&bpo=\1>`__',
content)
content = issue_re.sub(r':issue:`\1`', content)
# Fallback handling for the GitHub issue
content = gh_issue_re.sub(r':gh:`\1`', content)
content = whatsnew_re.sub(r'\1', content)
# remove first 3 lines as they are the main heading
lines = ['.. default-role:: obj', ''] + content.splitlines()[3:]