Show More
@@ -659,3 +659,15 b' def fancy_file_stats(stats):' | |||
|
659 | 659 | d_d = '<div class="deleted %s" style="width:%s%%">%s</div>' % (cgen('d'), |
|
660 | 660 | d_p, d_v) |
|
661 | 661 | return literal('<div style="width:%spx">%s%s</div>' % (width, d_a, d_d)) |
|
662 | ||
|
663 | ||
|
664 | def urlify_text(text): | |
|
665 | import re | |
|
666 | ||
|
667 | url_pat = re.compile(r'(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)') | |
|
668 | ||
|
669 | def url_func(match_obj): | |
|
670 | url_full = match_obj.groups()[0] | |
|
671 | return '<a href="%(url)s">%(url)s</a>' % ({'url':url_full}) | |
|
672 | ||
|
673 | return literal(url_pat.sub(url_func, text)) |
General Comments 0
You need to be logged in to leave comments.
Login now