changeset 5118:beeb69476cc4 stable

comments: don't eat character before @mention when rendering to rst The character before @ should not only be ungrouped it should also not be eaten so re.sub still works as expected.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 13 May 2015 01:16:48 +0200
parents 1cc64983363a
children 15ac6f39f963
files kallithea/lib/utils2.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/utils2.py	Wed May 13 01:16:48 2015 +0200
+++ b/kallithea/lib/utils2.py	Wed May 13 01:16:48 2015 +0200
@@ -564,9 +564,9 @@
         return datetime.datetime.fromtimestamp(tm)
 
 # Must match regexp in kallithea/public/js/base.js MentionsAutoComplete()
-# Eat char before @ - it must not look like we are in an email addresses.
+# Check char before @ - it must not look like we are in an email addresses.
 # Matching is gready so we don't have to look beyond the end.
-MENTIONS_REGEX = re.compile(r'(?:^|[^a-zA-Z0-9])@([a-zA-Z0-9][-_.a-zA-Z0-9]*[a-zA-Z0-9])')
+MENTIONS_REGEX = re.compile(r'(?:^|(?<=[^a-zA-Z0-9]))@([a-zA-Z0-9][-_.a-zA-Z0-9]*[a-zA-Z0-9])')
 
 def extract_mentioned_users(s):
     r"""