Skip to content

Commit

Permalink
Update with the latest revision of John Gruber's URL-finding regular …
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtraschke committed Jul 28, 2010
1 parent ef83488 commit d254234
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions textile/functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

__copyright__ = """
Copyright (c) 2009, Jason Samsa, http://jsamsa.com/
Expand Down Expand Up @@ -754,8 +755,7 @@ def autoLink(self, text):
'"http://www.ya.ru":http://www.ya.ru'
"""

pattern = re.compile(
r"\b(([\w-]+://?|www[.])[^\s()<>]+(?:(?:\([\w\d)]+\)[^\s()<>]*)+|([^%s\s]|/)))" % re.escape(string.punctuation), re.U)
pattern = re.compile(r"""\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))""", re.U | re.I)
return pattern.sub(r'"\1":\1', text)

def links(self, text):
Expand Down

0 comments on commit d254234

Please sign in to comment.