Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'pyspecific',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
]

# Skip if downstream redistributors haven't installed it
Expand Down Expand Up @@ -500,6 +501,11 @@
refcount_file = 'data/refcounts.dat'
stable_abi_file = 'data/stable_abi.dat'

# sphinx.ext.extlinks config
extlinks = {
'cve': ('https://www.cve.org/CVERecord?id=CVE-%s', 'CVE-%s'),
}

# sphinxext-opengraph config
ogp_site_url = 'https://docs.python.org/3/'
ogp_site_name = 'Python documentation'
Expand Down
2 changes: 2 additions & 0 deletions Doc/tools/extensions/pyspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ def run(self):

issue_re = re.compile('(?:[Ii]ssue #|bpo-)([0-9]+)', re.I)
gh_issue_re = re.compile('(?:gh-issue-|gh-)([0-9]+)', re.I)
cve_re = re.compile('CVE-([0-9]{4}-[0-9]{4,})', re.I)
whatsnew_re = re.compile(r"(?im)^what's new in (.*?)\??$")


Expand Down Expand Up @@ -525,6 +526,7 @@ def run(self):
content = issue_re.sub(r':issue:`\1`', content)
# Fallback handling for the GitHub issue
content = gh_issue_re.sub(r':gh:`\1`', content)
content = cve_re.sub(r':cve:`\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:]
Expand Down
Loading