From a5ed8947037da5f9d50efd17f70546986dd46c74 Mon Sep 17 00:00:00 2001
From: Dong-hee Na <donghee.na@python.org>
Date: Fri, 13 May 2022 00:42:22 +0900
Subject: [PATCH] =?UTF-8?q?[3.8]=20gh-92448:=20Update=20the=20documentatio?=
 =?UTF-8?q?n=20builder=20to=20render=20the=20GitHub=E2=80=A6=20(GH-92605)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

(cherry picked from commit 45e1721d100bab09510ccf9da49f14ca5cc268f4)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
---
 Doc/tools/extensions/pyspecific.py | 9 +++++----
 Misc/NEWS.d/3.7.0a3.rst            | 2 +-
 Misc/NEWS.d/3.8.0.rst              | 2 +-
 Misc/NEWS.d/3.8.0a1.rst            | 2 +-
 Misc/NEWS.d/3.8.2rc2.rst           | 2 +-
 5 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py
index cd9144ea09d..359d7645149 100644
--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -390,7 +390,8 @@ def run(self):
 
 # 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 (.*?)\??$")
 
 
@@ -417,9 +418,9 @@ def run(self):
             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:]
diff --git a/Misc/NEWS.d/3.7.0a3.rst b/Misc/NEWS.d/3.7.0a3.rst
index 8ef7a5118a1..3944825e15b 100644
--- a/Misc/NEWS.d/3.7.0a3.rst
+++ b/Misc/NEWS.d/3.7.0a3.rst
@@ -288,7 +288,7 @@ by Nir Soffer.
 
 ..
 
-.. bpo: 321010
+.. bpo: 32101
 .. date: 2017-11-29-00-42-47
 .. nonce: -axD5l
 .. section: Library
diff --git a/Misc/NEWS.d/3.8.0.rst b/Misc/NEWS.d/3.8.0.rst
index e72025cfca5..8e9ab4097e7 100644
--- a/Misc/NEWS.d/3.8.0.rst
+++ b/Misc/NEWS.d/3.8.0.rst
@@ -28,7 +28,7 @@ none were collected.
 .. nonce: 9TWMlz
 .. section: Library
 
-Revert GH-15522, which introduces a regression in
+Revert PR 15522, which introduces a regression in
 :meth:`mimetypes.guess_type` due to improper handling of filenames as urls.
 
 ..
diff --git a/Misc/NEWS.d/3.8.0a1.rst b/Misc/NEWS.d/3.8.0a1.rst
index 873f53b4503..da25b1970c6 100644
--- a/Misc/NEWS.d/3.8.0a1.rst
+++ b/Misc/NEWS.d/3.8.0a1.rst
@@ -4617,7 +4617,7 @@ Based on patch by c-fos.
 .. section: Library
 
 Remove HMAC default to md5 marked for removal in 3.8 (removal originally
-planned in 3.6, bump to 3.8 in gh-7062).
+planned in 3.6, bump to 3.8 in PR 7062).
 
 ..
 
diff --git a/Misc/NEWS.d/3.8.2rc2.rst b/Misc/NEWS.d/3.8.2rc2.rst
index fed6ceadb28..feadb3affc8 100644
--- a/Misc/NEWS.d/3.8.2rc2.rst
+++ b/Misc/NEWS.d/3.8.2rc2.rst
@@ -54,7 +54,7 @@ Syntax errors raised in the tokenizer now always set correct "text" and
 .. section: Library
 
 The original fix for bpo-27657, "Fix urlparse() with numeric paths"
-(GH-16839) included in 3.8.1, inadvertently introduced a behavior change
+(PR 16839) included in 3.8.1, inadvertently introduced a behavior change
 that broke several third-party packages relying on the original undefined
 parsing behavior. The change is reverted in 3.8.2, restoring the behavior of
 3.8.0 and earlier releases.
-- 
GitLab