Fixed a ton of bugs and made almost everything work

This commit is contained in:
2017-07-24 00:35:04 +02:00
parent 314239842e
commit 28a170faa3
39 changed files with 1985 additions and 390 deletions
Regular → Executable
+18
View File
@@ -2,6 +2,18 @@
require_once __DIR__ . '/base.php';
function process_html($s) {
$pattern = '/<!--(.*)-->/Uis';
$s = preg_replace($pattern, '', $s);
$pattern = '/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?<!\:|\\\|\'|\")\/\/.*))/';
$s = preg_replace($pattern, '', $s);
$pattern = '/\s+/s';
$s = preg_replace($pattern, ' ', $s);
return $s;
}
ob_start();
foreach($_pages as $_k => $p) {
if ($p->bodyclass == 'api') continue;
@@ -11,6 +23,12 @@ foreach($_pages as $_k => $p) {
ob_clean(); // clean up
include(__DIR__ . '/index.php');
$s = ob_get_contents(); // grab the output
// remove newlines and comments
// as tests have shown, it saves just a couple kilobytes,
// making it not a very big improvement at the expense of ugly html.
// $s = process_html($s);
ob_clean(); // clean up
$of = __DIR__ . '/../html/' . $_k . '.tpl';
file_put_contents($of, $s); // write to a file