Support "bpo-" in Misc/NEWS (#1) · python/cpython@79ab8be

Original file line numberDiff line numberDiff line change

@@ -34,7 +34,7 @@

3434
3535
3636

ISSUE_URI = 'https://bugs.python.org/issue%s'

37-

SOURCE_URI = 'https://hg.python.org/cpython/file/3.6/%s'

37+

SOURCE_URI = 'https://github.com/python/cpython/tree/master/%s'

3838
3939

# monkey-patch reST parser to disable alphabetic and roman enumerated lists

4040

from docutils.parsers.rst.states import Body

@@ -79,7 +79,7 @@ def new_depart_literal_block(self, node):

7979
8080

def issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):

8181

issue = utils.unescape(text)

82-

text = 'issue ' + issue

82+

text = 'bpo-' + issue

8383

refnode = nodes.reference(text, text, refuri=ISSUE_URI % issue)

8484

return [refnode], []

8585

@@ -225,7 +225,7 @@ def run(self):

225225
226226

# Support for including Misc/NEWS

227227
228-

issue_re = re.compile('([Ii])ssue #([0-9]+)')

228+

issue_re = re.compile('(?:[Ii]ssue #|bpo-)([0-9]+)')

229229

whatsnew_re = re.compile(r"(?im)^what's new in (.*?)\??$")

230230
231231

@@ -253,7 +253,7 @@ def run(self):

253253

text = 'The NEWS file is not available.'

254254

node = nodes.strong(text, text)

255255

return [node]

256-

content = issue_re.sub(r'`\1ssue #\2 <https://bugs.python.org/\2>`__',

256+

content = issue_re.sub(r'`bpo-\1 <https://bugs.python.org/issue\1>`__',

257257

content)

258258

content = whatsnew_re.sub(r'\1', content)

259259

# remove first 3 lines as they are the main heading