You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [1]: fromttpimportttpIn [2]: p=ttp.Parser()
In [3]: res=p.parse("test (http://example.com)")
In [4]: res.urlsOut[4]: ['http://example.com']
In [5]: res.htmlOut[5]: u'test (<a href="http://example.com">http://example.com</a>)'
However, this does not:
In [6]: res=p.parse("test (http://example.com/directory)")
In [7]: res.urlsOut[7]: ['http://example.com/directory)']
In [8]: res.htmlOut[8]: u'test (<a href="http://example.com/directory)">http://example.com/directory)</a>'
Note the right parentheses being treated as part of the URL?
Thanks,
Lex
The text was updated successfully, but these errors were encountered:
lextoumbourou
changed the title
Urls surrounded by parenthesis with a path are being parsed correctly.
Urls surrounded by parenthesis with a path are being parsed incorrectly.
May 6, 2015
Since parentheses are valid within URLs, perhaps we could say that if there is an opening parentheses before the protocol, i.e. (http:// AND a closing paren at the end of the URL, then only in that case we can ignore/strip them. Because then we could probably assume the user intended to enclose the URL inside parens.
Hi @edburnett,
This works (and you've got a test for it ❤️):
However, this does not:
Note the right parentheses being treated as part of the URL?
Thanks,
Lex
The text was updated successfully, but these errors were encountered: