File tree 1 file changed +8
-1
lines changed 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ def check_hyperlink(match):
115
115
"""The span checking of regex matches takes care of cases like bpo-123 [bpo-123]…"""
116
116
issue = match .group ("issue" )
117
117
markdown_link_re = re .compile (r"""
118
- \[\s*bpo-(?P<issue>{issue})\s*\]
118
+ \[\s*bpo-(?P<issue>{issue})\s*\]
119
119
\(\s*https://bugs.python.org/issue{issue}\s*\)""" .format (issue = issue ),
120
120
re .VERBOSE )
121
121
html_link_re = re .compile (r""" <a
@@ -140,6 +140,12 @@ def create_hyperlink_in_comment_body(body):
140
140
new_body = ""
141
141
leftover_body = body
142
142
ISSUE_RE = re .compile (r"bpo-(?P<issue>\d+)" )
143
+
144
+ # leave code blocks, inline or otherwise, untouched
145
+ CODE_BLOCK = re .compile (r"(`{1,3})(.|\s)*(`{1,3})" )
146
+ if CODE_BLOCK .search (body ):
147
+ return body
148
+
143
149
while True :
144
150
match = ISSUE_RE .search (leftover_body )
145
151
if match is None :
@@ -153,4 +159,5 @@ def create_hyperlink_in_comment_body(body):
153
159
new_body = new_body + leftover_body [:presence ]
154
160
leftover_body = leftover_body [presence :]
155
161
new_body = new_body + leftover_body
162
+
156
163
return new_body
You can’t perform that action at this time.
0 commit comments