MDL-74823 lib: normalize line endings for HTMLPurifier
Prior to this change, all the line endings in the imported HTMLPurifier library were using CRLF (\r\n aka Windows style), but the HTMLPurifier source and also the downloadable artefacts use LF (\n aka Linux style) as line endings. This has been the case since510d190382when with the commit "MDL-38672 import HTML Purifier 4.5.0" all line endings were changed from LF to CRLF. There was no comment in the commit on why this change was done. As the original source uses LF, this commit partly reverts510d190382and goes back to LF as line endings. Signed-off-by: Daniel Ziegenberg <[email protected]>
This commit is contained in:
@@ -1,36 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Concrete comment node class.
|
||||
*/
|
||||
class HTMLPurifier_Node_Comment extends HTMLPurifier_Node
|
||||
{
|
||||
/**
|
||||
* Character data within comment.
|
||||
* @type string
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
public $is_whitespace = true;
|
||||
|
||||
/**
|
||||
* Transparent constructor.
|
||||
*
|
||||
* @param string $data String comment data.
|
||||
* @param int $line
|
||||
* @param int $col
|
||||
*/
|
||||
public function __construct($data, $line = null, $col = null)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->line = $line;
|
||||
$this->col = $col;
|
||||
}
|
||||
|
||||
public function toTokenPair() {
|
||||
return array(new HTMLPurifier_Token_Comment($this->data, $this->line, $this->col), null);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Concrete comment node class.
|
||||
*/
|
||||
class HTMLPurifier_Node_Comment extends HTMLPurifier_Node
|
||||
{
|
||||
/**
|
||||
* Character data within comment.
|
||||
* @type string
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
public $is_whitespace = true;
|
||||
|
||||
/**
|
||||
* Transparent constructor.
|
||||
*
|
||||
* @param string $data String comment data.
|
||||
* @param int $line
|
||||
* @param int $col
|
||||
*/
|
||||
public function __construct($data, $line = null, $col = null)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->line = $line;
|
||||
$this->col = $col;
|
||||
}
|
||||
|
||||
public function toTokenPair() {
|
||||
return array(new HTMLPurifier_Token_Comment($this->data, $this->line, $this->col), null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,59 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Concrete element node class.
|
||||
*/
|
||||
class HTMLPurifier_Node_Element extends HTMLPurifier_Node
|
||||
{
|
||||
/**
|
||||
* The lower-case name of the tag, like 'a', 'b' or 'blockquote'.
|
||||
*
|
||||
* @note Strictly speaking, XML tags are case sensitive, so we shouldn't
|
||||
* be lower-casing them, but these tokens cater to HTML tags, which are
|
||||
* insensitive.
|
||||
* @type string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Associative array of the node's attributes.
|
||||
* @type array
|
||||
*/
|
||||
public $attr = array();
|
||||
|
||||
/**
|
||||
* List of child elements.
|
||||
* @type array
|
||||
*/
|
||||
public $children = array();
|
||||
|
||||
/**
|
||||
* Does this use the <a></a> form or the </a> form, i.e.
|
||||
* is it a pair of start/end tokens or an empty token.
|
||||
* @bool
|
||||
*/
|
||||
public $empty = false;
|
||||
|
||||
public $endCol = null, $endLine = null, $endArmor = array();
|
||||
|
||||
public function __construct($name, $attr = array(), $line = null, $col = null, $armor = array()) {
|
||||
$this->name = $name;
|
||||
$this->attr = $attr;
|
||||
$this->line = $line;
|
||||
$this->col = $col;
|
||||
$this->armor = $armor;
|
||||
}
|
||||
|
||||
public function toTokenPair() {
|
||||
// XXX inefficiency here, normalization is not necessary
|
||||
if ($this->empty) {
|
||||
return array(new HTMLPurifier_Token_Empty($this->name, $this->attr, $this->line, $this->col, $this->armor), null);
|
||||
} else {
|
||||
$start = new HTMLPurifier_Token_Start($this->name, $this->attr, $this->line, $this->col, $this->armor);
|
||||
$end = new HTMLPurifier_Token_End($this->name, array(), $this->endLine, $this->endCol, $this->endArmor);
|
||||
//$end->start = $start;
|
||||
return array($start, $end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Concrete element node class.
|
||||
*/
|
||||
class HTMLPurifier_Node_Element extends HTMLPurifier_Node
|
||||
{
|
||||
/**
|
||||
* The lower-case name of the tag, like 'a', 'b' or 'blockquote'.
|
||||
*
|
||||
* @note Strictly speaking, XML tags are case sensitive, so we shouldn't
|
||||
* be lower-casing them, but these tokens cater to HTML tags, which are
|
||||
* insensitive.
|
||||
* @type string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Associative array of the node's attributes.
|
||||
* @type array
|
||||
*/
|
||||
public $attr = array();
|
||||
|
||||
/**
|
||||
* List of child elements.
|
||||
* @type array
|
||||
*/
|
||||
public $children = array();
|
||||
|
||||
/**
|
||||
* Does this use the <a></a> form or the </a> form, i.e.
|
||||
* is it a pair of start/end tokens or an empty token.
|
||||
* @bool
|
||||
*/
|
||||
public $empty = false;
|
||||
|
||||
public $endCol = null, $endLine = null, $endArmor = array();
|
||||
|
||||
public function __construct($name, $attr = array(), $line = null, $col = null, $armor = array()) {
|
||||
$this->name = $name;
|
||||
$this->attr = $attr;
|
||||
$this->line = $line;
|
||||
$this->col = $col;
|
||||
$this->armor = $armor;
|
||||
}
|
||||
|
||||
public function toTokenPair() {
|
||||
// XXX inefficiency here, normalization is not necessary
|
||||
if ($this->empty) {
|
||||
return array(new HTMLPurifier_Token_Empty($this->name, $this->attr, $this->line, $this->col, $this->armor), null);
|
||||
} else {
|
||||
$start = new HTMLPurifier_Token_Start($this->name, $this->attr, $this->line, $this->col, $this->armor);
|
||||
$end = new HTMLPurifier_Token_End($this->name, array(), $this->endLine, $this->endCol, $this->endArmor);
|
||||
//$end->start = $start;
|
||||
return array($start, $end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Concrete text token class.
|
||||
*
|
||||
* Text tokens comprise of regular parsed character data (PCDATA) and raw
|
||||
* character data (from the CDATA sections). Internally, their
|
||||
* data is parsed with all entities expanded. Surprisingly, the text token
|
||||
* does have a "tag name" called #PCDATA, which is how the DTD represents it
|
||||
* in permissible child nodes.
|
||||
*/
|
||||
class HTMLPurifier_Node_Text extends HTMLPurifier_Node
|
||||
{
|
||||
|
||||
/**
|
||||
* PCDATA tag name compatible with DTD, see
|
||||
* HTMLPurifier_ChildDef_Custom for details.
|
||||
* @type string
|
||||
*/
|
||||
public $name = '#PCDATA';
|
||||
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
public $data;
|
||||
/**< Parsed character data of text. */
|
||||
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
public $is_whitespace;
|
||||
|
||||
/**< Bool indicating if node is whitespace. */
|
||||
|
||||
/**
|
||||
* Constructor, accepts data and determines if it is whitespace.
|
||||
* @param string $data String parsed character data.
|
||||
* @param int $line
|
||||
* @param int $col
|
||||
*/
|
||||
public function __construct($data, $is_whitespace, $line = null, $col = null)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->is_whitespace = $is_whitespace;
|
||||
$this->line = $line;
|
||||
$this->col = $col;
|
||||
}
|
||||
|
||||
public function toTokenPair() {
|
||||
return array(new HTMLPurifier_Token_Text($this->data, $this->line, $this->col), null);
|
||||
}
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Concrete text token class.
|
||||
*
|
||||
* Text tokens comprise of regular parsed character data (PCDATA) and raw
|
||||
* character data (from the CDATA sections). Internally, their
|
||||
* data is parsed with all entities expanded. Surprisingly, the text token
|
||||
* does have a "tag name" called #PCDATA, which is how the DTD represents it
|
||||
* in permissible child nodes.
|
||||
*/
|
||||
class HTMLPurifier_Node_Text extends HTMLPurifier_Node
|
||||
{
|
||||
|
||||
/**
|
||||
* PCDATA tag name compatible with DTD, see
|
||||
* HTMLPurifier_ChildDef_Custom for details.
|
||||
* @type string
|
||||
*/
|
||||
public $name = '#PCDATA';
|
||||
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
public $data;
|
||||
/**< Parsed character data of text. */
|
||||
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
public $is_whitespace;
|
||||
|
||||
/**< Bool indicating if node is whitespace. */
|
||||
|
||||
/**
|
||||
* Constructor, accepts data and determines if it is whitespace.
|
||||
* @param string $data String parsed character data.
|
||||
* @param int $line
|
||||
* @param int $col
|
||||
*/
|
||||
public function __construct($data, $is_whitespace, $line = null, $col = null)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->is_whitespace = $is_whitespace;
|
||||
$this->line = $line;
|
||||
$this->col = $col;
|
||||
}
|
||||
|
||||
public function toTokenPair() {
|
||||
return array(new HTMLPurifier_Token_Text($this->data, $this->line, $this->col), null);
|
||||
}
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
||||
Reference in New Issue
Block a user