diff --git a/css/base.css b/css/default/base.css
similarity index 100%
rename from css/base.css
rename to css/default/base.css
diff --git a/css/black_wide.css b/css/default/black_wide.css
similarity index 100%
rename from css/black_wide.css
rename to css/default/black_wide.css
diff --git a/css/debug.css b/css/default/debug.css
similarity index 100%
rename from css/debug.css
rename to css/default/debug.css
diff --git a/css/htmgem.css b/css/default/htmgem.css
similarity index 100%
rename from css/htmgem.css
rename to css/default/htmgem.css
diff --git a/css/raw.css b/css/default/raw.css
similarity index 100%
rename from css/raw.css
rename to css/default/raw.css
diff --git a/css/simple.css b/css/default/simple.css
similarity index 100%
rename from css/simple.css
rename to css/default/simple.css
diff --git a/css/terminal.css b/css/default/terminal.css
similarity index 100%
rename from css/terminal.css
rename to css/default/terminal.css
diff --git a/css/index.gmi b/css/index.gmi
index 8be2750..eb9abec 100644
--- a/css/index.gmi
+++ b/css/index.gmi
@@ -1,13 +1,12 @@
# Styles
-=> index.gmi|htmgem htmgem.css
-=> index.gmi|none None
-=> index.gmi|terminal terminal.css
-=> index.gmi|black_wide black_wide.css
-=> index.gmi|simple simple.css
-=> index.gmi|raw raw.css
-=> index.gmi|debug debug.css
-=> index.gmi|pre Source code
+=> index.gmi|default,htmgem.css htmgem.css
+=> index.gmi|default,terminal.css terminal.css
+=> index.gmi|default,black_wide.css black_wide.css
+=> index.gmi|default,simple.css simple.css
+=> index.gmi|default,raw.css raw.css
+=> index.gmi|default,debug.css debug.css
+=> index.gmi|src Source code
=> index.gmi|source Download source code
Lorem ipsum dolor sit amet.
diff --git a/index.html b/index.html
index 23fed8c..0823c26 100644
--- a/index.html
+++ b/index.html
@@ -3,7 +3,7 @@
HtmGem
-
+
HtmGem
diff --git a/index.php b/index.php
index c8d2a6a..b57bd33 100644
--- a/index.php
+++ b/index.php
@@ -4,6 +4,8 @@ require_once "lib-htmgem.inc.php";
require_once "lib-html.inc.php";
require_once "lib-io.inc.php";
+define("DEFAULT_CSS", "/css/default/htmgem.css");
+
$documentRoot = $_SERVER['DOCUMENT_ROOT'];
$scheme = (@$_SERVER['REQUEST_SCHEME']??"http")."://";
$domain = $_SERVER['HTTP_HOST'];
@@ -24,7 +26,7 @@ if (empty($url)) {
http_response_code(403);
} else {
$gt_html = new \htmgem\GemTextTranslate_html(file_get_contents("index.gmi"), true, "$php_self?url=", $php_self_dir);
- if (empty($gt_html->getCss)) $gt_html->addCss($php_self_dir."/css/htmgem.css");
+ if (empty($gt_html->getCss)) $gt_html->addCss($php_self_dir.DEFAULT_CSS);
// No URL Rewritting assumed
echo \htmgem\html\getHtmlWithMenu($gt_html, $scheme, $domain, $php_self, "$php_self?url=");
@@ -91,7 +93,7 @@ if ("source" == $style) {
header('Content-Length: ' . filesize($filePath));
echo $fileContents;
exit();
-} elseif ("pre" == $style) {
+} elseif ("src" == $style) {
# Gets the page title: the first occurrence with # at the line start
mb_ereg("#\s*([^\n]+)\n", $fileContents, $matches);
$page_title = @$matches[1];
@@ -116,11 +118,7 @@ if ($urlRewriting)
else
$gt_html = new \htmgem\GemTextTranslate_html($fileContents, $gt_htmlextDecoration, "$php_self?url=", dirname($url));
-if ("none" == $style) {
- #$gt_html->addCss("");
-} elseif ("/" == @$style[0]) {
- $gt_html->addCss($style);
-} elseif (empty($style)) {
+if (empty($style)) { // Searches for a stylesheet for the current page.
$parts = pathinfo($filePath);
$localCss = $parts["filename"].".css";
$localCssFilePath = $parts["dirname"]."/".$localCss;
@@ -129,10 +127,11 @@ if ("none" == $style) {
# as the path is relative to htmgem.php and not / !
$gt_html->addCss($localCss);
} else { // No local style
- $gt_html->addCss($php_self_dir."/css/htmgem.css");
+ $gt_html->addCss($php_self_dir.DEFAULT_CSS);
}
-} else { #TODO: regex check for $style
- $gt_html->addCss("$php_self_dir/css/$style.css");
+} else {
+ $style = preg_replace("/,/", "/", $style);
+ $gt_html->addCss("$php_self_dir/css/$style");
}
if ($urlRewriting)