Use regex to prevent highlights in github module
This commit is contained in:
parent
6b41834a35
commit
4d4271435d
1 changed files with 3 additions and 9 deletions
|
@ -477,16 +477,10 @@ class Module(ModuleManager.BaseModule):
|
||||||
# will fire indefininitely.
|
# will fire indefininitely.
|
||||||
continue
|
continue
|
||||||
|
|
||||||
s_lower = server.irc_lower(s)
|
regex = re.compile(r".\b(%s)(%s)" % (
|
||||||
while user.nickname_lower in s_lower:
|
user.nickname[0], user.nickname[1:]), re.I)
|
||||||
index = s_lower.index(user.nickname_lower)
|
s = regex.sub("\\1\u200c\\2", s)
|
||||||
length = len(user.nickname_lower)
|
|
||||||
|
|
||||||
original = s[index:index+length]
|
|
||||||
original = utils.prevent_highlight(original)
|
|
||||||
|
|
||||||
s = s[:index] + original + s[index+length:]
|
|
||||||
s_lower = server.irc_lower(s)
|
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def _short_url(self, url):
|
def _short_url(self, url):
|
||||||
|
|
Loading…
Reference in a new issue