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

A formatter suitable for pre-sanitized input with ignoreEntities enabled in the Tokenizer. More...

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

Public Member Functions

 __construct ( $options=[])
 
 startDocument ( $fragmentNamespace, $fragmentName)
 Get a string which starts the document.
Parameters
string | null$fragmentNamespace
string | null$fragmentName
Returns
string

 
 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

 
 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

 
 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

 
 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

 

Detailed Description

A formatter suitable for pre-sanitized input with ignoreEntities enabled in the Tokenizer.

Member Function Documentation

◆ characters()

Wikimedia\RemexHtml\Serializer\FastFormatter::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\FastFormatter::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\FastFormatter::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\FastFormatter::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\FastFormatter::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: