BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
RemexHtml\Serializer\HtmlFormatter Class Reference
Inheritance diagram for RemexHtml\Serializer\HtmlFormatter:
Collaboration diagram for RemexHtml\Serializer\HtmlFormatter:

Public Member Functions

 __construct ($options=[])
 
 startDocument ($fragmentNamespace, $fragmentName)
 
 characters (SerializerNode $parent, $text, $start, $length)
 
 element (SerializerNode $parent, SerializerNode $node, $contents)
 
 comment (SerializerNode $parent, $text)
 
 doctype ($name, $public, $system)
 
 formatDOMNode (\DOMNode $node)
 
 formatDOMElement (\DOMElement $node, $contents)
 

Public Attributes

xc2 xa0
 

Protected Attributes

 $voidElements
 
 $prefixLfElements
 
 $rawTextElements
 
 $attributeEscapes
 
 $textEscapes
 
 $unqualifiedNamespaces
 
 $useSourceDoctype
 
 $reverseCoercion
 

Detailed Description

A formatter which follows the HTML 5 fragment serialization algorithm.

Constructor & Destructor Documentation

RemexHtml\Serializer\HtmlFormatter::__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.

Member Function Documentation

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

Encode the given character substring

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

Implements RemexHtml\Serializer\Formatter.

RemexHtml\Serializer\HtmlFormatter::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 RemexHtml\Serializer\Formatter.

RemexHtml\Serializer\HtmlFormatter::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 RemexHtml\Serializer\Formatter.

RemexHtml\Serializer\HtmlFormatter::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 RemexHtml\Serializer\Formatter.

RemexHtml\Serializer\HtmlFormatter::formatDOMElement ( \DOMElement  $element,
  $contents 
)

Non-recursively format a DOMElement.

Parameters
DOMElement$elementThe element to format
string$contentsThe formatted contents of the element

Implements RemexHtml\DOM\DOMFormatter.

RemexHtml\Serializer\HtmlFormatter::formatDOMNode ( \DOMNode  $node)

Recursively format a DOMNode.

Parameters
DOMNode$nodeThe node to format
Returns
string

Implements RemexHtml\DOM\DOMFormatter.

RemexHtml\Serializer\HtmlFormatter::startDocument (   $fragmentNamespace,
  $fragmentName 
)

Get a string which starts the document

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

Implements RemexHtml\Serializer\Formatter.

Member Data Documentation

RemexHtml\Serializer\HtmlFormatter::$attributeEscapes
protected
Initial value:
= [
'&' => '&'

The escape table for attribute values

RemexHtml\Serializer\HtmlFormatter::$prefixLfElements
protected
Initial value:
= [
'pre' => true

The elements which need a leading newline in their contents to be duplicated, since the parser strips a leading newline.

RemexHtml\Serializer\HtmlFormatter::$rawTextElements
protected
Initial value:
= [
'style' => true

The elements which have unescaped contents.

RemexHtml\Serializer\HtmlFormatter::$textEscapes
protected
Initial value:
= [
'&' => '&'

The escape table for text nodes

RemexHtml\Serializer\HtmlFormatter::$unqualifiedNamespaces
protected
Initial value:
= [
HTMLData::NS_HTML => true

Attribute namespaces which have unqualified local names

RemexHtml\Serializer\HtmlFormatter::$voidElements
protected
Initial value:
= [
'area' => true

The elements for which a closing tag is omitted.

xc2 RemexHtml\Serializer\HtmlFormatter::xa0
Initial value:
=> ' ',
'"' => '"',
]

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