Page MenuHomeWickedGov Phorge

normalize.test.php
No OneTemporary

Size
757 B
Referenced Files
None
Subscribers
None

normalize.test.php

<?php
// PORT-FIXME: Incomplete. Doesn't support CLI flags of the JS version
require_once __DIR__ . '/../vendor/autoload.php';
use Wikimedia\Parsoid\Html2Wt\DOMNormalizer;
use Wikimedia\Parsoid\Mocks\MockEnv;
use Wikimedia\Parsoid\Utils\ContentUtils;
use Wikimedia\Parsoid\Utils\DOMCompat;
$html = file_get_contents( $argv[1] );
$mockEnv = new MockEnv( [] );
$mockState = (object)[
"env" => $mockEnv,
"selserMode" => true
];
$doc = ContentUtils::createAndLoadDocument( $html, [ "markNew" => true ] );
$body = DOMCompat::getBody( $doc );
$norm = new DOMNormalizer( $mockState );
$norm->normalize( $body );
$opts = [
'keepTmp' => true,
'storeDiffMark' => true,
];
print ContentUtils::dumpDOM( $body, 'DOM post-normalization', $opts );
print "\n";

File Metadata

Mime Type
text/x-php
Expires
Sat, Oct 3, 21:20 (1 w, 19 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2b/89/9798d6392e742a41c54f32156ed7
Default Alt Text
normalize.test.php (757 B)

Event Timeline