0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-09-18 18:25:18 +00:00

[1.7.0] StrictBlockquote child definition refrains from wrapping whitespace in tags now.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1159 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2007-06-18 19:53:46 +00:00
parent 32d30a9181
commit 220c150e0a
3 changed files with 8 additions and 2 deletions

2
NEWS
View File

@ -41,6 +41,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
- Deprecated and removed EnableRedundantUTF8Cleaning. It didn't even work!
- DOMLex will not emit errors when a custom error handler that does not
honor error_reporting is used
- StrictBlockquote child definition refrains from wrapping whitespace
in tags now.
. Unit test for ElementDef created, ElementDef behavior modified to
be more flexible
. Added convenience functions for HTMLModule constructors

View File

@ -45,8 +45,8 @@ extends HTMLPurifier_ChildDef_Required
if (!$is_inline) {
if (!$depth) {
if (
$token->type == 'text' ||
!isset($this->elements[$token->name])
($token->type == 'text' && !$token->is_whitespace) ||
($token->type != 'text' && !isset($this->elements[$token->name]))
) {
$is_inline = true;
$ret[] = $block_wrap_start;

View File

@ -11,10 +11,13 @@ extends HTMLPurifier_ChildDefHarness
$this->obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p');
// assuming default wrap is p
$this->assertResult('');
$this->assertResult('<p>Valid</p>');
$this->assertResult('<div>Still valid</div>');
$this->assertResult('Needs wrap', '<p>Needs wrap</p>');
$this->assertResult('<p>Do not wrap</p> <p>Whitespace</p>');
$this->assertResult(
'Wrap'. '<p>Do not wrap</p>',
'<p>Wrap</p><p>Do not wrap</p>'
@ -35,6 +38,7 @@ extends HTMLPurifier_ChildDefHarness
'<foo>Bar</foo><bas /><b>People</b>Conniving.'. '<p>Fools!</p>',
'<p>Bar'. '<b>People</b>Conniving.</p><p>Fools!</p>'
);
$this->assertResult('Needs wrap', '<div>Needs wrap</div>',
array('HTML.BlockWrapper' => 'div'));