diff rhodecode/lib/markup_renderer.py @ 2201:ea5ff843b200 beta

#426 fixed mention extracting regex
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 18 Apr 2012 02:07:22 +0200
parents 8ecfed1d8f8b
children cdce3d7282b2
line wrap: on
line diff
--- a/rhodecode/lib/markup_renderer.py	Tue Apr 17 23:50:32 2012 +0200
+++ b/rhodecode/lib/markup_renderer.py	Wed Apr 18 02:07:22 2012 +0200
@@ -27,7 +27,7 @@
 import re
 import logging
 
-from rhodecode.lib.utils2 import safe_unicode
+from rhodecode.lib.utils2 import safe_unicode, MENTIONS_REGEX
 
 log = logging.getLogger(__name__)
 
@@ -128,10 +128,10 @@
 
     @classmethod
     def rst_with_mentions(cls, source):
-        mention_pat = re.compile(r'(?:^@|\s@)(\w+)')
+        mention_pat = re.compile(MENTIONS_REGEX)
 
         def wrapp(match_obj):
             uname = match_obj.groups()[0]
-            return ' **@%(uname)s** ' % {'uname':uname}
+            return ' **@%(uname)s** ' % {'uname': uname}
         mention_hl = mention_pat.sub(wrapp, source).strip()
         return cls.rst(mention_hl)