Show More
@@ -717,3 +717,12 b' def urlify_text(text):' | |||
|
717 | 717 | def rst(source): |
|
718 | 718 | return literal('<div class="rst-block">%s</div>' % |
|
719 | 719 | MarkupRenderer.rst(source)) |
|
720 | ||
|
721 | def rst_w_mentions(source): | |
|
722 | """ | |
|
723 | Wrapped rst renderer with @mention highlighting | |
|
724 | ||
|
725 | :param source: | |
|
726 | """ | |
|
727 | return literal('<div class="rst-block">%s</div>' % | |
|
728 | MarkupRenderer.rst_with_mentions(source)) |
@@ -127,3 +127,13 b' class MarkupRenderer(object):' | |||
|
127 | 127 | log.warning('Install docutils to use this function') |
|
128 | 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 |
@@ -104,7 +104,7 b' class NotificationModel(BaseModel):' | |||
|
104 | 104 | email_subject = NotificationModel().make_description(notif, False) |
|
105 | 105 | type_ = type_ |
|
106 | 106 | email_body = body |
|
107 | kwargs = {'subject':subject, 'body':h.rst(body)} | |
|
107 | kwargs = {'subject':subject, 'body':h.rst_w_mentions(body)} | |
|
108 | 108 | kwargs.update(email_kwargs) |
|
109 | 109 | email_body_html = EmailNotificationModel()\ |
|
110 | 110 | .get_email_tmpl(type_, **kwargs) |
General Comments 0
You need to be logged in to leave comments.
Login now