Code Monkey home page Code Monkey logo

Comments (5)

jsocol avatar jsocol commented on August 15, 2024

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?

from bleach.

SmileyChris avatar SmileyChris commented on August 15, 2024

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)

from bleach.

voidfiles avatar voidfiles commented on August 15, 2024

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/).'

from bleach.

jsocol avatar jsocol commented on August 15, 2024

Thanks @voidfiles, I filled #49.

from bleach.

vitalyvolkov avatar vitalyvolkov commented on August 15, 2024

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>.'
>>> 

from bleach.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.