Tidy HTML
This commit is contained in:
parent
afe82852f5
commit
3279746223
1 changed files with 19 additions and 2 deletions
21
mkht.php
21
mkht.php
|
@ -219,8 +219,25 @@ foreach ($pages as $page) {
|
||||||
require SITE . "/end.inc.html";
|
require SITE . "/end.inc.html";
|
||||||
echo "</body></html>";
|
echo "</body></html>";
|
||||||
|
|
||||||
file_put_contents($pathParts['dirname'] . "/" . $pathParts['filename'] . ".html", ob_get_contents());
|
$pageContent = ob_get_clean();
|
||||||
ob_end_clean();
|
|
||||||
|
if (extension_loaded("tidy")) {
|
||||||
|
$tidy = new tidy;
|
||||||
|
$tidy->parseString(
|
||||||
|
$pageContent,
|
||||||
|
array(
|
||||||
|
'indent' => true,
|
||||||
|
'keep-tabs' => true,
|
||||||
|
'wrap' => 0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$tidy->cleanRepair();
|
||||||
|
$pageContent = tidy_get_output($tidy);
|
||||||
|
} else {
|
||||||
|
echo "tidy extension unavailable\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
file_put_contents($pathParts['dirname'] . "/" . $pathParts['filename'] . ".html", $pageContent);
|
||||||
|
|
||||||
// Gzip compression
|
// Gzip compression
|
||||||
exec(GZIP . " --keep --fast --force " . $pathParts['dirname'] . "/" . $pathParts['filename'] . ".html");
|
exec(GZIP . " --keep --fast --force " . $pathParts['dirname'] . "/" . $pathParts['filename'] . ".html");
|
||||||
|
|
Loading…
Reference in a new issue