1
0
mirror of https://github.com/suk-ws/ph-Bookshelf.git synced 2024-12-05 09:26:52 +08:00

添加了 CHANNEL 和 BRANCH 声明,最下方的生成器现在会显示版本

- 修改 constant 声明
  - 添加了 CHANNEL 声明程序来源
  - 添加了 BRANCH 声明程序所处的更新线
  - 将 get_frontpage_generate_version 移动至 SiteMeta 中
- 将 bookshelf 的 getHtml 中的主容器声明和生成器声明移至上层
- 给生成器声明添加了一个灰色小字的版本号声明
  - ph-Bookshelf 的为 VERSION at CHANNEL/BRANCH
  - gitbook 为 VERSION
This commit is contained in:
A.C.Sukazyo Eyre 2021-05-10 12:09:29 +08:00
parent 309a378303
commit d83fb713f9
Signed by: Eyre_S
GPG Key ID: EFB47D98FE082FAD
6 changed files with 41 additions and 13 deletions

View File

@ -68,3 +68,13 @@
.book-summary ul.summary div.summary-container.on + li.divider.block-end { .book-summary ul.summary div.summary-container.on + li.divider.block-end {
transform: rotateX(180deg); transform: rotateX(180deg);
} }
.book .book-summary ul.summary li span.annotation {
padding: 0;
font-size: 0.2em;
color: rgba(0, 0, 0, 0.2);
}
.book .book-summary ul.summary li span.annotation:hover {
text-decoration: none !important;
}

View File

@ -1,9 +1,9 @@
<?php <?php
define("APP_NAME", "ph-Bookshelf"); const APP_NAME = "ph-Bookshelf";
define("VERSION", "0.1");
define("GITBOOK_VERSION", "3.2.3");
function get_frontpage_generate_version (): string { const VERSION = "0.1-dev";
return APP_NAME." ".VERSION." with Gitbook ".GITBOOK_VERSION; const CHANNEL = "workshop-origin";
} const BRANCH = "master";
const GITBOOK_VERSION = "3.2.3";

View File

@ -6,6 +6,7 @@ require_once "./src/Data/PageMeta.php";
require_once "./lib/Parsedown/Parsedown.php"; require_once "./lib/Parsedown/Parsedown.php";
require_once "./src/Utils/PageParse.php"; require_once "./src/Utils/PageParse.php";
require_once "./src/Utils/RequestNotExistException.php"; require_once "./src/Utils/RequestNotExistException.php";
require_once "./constant.php";
$parser = new Parsedown(); $parser = new Parsedown();
@ -76,7 +77,22 @@ try {
</ul> </ul>
</div> </div>
<nav role="navigation"> <nav role="navigation">
<?= SiteMeta::getBookshelf()->getHtml(); ?> <ul id='global-container' class='summary'>
<?= SiteMeta::getBookshelf()->getHtml(); ?>
<li class='divider'></li>
<li>
<a href='https://github.com/Eyre-S/ph-Bookshelf' target='blank' class='gitbook-link'>
Generated with ph-Bookshelf
<br/><span class="annotation"><?= sprintf("%s at %s/%s", VERSION, CHANNEL, BRANCH) ?></span>
</a>
</li>
<li>
<a href='https://www.gitbook.com' target='blank' class='gitbook-link'>
Front-End by GitBook
<br/><span class="annotation"><?= GITBOOK_VERSION ?></span>
</a>
</li>
</ul>
</nav> </nav>
</div> </div>
<div class="book-body"> <div class="book-body">

View File

@ -1,10 +1,15 @@
<?php <?php
require_once "./src/Element/Bookshelf.php"; require_once "./src/Element/Bookshelf.php";
require_once "./constant.php";
class SiteMeta { class SiteMeta {
private static Bookshelf $BOOKSHELF; private static Bookshelf $BOOKSHELF;
static function get_frontpage_generate_version (): string {
return APP_NAME." ".VERSION." with Gitbook ".GITBOOK_VERSION;
}
/** /**
* @throws Exception * @throws Exception

View File

@ -71,14 +71,12 @@ class Bookshelf {
} }
public function getHtml (): string { public function getHtml (): string {
$str = "<ul id='global-container' class='summary'>"; $str = $this->links->getHtml();
$str .= $this->links->getHtml();
$str .= "<li class='divider block-start'></li><div class='summary-container" . (PageMeta::$isMainPage?" on":"") . "'>"; $str .= "<li class='divider block-start'></li><div class='summary-container" . (PageMeta::$isMainPage?" on":"") . "'>";
$str .= $this->books->getHtml(); $str .= $this->books->getHtml();
$str .= "</div><li class='divider block-end'></li>"; $str .= "</div><li class='divider block-end'></li>";
$str .= PageMeta::$book->getSummaryHtml(); $str .= PageMeta::$book->getSummaryHtml();
$str .= "<li class='divider'></li><li><a href='https://github.com/Eyre-S/ph-Bookshelf' target='blank' class='gitbook-link'>Generated with ph-Bookshelf</a></li><li><a href='https://www.gitbook.com' target='blank' class='gitbook-link'>Front-End by GitBook</a></li>"; $str .= "";
$str .= "</ul>";
return $str; return $str;
} }

View File

@ -1,4 +1,3 @@
<?php require_once "./constant.php" ?>
<?php require_once "./src/Data/SiteMeta.php" ?> <?php require_once "./src/Data/SiteMeta.php" ?>
<?php require_once "./src/Data/PageMeta.php" ?> <?php require_once "./src/Data/PageMeta.php" ?>
<!DOCTYPE HTML> <!DOCTYPE HTML>
@ -17,7 +16,7 @@
<!-- Unused: <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png"> --> <!-- Unused: <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png"> -->
<title><?= PageMeta::getPageTitle() ?></title> <title><?= PageMeta::getPageTitle() ?></title>
<meta name="description" content="<?= PageMeta::getDescription() ?>"> <meta name="description" content="<?= PageMeta::getDescription() ?>">
<meta name="generator" content="<?= get_frontpage_generate_version() ?>"> <meta name="generator" content="<?= SiteMeta::get_frontpage_generate_version() ?>">
<!-- Gitbook Assets(css) --> <!-- Gitbook Assets(css) -->
<?php <?php
foreach (SiteMeta::getGitbookStylesheetsList() as $item) { foreach (SiteMeta::getGitbookStylesheetsList() as $item) {