Hey,
html purifier in drupal removes the HR tag when preceded by closing P tag and followed by an opening P tag except when those P's contain only a nbsp.

That is, <p>foo</p><hr /><p>bar</p> doesn't work but <p>&nbsp;</p><hr /><p>&nbsp;</p> does.

I have disabled all other filters, and have default settings for htmlpurifier.
However, if I put the same html in http://htmlpurifier.org/demo.php, there is no such problem, so I'd say the problem is probably in the drupal module.

Can you reproduce it or is it just me? :)

Thanks

Comments

himdel’s picture

Also, ...something</ul><hr /><p>something... works just fine, the problem is only when there's a P on both sides.

ezyang’s picture

Assigned: Unassigned » ezyang

I can't seem to get hr tags to get output by Drupal at all, regardless of surrounding text. This is kind of strange. Investigating.

ezyang’s picture

Assigned: ezyang » Unassigned
Status: Active » Postponed (maintainer needs more info)

Oh no, I was mistaken. (I accidentally had an unclosed a tag in my post, which was causing hr to be disallowed). Are you sure you don't have any context HTML that could be messing up the hr tags? If you could find the line that has "$ret = $purifier->purify($text);" and then give me the contents of $ret and $text by placing a "var_dump($ret); var_dump($text);" afterwards that would also be useful.

iori57’s picture

Any updates on this?

I'm using the latest html purifier version 6.x-2.1 and having the exact same problem :)

himdel is right, putting </ol><hr /><p> it will work fine... I manually add in <ol></ol> before every <hr /> tag and they all came out perfectly =.=

iori57’s picture

I did an experiment, I input:
<hr />
<hr />
<p>abc</p>
<hr />
<hr />
<hr />

and the final html after purified is:
<hr />
<hr />
<p>abc</p>
<p>
</p>

seems that any <hr /> after paragraph <p> will some how disappear into thin air.. those before it will have no problem :)

kruser’s picture

Status: Fixed » Postponed (maintainer needs more info)

This was annoying for a while, but I got this to work by stripping out the blank spaces on either side of the


.

worked:

</p></div><hr /><h2> 

didn't work:

</p></div>
<hr />
<h2>vasvasva</h2>
iori57’s picture

2440media2: can't read what you're writing..

ezyang’s picture

Status: Postponed (maintainer needs more info) » Needs work

This is a bug tickled by the AutoParagraph option (you can see this trigger if you turn on autoparagraphing in the demo page). It's a bug in the HTML Purifier library.

ezyang’s picture

Status: Needs work » Fixed

Fixed in HTML Purifier trunk. You can grab the patch here: http://repo.or.cz/w/htmlpurifier.git/commit/694583259c3d2a6d1a30fc5e9755...

kruser’s picture

Status: Postponed (maintainer needs more info) » Fixed

sorry, I fixed that - forgot code tags

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.