1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-01 11:50:28 +02:00

Track column numbers in addition to line numbers.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang
2008-09-01 14:10:10 -04:00
parent 9977350143
commit c6914dce51
8 changed files with 96 additions and 45 deletions

View File

@@ -11,9 +11,10 @@ class HTMLPurifier_Token_Comment extends HTMLPurifier_Token
*
* @param $data String comment data.
*/
public function __construct($data, $line = null) {
public function __construct($data, $line = null, $col = null) {
$this->data = $data;
$this->line = $line;
$this->col = $col;
}
}

View File

@@ -33,7 +33,7 @@ class HTMLPurifier_Token_Tag extends HTMLPurifier_Token
* @param $name String name.
* @param $attr Associative array of attributes.
*/
public function __construct($name, $attr = array(), $line = null) {
public function __construct($name, $attr = array(), $line = null, $col = null) {
$this->name = ctype_lower($name) ? $name : strtolower($name);
foreach ($attr as $key => $value) {
// normalization only necessary when key is not lowercase
@@ -49,5 +49,6 @@ class HTMLPurifier_Token_Tag extends HTMLPurifier_Token
}
$this->attr = $attr;
$this->line = $line;
$this->col = $col;
}
}

View File

@@ -21,10 +21,11 @@ class HTMLPurifier_Token_Text extends HTMLPurifier_Token
*
* @param $data String parsed character data.
*/
public function __construct($data, $line = null) {
public function __construct($data, $line = null, $col = null) {
$this->data = $data;
$this->is_whitespace = ctype_space($data);
$this->line = $line;
$this->col = $col;
}
}