mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-03 13:21:51 +00:00
[2.1.0] Fix another AutoParagraph edge-case.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1295 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
fab6a212c8
commit
733868a76d
@ -166,7 +166,14 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
|
||||
$needs_start = false;
|
||||
$needs_end = false;
|
||||
|
||||
for ($i = 0, $c = count($raw_paragraphs); $i < $c; $i++) {
|
||||
$c = count($raw_paragraphs);
|
||||
if ($c == 1) {
|
||||
// there were no double-newlines, abort quickly
|
||||
$result[] = new HTMLPurifier_Token_Text($data);
|
||||
return;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $c; $i++) {
|
||||
$par = $raw_paragraphs[$i];
|
||||
if (trim($par) !== '') {
|
||||
$paragraphs[] = $par;
|
||||
|
@ -261,6 +261,11 @@ Par1
|
||||
'<div><div>asdf</div><p><b>asdf</b></p></div>'
|
||||
);
|
||||
|
||||
$this->assertResult(
|
||||
'<b>One</b> <i>Two</i>',
|
||||
'<p><b>One</b> <i>Two</i></p>'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function testInlineRootNode() {
|
||||
|
Loading…
Reference in New Issue
Block a user