5use RemexHtml\Serializer\Serializer;
6use RemexHtml\Tokenizer\Tokenizer;
7use RemexHtml\TreeBuilder\Dispatcher;
8use RemexHtml\TreeBuilder\TreeBuilder;
9use RemexHtml\TreeBuilder\TreeMutationTracer;
17 'treeMutationTrace' =>
false,
20 $this->trace =
$config[
'treeMutationTrace'];
21 $this->pwrap =
$config[
'pwrap'];
25 public function tidy( $text ) {
27 $serializer =
new Serializer( $formatter );
31 $munger = $serializer;
34 $tracer =
new TreeMutationTracer( $munger,
function ( $msg ) {
40 $treeBuilder =
new TreeBuilder( $tracer, [
41 'ignoreErrors' =>
true,
42 'ignoreNulls' =>
true,
44 $dispatcher =
new Dispatcher( $treeBuilder );
45 $tokenizer =
new Tokenizer( $dispatcher, $text, [
46 'ignoreErrors' =>
true,
47 'ignoreCharRefs' =>
true,
48 'ignoreNulls' =>
true,
49 'skipPreprocess' =>
true,
51 $tokenizer->execute( [
52 'fragmentNamespace' => \RemexHtml\HTMLData::NS_HTML,
53 'fragmentName' =>
'body'
55 return $serializer->getResult();
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true