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

Allow stripping "a" tags #28

Open
shagi opened this issue Feb 6, 2012 · 3 comments
Open

Allow stripping "a" tags #28

shagi opened this issue Feb 6, 2012 · 3 comments

Comments

@shagi
Copy link

shagi commented Feb 6, 2012

Currently it's very difficult (if not impossible) to use djangoembed with
any markup format. I'm using restructured text, with the same goes for
textile, markdown, etc.

The big problem is that in markup rich text all links are enclosed in a "a"
element, so djangoembed never changes those links.

It would be great if I could set OEMBED_STRIP_LINKS=True or something
like that in django settings.

I have played a bit with the code and could send a patch or pull request
for this, but I'm not very confident with my proposal. Maybe there's a
better way to get this working?

@coleifer
Copy link
Contributor

coleifer commented Feb 6, 2012

Yeah, this is a tricky one... I use markdown on my blog (ew, which i would've used ReST to begin with), so I do blog.entry|markdown|oembed ... but i can see how using something that automatically links things would make this hard. It might be possible to modify the beautifulsoup parser to, if inside an A tag, go up the DOM and replace out the whole thing.

@shagi
Copy link
Author

shagi commented Feb 8, 2012

Yes, in my experiment I do just that, but don't understand the template_dir = 'inline' part of HTMLParser.parse_data, so I'm not very confident with my code.

@coleifer
Copy link
Contributor

coleifer commented Feb 8, 2012

It allows you to render oembed-able things differently depending on whether the link is on a line by itself or whehter it is interspersed with text. In the former you prob drop in a div / player / etc. In the latter maybe just a link with descriptive text so as not to break up the apragraph.

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

No branches or pull requests

2 participants