|
|
@ -61,8 +61,6 @@ else |
|
|
|
|
|
|
|
define("CSS_FILENAME", Less_Cache::Get($lessFiles, $options, $colorScheme)); |
|
|
|
|
|
|
|
exec(FIND . " " . SITE . " -name '*.gmi' -o -name '*.md'", $pages); |
|
|
|
|
|
|
|
// URLs don't end with .html on the Antopie website |
|
|
|
function formerUrlLocale($page) { |
|
|
|
if (DESTINATION === "dns" OR DESTINATION === "onion") { |
|
|
@ -81,13 +79,25 @@ function clearnetOrOnion($clearnetUrl, $onionUrl) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
exec(FIND . " " . SITE . "/src -name '*.gmi' -o -name '*.md'", $pages); |
|
|
|
|
|
|
|
foreach ($pages as $page) { |
|
|
|
|
|
|
|
$pathParts = pathinfo($page); |
|
|
|
$pathParts = pathinfo(str_replace("/src", "", $page)); |
|
|
|
|
|
|
|
// Create parent directory if needed |
|
|
|
if (!file_exists($pathParts['dirname'])) |
|
|
|
mkdir($pathParts['dirname'], 0755, true); |
|
|
|
|
|
|
|
// Execute PHP code |
|
|
|
ob_start(); |
|
|
|
eval("?>" . file_get_contents($page)); |
|
|
|
file_put_contents($pathParts['dirname'] . "/" . $pathParts['basename'], ob_get_contents()); |
|
|
|
ob_end_clean(); |
|
|
|
|
|
|
|
// Convert Gemtext to Markdown |
|
|
|
if ($pathParts['extension'] === "gmi") { |
|
|
|
$gmilines = explode("\n", file_get_contents($page)); |
|
|
|
$gmilines = explode("\n", file_get_contents($pathParts['dirname'] . "/" . $pathParts['basename'])); |
|
|
|
|
|
|
|
if (substr($gmilines[0], 0, 2) === "# ") |
|
|
|
$title = substr($gmilines[0], 2); |
|
|
@ -126,13 +136,6 @@ foreach ($pages as $page) { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Execute PHP code |
|
|
|
ob_start(); |
|
|
|
eval("?>" . file_get_contents($pathParts['dirname'] . "/" . $pathParts['filename'] . ".md")); |
|
|
|
$pageContent = ob_get_contents(); |
|
|
|
ob_end_clean(); |
|
|
|
|
|
|
|
|
|
|
|
// Compile Markdown to HTML with Parsedown |
|
|
|
require_once ROOT . "/bibli/parsedown/Parsedown.php"; |
|
|
|
require_once ROOT . "/bibli/parsedown-extra/ParsedownExtra.php"; |
|
|
@ -140,7 +143,7 @@ foreach ($pages as $page) { |
|
|
|
$Parsedown = $Parsedown->setUrlsLinked(false); |
|
|
|
$Parsedown = $Parsedown->setMarkupEscaped(false); |
|
|
|
$Parsedown = $Parsedown->setBreaksEnabled(true); |
|
|
|
$pageContent = $Parsedown->text($pageContent); |
|
|
|
$pageContent = $Parsedown->text(file_get_contents($pathParts['dirname'] . "/" . $pathParts['filename'] . ".md")); |
|
|
|
|
|
|
|
|
|
|
|
// .md > .html for local links |
|
|
@ -162,11 +165,9 @@ foreach ($pages as $page) { |
|
|
|
else |
|
|
|
echo $config['siteTitle']; |
|
|
|
?></title> |
|
|
|
<meta name="distribution" content="global"> |
|
|
|
<meta name="robots" content="index, follow"> |
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|
|
|
<?php if ($config['css']) { ?> |
|
|
|
<link type="text/css" rel="stylesheet" href="/css/<?= CSS_FILENAME ?>"> |
|
|
|
<link type="text/css" rel="stylesheet" media="screen" href="/css/<?= CSS_FILENAME ?>"> |
|
|
|
<?php } ?> |
|
|
|
<?php |
|
|
|
if (file_exists(SITE . "/head.inc.html")) |
|
|
|