mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-03 13:21:51 +00:00
[1.1.2]
- Added notes on HTML versus XML attribute whitespace handling - Noted that HTMLPurifier_ChildDef_Custom isn't being used - Noted that config object's definitions are cached versions - Hooked up HTMLPurifier_ChildDef_Custom's unit tests (they weren't being run) - Tester named "HTML Purifier" not "HTMLPurifier" git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@472 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
7e6a3fc990
commit
9af9c505e1
5
NEWS
5
NEWS
@ -18,10 +18,15 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
|||||||
+ INSTALL document rewritten
|
+ INSTALL document rewritten
|
||||||
+ TODO added semi-lossy conversion
|
+ TODO added semi-lossy conversion
|
||||||
+ API Doxygen docs' file exclusions updated
|
+ API Doxygen docs' file exclusions updated
|
||||||
|
+ Added notes on HTML versus XML attribute whitespace handling
|
||||||
|
+ Noted that HTMLPurifier_ChildDef_Custom isn't being used
|
||||||
|
+ Noted that config object's definitions are cached versions
|
||||||
- Fixed lack of attribute parsing in HTMLPurifier_Lexer_PEARSax3
|
- Fixed lack of attribute parsing in HTMLPurifier_Lexer_PEARSax3
|
||||||
- ftp:// URIs now have their typecodes checked
|
- ftp:// URIs now have their typecodes checked
|
||||||
|
- Hooked up HTMLPurifier_ChildDef_Custom's unit tests (they weren't being run)
|
||||||
. Line endings standardized throughout project (svn:eol-style standardized)
|
. Line endings standardized throughout project (svn:eol-style standardized)
|
||||||
. Refactored parseData() to general Lexer class
|
. Refactored parseData() to general Lexer class
|
||||||
|
. Tester named "HTML Purifier" not "HTMLPurifier"
|
||||||
|
|
||||||
1.1.1, released 2006-09-24
|
1.1.1, released 2006-09-24
|
||||||
! Configuration option to optionally Tidy up output for indentation to make up
|
! Configuration option to optionally Tidy up output for indentation to make up
|
||||||
|
@ -48,7 +48,16 @@ class HTMLPurifier_AttrDef
|
|||||||
*
|
*
|
||||||
* @note This method is not entirely standards compliant, as trim() removes
|
* @note This method is not entirely standards compliant, as trim() removes
|
||||||
* more types of whitespace than specified in the spec. In practice,
|
* more types of whitespace than specified in the spec. In practice,
|
||||||
* this is rarely a problem.
|
* this is rarely a problem, as those extra characters usually have
|
||||||
|
* already been removed by HTMLPurifier_Encoder.
|
||||||
|
*
|
||||||
|
* @warning This processing is inconsistent with XML's whitespace handling
|
||||||
|
* as specified by section 3.3.3 and referenced XHTML 1.0 section
|
||||||
|
* 4.7. Compliant processing requires all line breaks normalized
|
||||||
|
* to "\n", so the fix is not as simple as fixing it in this
|
||||||
|
* function. Trim and whitespace collapsing are supposed to only
|
||||||
|
* occur in NMTOKENs. However, note that we are NOT necessarily
|
||||||
|
* parsing XML, thus, this behavior may still be correct.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -56,6 +56,8 @@ class HTMLPurifier_ChildDef
|
|||||||
*
|
*
|
||||||
* @warning Currently this class is an all or nothing proposition, that is,
|
* @warning Currently this class is an all or nothing proposition, that is,
|
||||||
* it will only give a bool return value.
|
* it will only give a bool return value.
|
||||||
|
* @note This class is currently not used by any code, although it is unit
|
||||||
|
* tested.
|
||||||
*/
|
*/
|
||||||
class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
|
class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
|
||||||
{
|
{
|
||||||
|
@ -26,12 +26,12 @@ class HTMLPurifier_Config
|
|||||||
var $def;
|
var $def;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance of HTMLPurifier_HTMLDefinition
|
* Cached instance of HTMLPurifier_HTMLDefinition
|
||||||
*/
|
*/
|
||||||
var $html_definition;
|
var $html_definition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance of HTMLPurifier_CSSDefinition
|
* Cached instance of HTMLPurifier_CSSDefinition
|
||||||
*/
|
*/
|
||||||
var $css_definition;
|
var $css_definition;
|
||||||
|
|
||||||
|
@ -46,18 +46,23 @@ class HTMLPurifier_ChildDefTest extends UnitTestCase
|
|||||||
$this->def = new HTMLPurifier_ChildDef_Custom(
|
$this->def = new HTMLPurifier_ChildDef_Custom(
|
||||||
'(a, b?, c*, d+, (a, b)*)');
|
'(a, b?, c*, d+, (a, b)*)');
|
||||||
|
|
||||||
|
$inputs = array();
|
||||||
|
$expect = array();
|
||||||
|
$config = array();
|
||||||
|
|
||||||
$inputs[0] = '';
|
$inputs[0] = '';
|
||||||
$expect[0] = false;
|
$expect[0] = false;
|
||||||
|
|
||||||
$inputs[1] = '<a /><b /><c /><d /><a /><b />';
|
$inputs[1] = '<a /><b /><c /><d /><a /><b />';
|
||||||
$expect[1] = true;
|
$expect[1] = true;
|
||||||
|
|
||||||
$inputs[2] = '<a /><d>Dob</d><a /><b>foo</b><a href="moo"><b>foo</b>';
|
$inputs[2] = '<a /><d>Dob</d><a /><b>foo</b><a href="moo" /><b>foo</b>';
|
||||||
$expect[2] = true;
|
$expect[2] = true;
|
||||||
|
|
||||||
$inputs[3] = '<a /><a />';
|
$inputs[3] = '<a /><a />';
|
||||||
$expect[3] = false;
|
$expect[3] = false;
|
||||||
|
|
||||||
|
$this->assertSeries($inputs, $expect, $config);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_table() {
|
function test_table() {
|
||||||
|
@ -8,6 +8,7 @@ class HTMLPurifier_ConfigTest extends UnitTestCase
|
|||||||
var $our_copy, $old_copy;
|
var $our_copy, $old_copy;
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
|
// set up a dummy schema object for testing
|
||||||
$our_copy = new HTMLPurifier_ConfigSchema();
|
$our_copy = new HTMLPurifier_ConfigSchema();
|
||||||
$this->old_copy = HTMLPurifier_ConfigSchema::instance();
|
$this->old_copy = HTMLPurifier_ConfigSchema::instance();
|
||||||
$this->our_copy =& HTMLPurifier_ConfigSchema::instance($our_copy);
|
$this->our_copy =& HTMLPurifier_ConfigSchema::instance($our_copy);
|
||||||
@ -93,6 +94,17 @@ class HTMLPurifier_ConfigTest extends UnitTestCase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_getDefinition() {
|
||||||
|
|
||||||
|
$config = HTMLPurifier_Config::createDefault();
|
||||||
|
$def = $config->getHTMLDefinition();
|
||||||
|
$this->assertIsA($def, 'HTMLPurifier_HTMLDefinition');
|
||||||
|
|
||||||
|
$def = $config->getCSSDefinition();
|
||||||
|
$this->assertIsA($def, 'HTMLPurifier_CSSDefinition');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -114,14 +114,14 @@ if (isset($_GET['file']) && isset($test_file_lookup[$_GET['file']])) {
|
|||||||
// execute only one test
|
// execute only one test
|
||||||
$test_file = $_GET['file'];
|
$test_file = $_GET['file'];
|
||||||
|
|
||||||
$test = new GroupTest('HTMLPurifier - ' . $test_file);
|
$test = new GroupTest('HTML Purifier - ' . $test_file);
|
||||||
$path = 'HTMLPurifier/' . $test_file;
|
$path = 'HTMLPurifier/' . $test_file;
|
||||||
require_once $path;
|
require_once $path;
|
||||||
$test->addTestClass(htmlpurifier_path2class($path));
|
$test->addTestClass(htmlpurifier_path2class($path));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$test = new GroupTest('HTMLPurifier');
|
$test = new GroupTest('HTML Purifier');
|
||||||
|
|
||||||
foreach ($test_files as $test_file) {
|
foreach ($test_files as $test_file) {
|
||||||
$path = 'HTMLPurifier/' . $test_file;
|
$path = 'HTMLPurifier/' . $test_file;
|
||||||
|
Loading…
Reference in New Issue
Block a user