Clean up indentation

This commit is contained in:
Jacob 2024-01-03 10:06:10 +01:00
parent d4986146db
commit acd4f3b432

103
core.php
View file

@ -121,22 +121,22 @@ function convertMarkdownToHTML($contents) {
$ret = new parsedMarkdown();
$parser = new MarkdownExtra;
$parser->no_markup = false;
$parser->no_markup = true;
$specialSyntax = array(
'/.*@csgen\.title.*=.*"(.*)(");/',
'/.*@csgen\.description.*=.*"(.*)(");/',
'/.*@csgen\.date.*=.*"(.*)(");/',
'/.*@csgen\.allowComments.*=.*"(.*)(");/',
'/.*@csgen\.displayTitle.*=.*"(.*)(");/',
'/.*@csgen\.displayDate.*=.*"(.*)(");/',
'/.*@csgen\.span.*<STYLE.*,.*TEXT>\(.*"(.*)".*, "(.*)"\);/',
'/.*@csgen\.span.*<STYLE.*,.*HTML>\(.*"(.*)".*, "(.*)"\);/',
'/.*@csgen\.inline.*<HTML>\(.*"(.*)"\);/',
'/.*@csgen\.image.*<SIZE.*,.*PATH>\(.*"(.*)".*, "(.*)"\);/',
'/.*@csgen\.div.*<START.*,.*NAME>\(.*"(.*)"\);/',
'/.*@csgen\.div.*<END.*,.*NAME>\(.*"(.*)"\);/',
'/.*@csgen\.div.*<STYLE.*,.*NAME>\(.*"(.*)".*, "(.*)"\);/',
'/.*@csgen\.title.*=.*"(.*)(");/',
'/.*@csgen\.description.*=.*"(.*)(");/',
'/.*@csgen\.date.*=.*"(.*)(");/',
'/.*@csgen\.allowComments.*=.*"(.*)(");/',
'/.*@csgen\.displayTitle.*=.*"(.*)(");/',
'/.*@csgen\.displayDate.*=.*"(.*)(");/',
'/.*@csgen\.span.*<STYLE.*,.*TEXT>\(.*"(.*)".*, "(.*)"\);/',
'/.*@csgen\.span.*<STYLE.*,.*HTML>\(.*"(.*)".*, "(.*)"\);/',
'/.*@csgen\.inline.*<HTML>\(.*"(.*)"\);/',
'/.*@csgen\.image.*<SIZE.*,.*PATH>\(.*"(.*)".*, "(.*)"\);/',
'/.*@csgen\.div.*<START.*,.*NAME>\(.*"(.*)"\);/',
'/.*@csgen\.div.*<END.*,.*NAME>\(.*"(.*)"\);/',
'/.*@csgen\.div.*<STYLE.*,.*NAME>\(.*"(.*)".*, "(.*)"\);/',
);
$out = $parser->transform($contents);
@ -147,59 +147,60 @@ function convertMarkdownToHTML($contents) {
if (preg_match($pattern, $out, $matches)) {
switch ($pattern) {
case '/.*@csgen\.title.*=.*"(.*)(");/':
$ret->title = $matches[1];
$out = str_replace($matches[0], '', $out);
$ret->title = $matches[1];
$out = str_replace($matches[0], '', $out);
break;
break;
case '/.*@csgen\.description.*=.*"(.*)(");/':
$ret->description = $matches[1];
$out = str_replace($matches[0], '', $out);
$ret->description = $matches[1];
$out = str_replace($matches[0], '', $out);
break;
break;
case '/.*@csgen\.date.*=.*"(.*)(");/':
$ret->date = $matches[1];
$out = str_replace($matches[0], '', $out);
$ret->date = $matches[1];
$out = str_replace($matches[0], '', $out);
break;
break;
case '/.*@csgen\.allowComments.*=.*"(.*)(");/':
$ret->allowComments = $matches[1];
$out = str_replace($matches[0], '', $out);
$ret->allowComments = $matches[1];
$out = str_replace($matches[0], '', $out);
break;
break;
case '/.*@csgen\.displayTitle.*=.*"(.*)(");/':
$ret->displayTitle = $matches[1];
$out = str_replace($matches[0], '', $out);
$ret->displayTitle = $matches[1];
$out = str_replace($matches[0], '', $out);
break;
break;
case '/.*@csgen\.displayDate.*=.*"(.*)(");/':
$ret->displayDate = $matches[1];
$out = str_replace($matches[0], '', $out);
$ret->displayDate = $matches[1];
$out = str_replace($matches[0], '', $out);
break;
break;
case '/.*@csgen\.span.*<STYLE.*,.*TEXT>\(.*"(.*)".*, "(.*)"\);/':
$out = str_replace($matches[0], "<span style=\"$matches[1]\">$matches[2]</span>", $out);
break;
$out = str_replace($matches[0], "<span style=\"$matches[1]\">$matches[2]</span>", $out);
break;
case '/.*@csgen\.span.*&lt;STYLE.*,.*HTML&gt;\(.*&quot;(.*)&quot;.*, &quot;(.*)&quot;\);/':
$out = str_replace($matches[0], "<span style=\"$matches[1]\">$matches[2]</span>", $out);
break;
$out = str_replace($matches[0], "<span style=\"$matches[1]\">$matches[2]</span>", $out);
break;
case '/.*@csgen\.div.*&lt;START.*,.*NAME&gt;\(.*&quot;(.*)&quot;\);/':
$out = str_replace($matches[0], "<div class=\"$matches[1]\">", $out);
break;
$out = str_replace($matches[0], "<div class=\"$matches[1]\">", $out);
break;
case '/.*@csgen\.div.*&lt;END.*,.*NAME&gt;\(.*&quot;(.*)&quot;\);/':
$out = str_replace($matches[0], "</div>", $out);
break;
$out = str_replace($matches[0], "</div>", $out);
break;
case '/.*@csgen\.div.*&lt;STYLE.*,.*NAME&gt;\(.*&quot;(.*)&quot;.*, &quot;(.*)&quot;\);/':
$out = str_replace($matches[0], "<style>\n.$matches[2] {\n\t$matches[1]\n}\n</style>", $out);
break;
case '/.*@csgen\.inline.*&lt;HTML&gt;\(.*&quot;(.*)&quot;\);/':
$out = str_replace($matches[0], "$matches[1]", $out);
break;
case '/.*@csgen\.image.*&lt;SIZE.*,.*PATH&gt;\(.*&quot;(.*)&quot;.*, &quot;(.*)&quot;\);/':
$imgres = array();
if (preg_match('/([0-9]*)x([0-9]*)/', $matches[1], $imgres)) {
$out = str_replace($matches[0], "<img width=\"$imgres[1]\" height=\"$imgres[2]\" src=\"$matches[2]\">", $out);
}
break;
$out = str_replace($matches[0], "<style>\n.$matches[2] {\n\t$matches[1]\n}\n</style>", $out);
break;
case '/.*@csgen\.inline.*&lt;HTML&gt;\(.*&quot;(.*)&quot;\);/':
$out = str_replace($matches[0], "$matches[1]", $out);
break;
case '/.*@csgen\.image.*&lt;SIZE.*,.*PATH&gt;\(.*&quot;(.*)&quot;.*, &quot;(.*)&quot;\);/':
$imgres = array();
if (preg_match('/([0-9]*)x([0-9]*)/', $matches[1], $imgres)) {
$out = str_replace($matches[0], "<img width=\"$imgres[1]\" height=\"$imgres[2]\" src=\"$matches[2]\">", $out);
}
break;
}
}
}