1
0
mirror of https://tildegit.org/sbgodin/HtmGem.git synced 2023-08-25 13:53:12 +02:00
This commit is contained in:
Christophe HENRY 2021-03-18 14:43:02 +01:00
parent 859b0aad81
commit d280ceff94
2 changed files with 18 additions and 19 deletions

View File

@ -83,13 +83,14 @@ $fileContents</pre>
</html> </html>
EOL; EOL;
exit(); exit();
} else { }
$t = new \htmgem\GemTextTranslate_html($fileContents);
if ("none" == $style) { $t = new \htmgem\GemTextTranslate_html($fileContents, $textDecoration);
if ("none" == $style) {
$t->addCss(""); $t->addCss("");
} elseif ("/" == @$style[0]) { } elseif ("/" == @$style[0]) {
$t->addCss($style); $t->addCss($style);
} elseif (empty($style)) { } elseif (empty($style)) {
$parts = pathinfo($filePath); $parts = pathinfo($filePath);
$localCss = $parts["filename"].".css"; $localCss = $parts["filename"].".css";
$localCssFilePath = $parts["dirname"]."/".$localCss; $localCssFilePath = $parts["dirname"]."/".$localCss;
@ -98,9 +99,8 @@ EOL;
# as the path is relative to htmgem.php and not / ! # as the path is relative to htmgem.php and not / !
$t->addCss($localCss); $t->addCss($localCss);
} }
} else { #TODO: regex check for $style } else { #TODO: regex check for $style
$t->addCss("/htmgem/css/$style.css"); $t->addCss("/htmgem/css/$style.css");
}
} }
echo $t->getFullHtml(); echo $t->getFullHtml();

View File

@ -170,8 +170,7 @@ class GemtextTranslate_html {
function __construct($parsedGemtext, $textDecorationEnabled=true) { function __construct($parsedGemtext, $textDecorationEnabled=true) {
if (empty($parsedGemtext)) if (empty($parsedGemtext))
// So translate() will do no loop. $parsedGemtext = "";
$parsedGemtext = array();
elseif (is_string($parsedGemtext)) elseif (is_string($parsedGemtext))
// to delete the last empty line, <p>&nbsp;</p> in HTML // to delete the last empty line, <p>&nbsp;</p> in HTML
$parsedGemtext = rtrim($parsedGemtext); $parsedGemtext = rtrim($parsedGemtext);