diff --git a/.gitignore b/.gitignore
index 5cfe6fd..fb87cd8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
# 忽略开发文件夹
.vs/
+.vscode/
debug/
.idea/
diff --git a/assets/bread-card-markdown-mixins.css b/assets/bread-card-markdown-mixins.css
new file mode 100644
index 0000000..3dee7a8
--- /dev/null
+++ b/assets/bread-card-markdown-mixins.css
@@ -0,0 +1,15 @@
+/******************************************************************************
+ ##############################################################################
+ ##### #####
+ ##### Markdown StyleSheet of ui design BreadCard #####
+ ##### Mixins classes support #####
+ ##### #####
+ ##### @author: Sukazyo Workshop #####
+ ##### @version: 1.0 #####
+ ##### #####
+ ##############################################################################
+ ******************************************************************************/
+
+.em-height {
+ height: 1em;
+}
diff --git a/assets/bread-card-markdown.css b/assets/bread-card-markdown.css
index c958cb6..74b886e 100644
--- a/assets/bread-card-markdown.css
+++ b/assets/bread-card-markdown.css
@@ -102,6 +102,7 @@ a {
}
a:hover {
+ text-decoration: none;
color: var(--bcm-color-font-base-link-hover);
}
@@ -137,8 +138,10 @@ ul, ol, table,
pre {
margin-block-start: 1.6rem;
margin-block-end: 1.6rem;
-
line-height: 1.6;
+ /* for some capability */
+ border: none;
+ outline: none;
}
ul ul,
diff --git a/assets/ph-bookshelf.svg b/assets/ph-bookshelf.svg
new file mode 100644
index 0000000..fc3216d
--- /dev/null
+++ b/assets/ph-bookshelf.svg
@@ -0,0 +1,21 @@
+
+
\ No newline at end of file
diff --git a/assets/xsd/book.xsd b/assets/xsd/book.xsd
index a7e2cf8..1468125 100644
--- a/assets/xsd/book.xsd
+++ b/assets/xsd/book.xsd
@@ -1,12 +1,12 @@
-
+
@@ -14,9 +14,9 @@
-
+
-
+
@@ -25,9 +25,9 @@
-
+
-
+
@@ -37,9 +37,9 @@
-
+
-
+
@@ -49,7 +49,7 @@
-
+
diff --git a/assets/xsd/bookshelf.xsd b/assets/xsd/bookshelf.xsd
index 18c9812..edc1b23 100644
--- a/assets/xsd/bookshelf.xsd
+++ b/assets/xsd/bookshelf.xsd
@@ -1,35 +1,36 @@
-
-
+
+
+
-
+
-
+
-
+
-
+
@@ -53,7 +54,7 @@
-
+
@@ -78,7 +79,7 @@
-
+
diff --git a/assets/xsd/configurations.xsd b/assets/xsd/configurations.xsd
index 05f336d..c893377 100644
--- a/assets/xsd/configurations.xsd
+++ b/assets/xsd/configurations.xsd
@@ -1,8 +1,8 @@
diff --git a/constant.php b/constant.php
index 5c08969..a38913b 100644
--- a/constant.php
+++ b/constant.php
@@ -2,6 +2,6 @@
const APP_NAME = "ph-Bookshelf";
-const VERSION = "0.5.0-alpha12";
+const VERSION = "0.5.0-alpha13";
const CHANNEL = "suk-ws";
const BRANCH = "config-v2.0";
diff --git a/index.php b/index.php
index d85b187..5121019 100644
--- a/index.php
+++ b/index.php
@@ -38,6 +38,12 @@ try {
exit(SiteMeta::getConfigurationLevelShelf("site.robots"));
}
+ } else if (sizeof($uri) == 1 && $uri[0] == "favicon.ico") { // 为 favicon.ico 进行特别支持
+
+ $iconPath = SiteMeta::getGlobalIcon();
+
+ PageParse::output301($iconPath);
+
} else if (PageMeta::init($uri)) {
require "./template/header.php";
diff --git a/src/Data/SiteMeta.php b/src/Data/SiteMeta.php
index 87c6620..ce8cd32 100644
--- a/src/Data/SiteMeta.php
+++ b/src/Data/SiteMeta.php
@@ -32,7 +32,9 @@ class SiteMeta {
}
public static function getGlobalIcon (): string {
- return "/favicon.ico"; // TODO ICON
+ $icon = self::$BOOKSHELF->getSiteIcon();
+ if ($icon != null) return $icon;
+ else return "/assets/ph-bookshelf.svg";
}
public static function getStylesheetsList (): array {
@@ -45,7 +47,8 @@ class SiteMeta {
null:"https://cdn.jsdelivr.net/gh/PrismJS/prism-themes@master/themes/".PageMeta::prismTheme().".min.css"),
(PageMeta::getConfigurationLevelPage(ConfigName::regex_highlight)=="false")?
null:"//cdn.jsdelivr.net/gh/suk-ws/regex-colorizer@master/regex-colorizer-default.min.css",
- "/assets/bread-card-markdown.css?ver=3",
+ "/assets/bread-card-markdown.css?ver=4",
+ "/assets/bread-card-markdown-mixins.css?ver=1",
"/assets/bread-card-markdown-footnote.css?ver=1",
"/assets/bread-card-markdown-task-list.css?ver=1",
"/assets/bread-card-markdown-heading-permalink.css?ver=1",
diff --git a/src/Element/Bookshelf.php b/src/Element/Bookshelf.php
index 7725690..d3e8d99 100644
--- a/src/Element/Bookshelf.php
+++ b/src/Element/Bookshelf.php
@@ -13,6 +13,7 @@ class Bookshelf {
private string $configureVersion;
private string $siteName;
+ private ?string $siteIcon;
private LinkCollection $links;
private BookCollection $books;
@@ -56,6 +57,9 @@ class Bookshelf {
case "site_name":
$return->siteName = self::parseSiteName($rc);
break;
+ case "site_icon":
+ $return->siteIcon = self::parseSiteIcon($rc);
+ break;
case "#comment":
break;
case "#text":
@@ -118,10 +122,27 @@ class Bookshelf {
return $siteNameValue;
}
+ private static function parseSiteIcon (DOMNode $siteNameNode): string {
+ $siteNameValue = "";
+ for ($child = $siteNameNode->firstChild; $child != null; $child = $child->nextSibling) {
+ $siteNameValue .= match ($child->nodeName) {
+ "#text", "#cdata-section" => $child->nodeValue,
+ default => throw new Exception(
+ "Unsupported element type \"$child->nodeName\" in parsing configuration $siteNameNode->nodeName"
+ ),
+ };
+ }
+ return $siteNameValue;
+ }
+
public function getSiteName (): string {
return $this->siteName;
}
+ public function getSiteIcon (): string {
+ return $this->siteIcon;
+ }
+
public function getLinks (): LinkCollection {
return $this->links;
}
diff --git a/src/Utils/PageParse.php b/src/Utils/PageParse.php
index 825ce82..2ea63ea 100644
--- a/src/Utils/PageParse.php
+++ b/src/Utils/PageParse.php
@@ -57,6 +57,12 @@ class PageParse {
exit;
}
+ #[NoReturn]
+ public static function output301 (string $url): void {
+ header("Location: $url", true, 301);
+ exit;
+ }
+
/**
* 根据链接数组生成对应的链接/路径
*