Clean up indentation
This commit is contained in:
parent
d4986146db
commit
acd4f3b432
103
core.php
103
core.php
|
@ -121,22 +121,22 @@ function convertMarkdownToHTML($contents) {
|
||||||
|
|
||||||
$ret = new parsedMarkdown();
|
$ret = new parsedMarkdown();
|
||||||
$parser = new MarkdownExtra;
|
$parser = new MarkdownExtra;
|
||||||
$parser->no_markup = false;
|
$parser->no_markup = true;
|
||||||
|
|
||||||
$specialSyntax = array(
|
$specialSyntax = array(
|
||||||
'/.*@csgen\.title.*=.*"(.*)(");/',
|
'/.*@csgen\.title.*=.*"(.*)(");/',
|
||||||
'/.*@csgen\.description.*=.*"(.*)(");/',
|
'/.*@csgen\.description.*=.*"(.*)(");/',
|
||||||
'/.*@csgen\.date.*=.*"(.*)(");/',
|
'/.*@csgen\.date.*=.*"(.*)(");/',
|
||||||
'/.*@csgen\.allowComments.*=.*"(.*)(");/',
|
'/.*@csgen\.allowComments.*=.*"(.*)(");/',
|
||||||
'/.*@csgen\.displayTitle.*=.*"(.*)(");/',
|
'/.*@csgen\.displayTitle.*=.*"(.*)(");/',
|
||||||
'/.*@csgen\.displayDate.*=.*"(.*)(");/',
|
'/.*@csgen\.displayDate.*=.*"(.*)(");/',
|
||||||
'/.*@csgen\.span.*<STYLE.*,.*TEXT>\(.*"(.*)".*, "(.*)"\);/',
|
'/.*@csgen\.span.*<STYLE.*,.*TEXT>\(.*"(.*)".*, "(.*)"\);/',
|
||||||
'/.*@csgen\.span.*<STYLE.*,.*HTML>\(.*"(.*)".*, "(.*)"\);/',
|
'/.*@csgen\.span.*<STYLE.*,.*HTML>\(.*"(.*)".*, "(.*)"\);/',
|
||||||
'/.*@csgen\.inline.*<HTML>\(.*"(.*)"\);/',
|
'/.*@csgen\.inline.*<HTML>\(.*"(.*)"\);/',
|
||||||
'/.*@csgen\.image.*<SIZE.*,.*PATH>\(.*"(.*)".*, "(.*)"\);/',
|
'/.*@csgen\.image.*<SIZE.*,.*PATH>\(.*"(.*)".*, "(.*)"\);/',
|
||||||
'/.*@csgen\.div.*<START.*,.*NAME>\(.*"(.*)"\);/',
|
'/.*@csgen\.div.*<START.*,.*NAME>\(.*"(.*)"\);/',
|
||||||
'/.*@csgen\.div.*<END.*,.*NAME>\(.*"(.*)"\);/',
|
'/.*@csgen\.div.*<END.*,.*NAME>\(.*"(.*)"\);/',
|
||||||
'/.*@csgen\.div.*<STYLE.*,.*NAME>\(.*"(.*)".*, "(.*)"\);/',
|
'/.*@csgen\.div.*<STYLE.*,.*NAME>\(.*"(.*)".*, "(.*)"\);/',
|
||||||
);
|
);
|
||||||
|
|
||||||
$out = $parser->transform($contents);
|
$out = $parser->transform($contents);
|
||||||
|
@ -147,59 +147,60 @@ function convertMarkdownToHTML($contents) {
|
||||||
if (preg_match($pattern, $out, $matches)) {
|
if (preg_match($pattern, $out, $matches)) {
|
||||||
switch ($pattern) {
|
switch ($pattern) {
|
||||||
case '/.*@csgen\.title.*=.*"(.*)(");/':
|
case '/.*@csgen\.title.*=.*"(.*)(");/':
|
||||||
$ret->title = $matches[1];
|
$ret->title = $matches[1];
|
||||||
$out = str_replace($matches[0], '', $out);
|
$out = str_replace($matches[0], '', $out);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case '/.*@csgen\.description.*=.*"(.*)(");/':
|
case '/.*@csgen\.description.*=.*"(.*)(");/':
|
||||||
$ret->description = $matches[1];
|
$ret->description = $matches[1];
|
||||||
$out = str_replace($matches[0], '', $out);
|
$out = str_replace($matches[0], '', $out);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case '/.*@csgen\.date.*=.*"(.*)(");/':
|
case '/.*@csgen\.date.*=.*"(.*)(");/':
|
||||||
$ret->date = $matches[1];
|
$ret->date = $matches[1];
|
||||||
$out = str_replace($matches[0], '', $out);
|
$out = str_replace($matches[0], '', $out);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case '/.*@csgen\.allowComments.*=.*"(.*)(");/':
|
case '/.*@csgen\.allowComments.*=.*"(.*)(");/':
|
||||||
$ret->allowComments = $matches[1];
|
$ret->allowComments = $matches[1];
|
||||||
$out = str_replace($matches[0], '', $out);
|
$out = str_replace($matches[0], '', $out);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case '/.*@csgen\.displayTitle.*=.*"(.*)(");/':
|
case '/.*@csgen\.displayTitle.*=.*"(.*)(");/':
|
||||||
$ret->displayTitle = $matches[1];
|
$ret->displayTitle = $matches[1];
|
||||||
$out = str_replace($matches[0], '', $out);
|
$out = str_replace($matches[0], '', $out);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case '/.*@csgen\.displayDate.*=.*"(.*)(");/':
|
case '/.*@csgen\.displayDate.*=.*"(.*)(");/':
|
||||||
$ret->displayDate = $matches[1];
|
$ret->displayDate = $matches[1];
|
||||||
$out = str_replace($matches[0], '', $out);
|
$out = str_replace($matches[0], '', $out);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case '/.*@csgen\.span.*<STYLE.*,.*TEXT>\(.*"(.*)".*, "(.*)"\);/':
|
case '/.*@csgen\.span.*<STYLE.*,.*TEXT>\(.*"(.*)".*, "(.*)"\);/':
|
||||||
$out = str_replace($matches[0], "<span style=\"$matches[1]\">$matches[2]</span>", $out);
|
$out = str_replace($matches[0], "<span style=\"$matches[1]\">$matches[2]</span>", $out);
|
||||||
break;
|
break;
|
||||||
case '/.*@csgen\.span.*<STYLE.*,.*HTML>\(.*"(.*)".*, "(.*)"\);/':
|
case '/.*@csgen\.span.*<STYLE.*,.*HTML>\(.*"(.*)".*, "(.*)"\);/':
|
||||||
$out = str_replace($matches[0], "<span style=\"$matches[1]\">$matches[2]</span>", $out);
|
$out = str_replace($matches[0], "<span style=\"$matches[1]\">$matches[2]</span>", $out);
|
||||||
break;
|
break;
|
||||||
case '/.*@csgen\.div.*<START.*,.*NAME>\(.*"(.*)"\);/':
|
case '/.*@csgen\.div.*<START.*,.*NAME>\(.*"(.*)"\);/':
|
||||||
$out = str_replace($matches[0], "<div class=\"$matches[1]\">", $out);
|
$out = str_replace($matches[0], "<div class=\"$matches[1]\">", $out);
|
||||||
break;
|
break;
|
||||||
case '/.*@csgen\.div.*<END.*,.*NAME>\(.*"(.*)"\);/':
|
case '/.*@csgen\.div.*<END.*,.*NAME>\(.*"(.*)"\);/':
|
||||||
$out = str_replace($matches[0], "</div>", $out);
|
$out = str_replace($matches[0], "</div>", $out);
|
||||||
break;
|
break;
|
||||||
case '/.*@csgen\.div.*<STYLE.*,.*NAME>\(.*"(.*)".*, "(.*)"\);/':
|
case '/.*@csgen\.div.*<STYLE.*,.*NAME>\(.*"(.*)".*, "(.*)"\);/':
|
||||||
$out = str_replace($matches[0], "<style>\n.$matches[2] {\n\t$matches[1]\n}\n</style>", $out);
|
$out = str_replace($matches[0], "<style>\n.$matches[2] {\n\t$matches[1]\n}\n</style>", $out);
|
||||||
break;
|
break;
|
||||||
case '/.*@csgen\.inline.*<HTML>\(.*"(.*)"\);/':
|
case '/.*@csgen\.inline.*<HTML>\(.*"(.*)"\);/':
|
||||||
$out = str_replace($matches[0], "$matches[1]", $out);
|
$out = str_replace($matches[0], "$matches[1]", $out);
|
||||||
break;
|
break;
|
||||||
case '/.*@csgen\.image.*<SIZE.*,.*PATH>\(.*"(.*)".*, "(.*)"\);/':
|
case '/.*@csgen\.image.*<SIZE.*,.*PATH>\(.*"(.*)".*, "(.*)"\);/':
|
||||||
$imgres = array();
|
$imgres = array();
|
||||||
if (preg_match('/([0-9]*)x([0-9]*)/', $matches[1], $imgres)) {
|
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);
|
$out = str_replace($matches[0], "<img width=\"$imgres[1]\" height=\"$imgres[2]\" src=\"$matches[2]\">", $out);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue