Move source documents to src/

This commit is contained in:
Miraty 2021-10-07 20:21:30 +02:00
parent 37bed0c769
commit 048fa894e4
12 changed files with 21 additions and 22 deletions

4
.gitignore vendored
View File

@ -1,9 +1,7 @@
*.gz *.gz
temp/* temp/*
mdp.php mdp.php
antopie/css */css
antopie/*.html
!antopie/*.inc.html
/docs /docs
/miraty /miraty
.directory .directory

View File

@ -61,8 +61,6 @@ else
define("CSS_FILENAME", Less_Cache::Get($lessFiles, $options, $colorScheme)); 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 // URLs don't end with .html on the Antopie website
function formerUrlLocale($page) { function formerUrlLocale($page) {
if (DESTINATION === "dns" OR DESTINATION === "onion") { 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) { 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 // Convert Gemtext to Markdown
if ($pathParts['extension'] === "gmi") { 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) === "# ") if (substr($gmilines[0], 0, 2) === "# ")
$title = substr($gmilines[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 // Compile Markdown to HTML with Parsedown
require_once ROOT . "/bibli/parsedown/Parsedown.php"; require_once ROOT . "/bibli/parsedown/Parsedown.php";
require_once ROOT . "/bibli/parsedown-extra/ParsedownExtra.php"; require_once ROOT . "/bibli/parsedown-extra/ParsedownExtra.php";
@ -140,7 +143,7 @@ foreach ($pages as $page) {
$Parsedown = $Parsedown->setUrlsLinked(false); $Parsedown = $Parsedown->setUrlsLinked(false);
$Parsedown = $Parsedown->setMarkupEscaped(false); $Parsedown = $Parsedown->setMarkupEscaped(false);
$Parsedown = $Parsedown->setBreaksEnabled(true); $Parsedown = $Parsedown->setBreaksEnabled(true);
$pageContent = $Parsedown->text($pageContent); $pageContent = $Parsedown->text(file_get_contents($pathParts['dirname'] . "/" . $pathParts['filename'] . ".md"));
// .md > .html for local links // .md > .html for local links
@ -162,11 +165,9 @@ foreach ($pages as $page) {
else else
echo $config['siteTitle']; echo $config['siteTitle'];
?></title> ?></title>
<meta name="distribution" content="global">
<meta name="robots" content="index, follow">
<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 type="text/css" rel="stylesheet" href="/css/<?= CSS_FILENAME ?>"> <link type="text/css" rel="stylesheet" media="screen" href="/css/<?= CSS_FILENAME ?>">
<?php } ?> <?php } ?>
<?php <?php
if (file_exists(SITE . "/head.inc.html")) if (file_exists(SITE . "/head.inc.html"))

View File

@ -27,7 +27,7 @@ body {
margin: 0px; margin: 0px;
font-size: 30px; font-size: 30px;
line-height: 42px; line-height: 50px;
@media @light { @media @light {
background-color: @lightlessColor; background-color: @lightlessColor;
@ -74,7 +74,7 @@ a, a:visited {
color: @lightColor; color: @lightColor;
} }
&:hover { &:hover, &:focus {
text-decoration: none; text-decoration: none;
color: @mainColor; color: @mainColor;
} }
@ -99,7 +99,7 @@ a, a:visited {
border-color: @lightColor; border-color: @lightColor;
} }
&:hover { &:hover, &:focus {
color: @mainColor; color: @mainColor;
border: 2px solid @mainColor; border: 2px solid @mainColor;
} }
@ -125,7 +125,7 @@ a, a:visited {
border-color: @lightColor; border-color: @lightColor;
} }
&:hover { &:hover, &:focus {
color: @mainColor; color: @mainColor;
border: 2px solid @mainColor; border: 2px solid @mainColor;
} }