RemexHtml
Fast HTML 5 parser
Loading...
Searching...
No Matches
Wikimedia\RemexHtml\Serializer\TestFormatter Class Reference

A Formatter which is used to format documents in (almost) the way they appear in the html5lib tests. More...

+ Inheritance diagram for Wikimedia\RemexHtml\Serializer\TestFormatter:

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.
 

Detailed Description

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.

Member Function Documentation

◆ characters()

Wikimedia\RemexHtml\Serializer\TestFormatter::characters ( SerializerNode $parent,
$text,
$start,
$length )

Encode the given character substring.

Parameters
SerializerNode$parentThe parent of the text node (at creation time)
string$text
int$startThe offset within $text
int$lengthThe number of bytes within $text
Returns
string

Implements Wikimedia\RemexHtml\Serializer\Formatter.

◆ comment()

Wikimedia\RemexHtml\Serializer\TestFormatter::comment ( SerializerNode $parent,
$text )

Encode a comment.

Parameters
SerializerNode$parentThe parent of the node (at creation time)
string$textThe inner text of the comment
Returns
string

Implements Wikimedia\RemexHtml\Serializer\Formatter.

◆ doctype()

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.

Parameters
string$nameThe doctype name, usually "html"
string$publicThe PUBLIC identifier
string$systemThe SYSTEM identifier
Returns
string

Implements Wikimedia\RemexHtml\Serializer\Formatter.

◆ element()

Wikimedia\RemexHtml\Serializer\TestFormatter::element ( SerializerNode $parent,
SerializerNode $node,
$contents )

Encode the given element.

Parameters
SerializerNode$parentThe parent of the node (when it is closed)
SerializerNode$nodeThe element to encode
string | null$contentsThe previously-encoded contents, or null for a void element. Void elements can be serialized as self-closing tags.
Returns
string

Implements Wikimedia\RemexHtml\Serializer\Formatter.

◆ startDocument()

Wikimedia\RemexHtml\Serializer\TestFormatter::startDocument ( $fragmentNamespace,
$fragmentName )

Get a string which starts the document.

Parameters
string | null$fragmentNamespace
string | null$fragmentName
Returns
string

Implements Wikimedia\RemexHtml\Serializer\Formatter.


The documentation for this class was generated from the following file: