Better indentation

This commit is contained in:
Miraty 2022-06-01 17:33:32 +02:00
parent 3ece3cbb71
commit afe82852f5
3 changed files with 234 additions and 239 deletions

View File

@ -4,7 +4,7 @@ mkht.php is a PHP script for building Gemini, Markdown and HTML/CSS sites from s
Place your pages tree in `/src/*/*.(gmi|md)`. Place your pages tree in `/src/*/*.(gmi|md)`.
Optionnal files: Optional files:
* `/config.ini` * `/config.ini`
* `/style.less` * `/style.less`
* `/logo.png` * `/logo.png`

View File

@ -155,7 +155,7 @@ foreach ($pages as $page) {
ob_start(); ob_start();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<?php <html lang="<?php
@ -182,48 +182,43 @@ foreach ($pages as $page) {
echo "<title>" . $config['siteTitle'] . "</title>"; echo "<title>" . $config['siteTitle'] . "</title>";
?> ?>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<?php if ($config['css']) { ?> <?php
if ($config['css']) {
?>
<link rel="stylesheet" media="screen" href="<?= $relativePathToRoot ?>css/<?= CSS_FILENAME ?>"> <link rel="stylesheet" media="screen" href="<?= $relativePathToRoot ?>css/<?= CSS_FILENAME ?>">
<?php } ?> <?php
<?php }
if (file_exists(SITE . "/head.inc.html")) if (file_exists(SITE . "/head.inc.html"))
echo file_get_contents(SITE . "/head.inc.html"); echo file_get_contents(SITE . "/head.inc.html");
?> ?>
</head> </head>
<body> <body>
<?php <?php
if ($config['header']) { if ($config['header']) {
?> ?>
<header> <header>
<a id="lienHeader" href="./<?= $relativePathToRoot ?>"> <a id="lienHeader" href="./<?= $relativePathToRoot ?>">
<?php <?php
if (file_exists(SITE . "/img/logo.webp")) if (file_exists(SITE . "/img/logo.webp"))
echo '<img src="img/logo.webp" ' . getimagesize(SITE . "/img/logo.webp")[3] . ' alt="' . $config['siteTitle'] . '" />'; echo '<img src="img/logo.webp" ' . getimagesize(SITE . "/img/logo.webp")[3] . ' alt="' . $config['siteTitle'] . '" />';
else else
echo $config['siteTitle']; echo $config['siteTitle'];
?> ?>
</a> </a>
</header> </header>
<?php <?php
} }
?>
<?php if ($config['centerIndex'] AND $pathParts['filename'] === "index")
if ($config['centerIndex'] AND $pathParts['filename'] === "index") { echo '<div class="centered">' . $pageContent . "</div>";
echo '<div class="centered">'; else
} else { echo "<main>" . $pageContent . "</main>";
echo "<main>";
}
echo $pageContent;
if ($config['centerIndex'] AND $pathParts['filename'] === "index") {
echo "</div>";
} else {
echo "</main>";
}
if (file_exists(SITE . "/end.inc.html")) if (file_exists(SITE . "/end.inc.html"))
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()); file_put_contents($pathParts['dirname'] . "/" . $pathParts['filename'] . ".html", ob_get_contents());
ob_end_clean(); ob_end_clean();