'>>> t = Textile()
>>> t.links(\'fooobar "Google":http://google.com/foobar/ and hello world "flickr":http://flickr.com/photos/jsamsa/ \') # doctest: +ELLIPSIS
\'fooobar ... and hello world ...\''

def links(self, text):

    text = self.macros_only(text)
    punct = '!"#$%&\'*+,-./:;=?@\\^_`|~'
    pattern = ('\n                                                (?P<pre>                [\\s\\[{(]|[%s]            )?\n                                                "                                                                                                        #    start\n                                                (?P<atts>            %s                            )\n                                                (?P<text>            [^"]+?            )\n                                                \\s?\n                                                (?:            \\(([^)]+?)\\)(?=")            )?                    #    $title\n                                                ":\n                                                (?P<url>                (?:ftp|https?)?    (?:    ://    )?    [-A-Za-z0-9+&@#/?=~_()|!:,.;]*[-A-Za-z0-9+&@#/=~_()|]            )\n                                                (?P<post>            [^\\w\\/;]*?            )\n                                                (?=<|\\s|$)\n                                ' % (re.escape(punct), self.c))
    text = re.compile(pattern, re.X).sub(self.fLink, text)
    return text
