Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4145715
DepurateFormatter.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DepurateFormatter.php
View Options
<?php
namespace
Wikimedia\RemexHtml\Serializer
;
use
Wikimedia\RemexHtml\HTMLData
;
/**
* 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
*/
class
DepurateFormatter
extends
HtmlFormatter
{
public
function
__construct
(
$options
=
[]
)
{
parent
::
__construct
(
$options
);
$this
->
textEscapes
[
"
\x
c2
\x
a0"
]
=
' '
;
}
public
function
element
(
SerializerNode
$parent
,
SerializerNode
$node
,
$contents
)
{
$name
=
$node
->
name
;
$s
=
"<$name"
;
foreach
(
$node
->
attrs
->
getValues
()
as
$attrName
=>
$attrValue
)
{
$encValue
=
strtr
(
$attrValue
,
$this
->
attributeEscapes
);
$s
.=
" $attrName=
\"
$encValue
\"
"
;
}
if
(
$node
->
namespace
===
HTMLData
::
NS_HTML
)
{
if
(
isset
(
$this
->
prefixLfElements
[
$name
]
)
)
{
$s
.=
">
\n
$contents</$name>"
;
}
elseif
(
!
isset
(
$this
->
voidElements
[
$name
]
)
)
{
$s
.=
">$contents</$name>"
;
}
else
{
$s
.=
" />"
;
}
}
else
{
$s
.=
">$contents</$name>"
;
}
return
$s
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 19 2026, 17:45 (5 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
6c/3c/ea6bf5c5178339c5ee73444ab55b
Default Alt Text
DepurateFormatter.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment