Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linkify eats brackets in inner text. #23

Closed
vitalyvolkov opened this issue Mar 28, 2011 · 5 comments
Closed

Linkify eats brackets in inner text. #23

vitalyvolkov opened this issue Mar 28, 2011 · 5 comments
Labels

Comments

@vitalyvolkov
Copy link

import bleach
bleach.linkify('http://aslobodyan.net/sysiq2/)\n')
u'<a href="http://aslobodyan.net/sysiq2/)" rel="nofollow">http://aslobodyan.net/sysiq2/)</a>\n'

As you can see there is closed bracket inside text of link.

@jsocol
Copy link
Contributor

jsocol commented Mar 28, 2011

I'm not sure I'm following. The example makes it look like linkify isn't picking up the link at all, e.g.:

>>> import bleach
>>> bleach.linkify('http://example.com/foo)')
u'http://example.com/foo)'

Is that correct?

@SmileyChris
Copy link
Contributor

No, the issue is that the bracket is getting swallowed as part of the link, when most of the time it's more likely that it is part of plain text:

For example:

u'(<a href="http://example.com" rel="nofollow">example.com</a>)'

> > > bleach.linkify("(example.com/)")
> > > u'(<a href="http://example.com/)" rel="nofollow">example.com/)</a>'```

The decision just needs to be made as which one is more important to get right, since some urls _may_ end in a bracket. E.g.: http://en.wikipedia.org/wiki/Test_(assessment)

@jsocol jsocol closed this as completed in 2768bf1 Aug 18, 2011
@voidfiles
Copy link

This is still an issue, here is an example.

In [18]: linkify('(http://www.google.com/)')
Out[18]: u'(http://www.google.com/)'

In [19]: linkify('(http://www.google.com/).')
Out[19]: u'(http://www.google.com/).'

@jsocol
Copy link
Contributor

jsocol commented Oct 22, 2011

Thanks @voidfiles, I filled #49.

@vitalyvolkov
Copy link
Author

Currently brackets are again swallowed. For example:

>>> import bleach
>>> bleach.linkify(u'Один из подходов нашего «пути китайского пионера» при вэб-разработке - backvendor (http://www.yiiframework.com/extension/backvendor/).')
u'\u041e\u0434\u0438\u043d \u0438\u0437 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043d\u0430\u0448\u0435\u0433\u043e \xab\u043f\u0443\u0442\u0438 \u043a\u0438\u0442\u0430\u0439\u0441\u043a\u043e\u0433\u043e \u043f\u0438\u043e\u043d\u0435\u0440\u0430\xbb \u043f\u0440\u0438 \u0432\u044d\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 - backvendor (<a href="http://www.yiiframework.com/extension/backvendor/)" rel="nofollow">http://www.yiiframework.com/extension/backvendor/)</a>.'
>>> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants