Changeset 774


Ignore:
Timestamp:
May 20, 2006, 11:25:41 AM (18 years ago)
Author:
Christian Boos
Message:

WikiGoodiesPlugin:

Added transformation of e-mail addresses into mailto: links.

Location:
wikigoodiesplugin/0.9/goodies
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wikigoodiesplugin/0.9/goodies/__init__.py

    r356 r774  
    33from symbols import Symbols
    44from mozilla import Mozilla
     5from mailto import MailToLink
    56
    67
  • wikigoodiesplugin/0.9/goodies/mailto.py

    r773 r774  
    1111
    1212from trac.core import implements, Component
     13from trac.util.markup import html
    1314from trac.wiki import IWikiSyntaxProvider
    1415
    1516
    16 class Mozilla(Component):
     17class MailToLink(Component):
    1718
    1819    implements(IWikiSyntaxProvider)
     
    2122
    2223    def get_wiki_syntax(self):
    23         word = r"[\w'!]+"
    24         yield (r"(?:^|(?<=\W))(?:\*%s\*|/%s/|_%s_)(?:(?=\W)|$)" % ((word,)*3),
    25                lambda x, y, z: (y[0] == '*' and '<strong>%s</strong>' or
    26                                 y[0] == '/' and '<em>%s</em>' or
    27                                 '<span class="underline">%s</span>') % y[1:-1])
     24        yield (r"<[^@]+@[^>]+>",
     25               lambda x, y, z: html.A(y, href="mailto:%s" % y[1:-1]))
    2826
    2927    def get_link_resolvers(self):
Note: See TracChangeset for help on using the changeset viewer.