mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-14 01:08:41 +00:00
Fix autoparagraph bug with non-inline elements.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
parent
bde4de3c78
commit
694583259c
@ -34,6 +34,7 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
|
|||||||
// ----
|
// ----
|
||||||
// This is a degenerate case
|
// This is a degenerate case
|
||||||
} else {
|
} else {
|
||||||
|
if (!$token->is_whitespace || $this->_isInline($current)) {
|
||||||
// State 1.2: PAR1
|
// State 1.2: PAR1
|
||||||
// ----
|
// ----
|
||||||
|
|
||||||
@ -44,6 +45,10 @@ class HTMLPurifier_Injector_AutoParagraph extends HTMLPurifier_Injector
|
|||||||
// ------------
|
// ------------
|
||||||
$token = array($this->_pStart());
|
$token = array($this->_pStart());
|
||||||
$this->_splitText($text, $token);
|
$this->_splitText($text, $token);
|
||||||
|
} else {
|
||||||
|
// State 1.5: \n<hr />
|
||||||
|
// --
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// State 2: <div>PAR1... (similar to 1.4)
|
// State 2: <div>PAR1... (similar to 1.4)
|
||||||
|
@ -497,6 +497,13 @@ Bar</div>",
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testAutoClose() {
|
||||||
|
$this->assertResult(
|
||||||
|
'<p></p>
|
||||||
|
<hr />'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function testErrorNeeded() {
|
function testErrorNeeded() {
|
||||||
$this->config->set('HTML.Allowed', 'b');
|
$this->config->set('HTML.Allowed', 'b');
|
||||||
$this->expectError('Cannot enable AutoParagraph injector because p is not allowed');
|
$this->expectError('Cannot enable AutoParagraph injector because p is not allowed');
|
||||||
|
@ -123,8 +123,6 @@ asdf<b></b></p>
|
|||||||
|
|
||||||
<p>asdf</p>
|
<p>asdf</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"
|
"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user