-
Notifications
You must be signed in to change notification settings - Fork 143
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
Closing slashes in single tags (img, br) #47
Comments
That blog post was the initial announcement of Sanitize, back when Sanitize's output was XHTML by default. Since version 2.0, the default output format has been HTML. To preserve XHTML self-closing tags, just set the |
Thank you very much for the help and for this very useful library! :) |
But wait a sec, I still don't see the expected behaviour here. html = '<b><a href="http://foo.com/">foo</a></b><img src="http://foo.com/bar.jpg" />'
Sanitize.clean(html,Sanitize::Config::RELAXED.merge({:output => :xhtml}))
#=> "<b>\n<a href=\"http://foo.com/\">foo</a>\n</b><img src=\"http://foo.com/bar.jpg\" />" Now there are |
I can't reproduce this. I get the expected output:
What version of Ruby and Nokogiri do you have installed? |
I use ree-1.8.7-head (via rvm) and nokogiri-1.5.0 |
You're right. With Ruby 1.8.7 and Nokogiri 1.5.0, I get extra newlines. This definitely isn't anything Sanitize is doing though. It also happens when I call Nokogiri directly:
You may want to file a bug against Nokogiri. |
Thank you! |
There's an example use case here: http://wonko.com/post/sanitize
It's actually very close to the Readme example, but differs a bit.
Please note the closing slash on the image tag - that's what I would actually expect as the result.
In reality the same example cuts out that slash:
Same happens to slashes in br tags for example.
Is there a way to keep these slashes?
Thank you.
The text was updated successfully, but these errors were encountered: