improve link detection (enclosed in braces)

This commit is contained in:
lars 2010-05-10 09:13:39 +00:00
parent a445d1f6cd
commit c6fe7356bf

View file

@ -81,7 +81,7 @@ class ContentSubmission(sqlobject.SQLObject):
short_name = url.split("/")[2]
return """%s<a href="%s">%s</a>%s""" % (prefix, url, short_name, suffix)
# surround all urls with html markup
mark_links = re.sub(r"(\A|\s)(https?://[\w/\?\.\#=;,]*)(\s|\Z)", get_link_markup, self.content)
mark_links = re.sub(r"(\A|\s|\()(https?://[\w/\?\.\#=;,_\-]*)(\)|\s|\Z)", get_link_markup, self.content)
markup = genshi.input.HTML(mark_links) | genshi.filters.HTMLSanitizer()
# the markup is now marked as "safe" -> genshi will output it literally
return markup
@ -596,6 +596,7 @@ def render_poll_admin(poll, add_related, del_related):
return render("poll_admin_details.html", **value_dict)
@bobo.query('/:poll_hash')
@bobo.query('/:poll_hash/')
def show_one_poll(poll_hash=None, add_related=None, del_related=None):
value_dict = get_default_values()
poll_id = get_poll_id(poll_hash)