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

A formatter which produces a serialization extremely similar to the Html5Depurate service, which uses the validator.nu library for tree construction. More...

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

Public Member Functions

 __construct ( $options=[])
 Constructor.
 
 element (SerializerNode $parent, SerializerNode $node, $contents)
 Encode the given element.
 
- Public Member Functions inherited from Wikimedia\RemexHtml\Serializer\HtmlFormatter
 startDocument ( $fragmentNamespace, $fragmentName)
 Get a string which starts the document.
 
 characters (SerializerNode $parent, $text, $start, $length)
 Encode the given character substring.
 
 comment (SerializerNode $parent, $text)
 Encode a comment.
 
 doctype ( $name, $public, $system)
 Encode a doctype.
 
string formatDOMElement ( $node, $contents)
 
- 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.
 

Additional Inherited Members

- Protected Attributes inherited from Wikimedia\RemexHtml\Serializer\HtmlFormatter
array< string, bool > $voidElements
 The elements for which a closing tag is omitted.
 
array< string, bool > $prefixLfElements
 The elements which need a leading newline in their contents to be duplicated, since the parser strips a leading newline.
 
array< string, bool > $rawTextElements
 The elements which have unescaped contents.
 
array< string, string > $attributeEscapes
 The escape table for attribute values.
 
array< string, string > $textEscapes
 The escape table for text nodes.
 
array< string, bool > $unqualifiedNamespaces
 Attribute namespaces which have unqualified local names.
 
 $useSourceDoctype
 
 $reverseCoercion
 

Detailed Description

A formatter which produces a serialization extremely similar to the Html5Depurate service, which uses the validator.nu library for tree construction.

For use in comparative testing.

https://www.mediawiki.org/wiki/Html5Depurate

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\RemexHtml\Serializer\DepurateFormatter::__construct ( $options = [])

Constructor.

Parameters
array$optionsAn associative array of options:
  • scriptingFlag : Set this to false to disable scripting. True by default.
  • useSourceDoctype : Emit the doctype used in the source. If this is false or absent, an HTML doctype will be used.
  • reverseCoercion : When formatting a DOM node, reverse the encoding of invalid names. False by default.

Reimplemented from Wikimedia\RemexHtml\Serializer\HtmlFormatter.

Member Function Documentation

◆ element()

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

Reimplemented from Wikimedia\RemexHtml\Serializer\HtmlFormatter.


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