Changeset - 025f3333c769
[Not reviewed]
beta
0 5 0
Marcin Kuzminski - 14 years ago 2011-12-08 02:36:13
marcin@python-works.com
@mention highlighting
5 files changed with 22 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/helpers.py
Show inline comments
 
@@ -717,3 +717,12 @@ def urlify_text(text):
 
def rst(source):
 
    return literal('<div class="rst-block">%s</div>' % 
 
                   MarkupRenderer.rst(source))
 
    
 
def rst_w_mentions(source):
 
    """
 
    Wrapped rst renderer with @mention highlighting
 
    
 
    :param source:
 
    """
 
    return literal('<div class="rst-block">%s</div>' % 
 
                   MarkupRenderer.rst_with_mentions(source))    
rhodecode/lib/markup_renderer.py
Show inline comments
 
@@ -127,3 +127,13 @@ class MarkupRenderer(object):
 
            log.warning('Install docutils to use this function')
 
            return cls.plain(source)
 

	
 
    @classmethod
 
    def rst_with_mentions(cls, source):
 
        mention_pat = re.compile(r'(?:^@|\s@)(\w+)')
 
        
 
        def wrapp(match_obj):
 
            uname = match_obj.groups()[0]
 
            return ' **@%(uname)s** ' % {'uname':uname}
 
        mention_hl = mention_pat.sub(wrapp, source).strip()
 
        return cls.rst(mention_hl)
 

	
rhodecode/model/notification.py
Show inline comments
 
@@ -104,7 +104,7 @@ class NotificationModel(BaseModel):
 
            email_subject = NotificationModel().make_description(notif, False)
 
            type_ = type_
 
            email_body = body
 
            kwargs = {'subject':subject, 'body':h.rst(body)}
 
            kwargs = {'subject':subject, 'body':h.rst_w_mentions(body)}
 
            kwargs.update(email_kwargs)
 
            email_body_html = EmailNotificationModel()\
 
                                .get_email_tmpl(type_, **kwargs)
rhodecode/templates/admin/notifications/show_notification.html
Show inline comments
 
@@ -39,7 +39,7 @@
 
            <span id="${c.notification.notification_id}" class="delete-notification delete_icon action"></span>
 
          </div>
 
        </div>
 
        <div>${h.rst(c.notification.body)}</div>
 
        <div>${h.rst_w_mentions(c.notification.body)}</div>
 
      </div>
 
    </div>
 
</div>
rhodecode/templates/changeset/changeset_file_comment.html
Show inline comments
 
@@ -25,7 +25,7 @@
 
  				<span onClick="deleteComment(${co.comment_id})" class="delete-comment ui-btn">${_('Delete')}</span>
 
  			</div>
 
  		%endif
 
  		${h.rst(co.text)|n}
 
  		${h.rst_w_mentions(co.text)|n}
 
  	</div>
 
  </div>
 
</%def>
0 comments (0 inline, 0 general)