RemexHtml
Fast HTML 5 parser
|
A Formatter which is used to format documents in (almost) the way they appear in the html5lib tests. More...
Public Member Functions | |
startDocument ( $fragmentNamespace, $fragmentName) | |
Get a string which starts the document. | |
doctype ( $name, $public, $system) | |
Encode a doctype. | |
characters (SerializerNode $parent, $text, $start, $length) | |
Encode the given character substring. | |
element (SerializerNode $parent, SerializerNode $node, $contents) | |
Encode the given element. | |
comment (SerializerNode $parent, $text) | |
Encode a comment. | |
formatDOMElement (\DOMElement $node, $content) | |
Public Member Functions inherited from Wikimedia\RemexHtml\DOM\DOMFormatter | |
string | formatDOMNode (DOMNode $node) |
Recursively format a DOMNode. | |
formatDOMElement (DOMElement $element, $contents) | |
Non-recursively format a DOMElement. | |
A Formatter which is used to format documents in (almost) the way they appear in the html5lib tests.
A little bit of post-processing is required in the PHPUnit tests.
Wikimedia\RemexHtml\Serializer\TestFormatter::characters | ( | SerializerNode | $parent, |
$text, | |||
$start, | |||
$length ) |
Encode the given character substring.
SerializerNode | $parent | The parent of the text node (at creation time) |
string | $text | |
int | $start | The offset within $text |
int | $length | The number of bytes within $text |
Implements Wikimedia\RemexHtml\Serializer\Formatter.
Wikimedia\RemexHtml\Serializer\TestFormatter::comment | ( | SerializerNode | $parent, |
$text ) |
Encode a comment.
SerializerNode | $parent | The parent of the node (at creation time) |
string | $text | The inner text of the comment |
Implements Wikimedia\RemexHtml\Serializer\Formatter.
Wikimedia\RemexHtml\Serializer\TestFormatter::doctype | ( | $name, | |
$public, | |||
$system ) |
Encode a doctype.
This event occurs when the source document has a doctype, it can return an empty string if the formatter wants to use its own doctype.
string | $name | The doctype name, usually "html" |
string | $public | The PUBLIC identifier |
string | $system | The SYSTEM identifier |
Implements Wikimedia\RemexHtml\Serializer\Formatter.
Wikimedia\RemexHtml\Serializer\TestFormatter::element | ( | SerializerNode | $parent, |
SerializerNode | $node, | ||
$contents ) |
Encode the given element.
SerializerNode | $parent | The parent of the node (when it is closed) |
SerializerNode | $node | The element to encode |
string | null | $contents | The previously-encoded contents, or null for a void element. Void elements can be serialized as self-closing tags. |
Implements Wikimedia\RemexHtml\Serializer\Formatter.
Wikimedia\RemexHtml\Serializer\TestFormatter::startDocument | ( | $fragmentNamespace, | |
$fragmentName ) |
Get a string which starts the document.
string | null | $fragmentNamespace | |
string | null | $fragmentName |
Implements Wikimedia\RemexHtml\Serializer\Formatter.