Skip to content

Commit 7f03fba

Browse files
authored
Merge pull request scipy#22013 from lucascolley/gh-lists-asterisks
DEV: `gh_lists`: fix asterisk sanitisation
2 parents bfd452a + e3c6f42 commit 7f03fba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tools/gh_lists.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ def backtick_repl(matchobj):
5353
else:
5454
post = matchobj.group(2)
5555
return '``' + matchobj.group(1) + '``' + post
56+
57+
def asterisk_repl(matchobj):
58+
"""repl to un-escape asterisks in code blocks"""
59+
code = matchobj.group(1).replace("\\*", "*")
60+
return '``' + code + '``'
5661

5762
for issue in items:
5863
msg = "* `#{0} <{1}>`__: {2}"
@@ -69,6 +74,8 @@ def backtick_repl(matchobj):
6974

7075
# sanitize asterisks
7176
title = title.replace('*', '\\*')
77+
# except those in code blocks
78+
title = re.sub("``(.*?)``", asterisk_repl, title)
7279

7380
if len(title) > 60:
7481
remainder = re.sub("\\s.*$", "...", title[60:])

0 commit comments

Comments
 (0)