Mercurial > kallithea
comparison rhodecode/lib/markup_renderer.py @ 1769:025f3333c769 beta
@mention highlighting
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 08 Dec 2011 03:36:13 +0200 |
parents | bb3c2111bf92 |
children | cf51bbfb120e |
comparison
equal
deleted
inserted
replaced
1768:5610fd9b6803 | 1769:025f3333c769 |
---|---|
125 return parts['html_title'] + parts["fragment"] | 125 return parts['html_title'] + parts["fragment"] |
126 except ImportError: | 126 except ImportError: |
127 log.warning('Install docutils to use this function') | 127 log.warning('Install docutils to use this function') |
128 return cls.plain(source) | 128 return cls.plain(source) |
129 | 129 |
130 @classmethod | |
131 def rst_with_mentions(cls, source): | |
132 mention_pat = re.compile(r'(?:^@|\s@)(\w+)') | |
133 | |
134 def wrapp(match_obj): | |
135 uname = match_obj.groups()[0] | |
136 return ' **@%(uname)s** ' % {'uname':uname} | |
137 mention_hl = mention_pat.sub(wrapp, source).strip() | |
138 return cls.rst(mention_hl) | |
139 |