Skip to content

Commit d83fb71

Browse files
committed
添加了 CHANNEL 和 BRANCH 声明,最下方的生成器现在会显示版本
- 修改 constant 声明 - 添加了 CHANNEL 声明程序来源 - 添加了 BRANCH 声明程序所处的更新线 - 将 get_frontpage_generate_version 移动至 SiteMeta 中 - 将 bookshelf 的 getHtml 中的主容器声明和生成器声明移至上层 - 给生成器声明添加了一个灰色小字的版本号声明 - ph-Bookshelf 的为 VERSION at CHANNEL/BRANCH - gitbook 为 VERSION
1 parent 309a378 commit d83fb71

File tree

6 files changed

+41
-13
lines changed

6 files changed

+41
-13
lines changed

assets/gitbook-fix.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,13 @@
6868
.book-summary ul.summary div.summary-container.on + li.divider.block-end {
6969
transform: rotateX(180deg);
7070
}
71+
72+
.book .book-summary ul.summary li span.annotation {
73+
padding: 0;
74+
font-size: 0.2em;
75+
color: rgba(0, 0, 0, 0.2);
76+
}
77+
78+
.book .book-summary ul.summary li span.annotation:hover {
79+
text-decoration: none !important;
80+
}

constant.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

3-
define("APP_NAME", "ph-Bookshelf");
4-
define("VERSION", "0.1");
5-
define("GITBOOK_VERSION", "3.2.3");
3+
const APP_NAME = "ph-Bookshelf";
64

7-
function get_frontpage_generate_version (): string {
8-
return APP_NAME." ".VERSION." with Gitbook ".GITBOOK_VERSION;
9-
}
5+
const VERSION = "0.1-dev";
6+
const CHANNEL = "workshop-origin";
7+
const BRANCH = "master";
8+
9+
const GITBOOK_VERSION = "3.2.3";

index.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require_once "./lib/Parsedown/Parsedown.php";
77
require_once "./src/Utils/PageParse.php";
88
require_once "./src/Utils/RequestNotExistException.php";
9+
require_once "./constant.php";
910

1011
$parser = new Parsedown();
1112

@@ -76,7 +77,22 @@
7677
</ul>
7778
</div>
7879
<nav role="navigation">
79-
<?= SiteMeta::getBookshelf()->getHtml(); ?>
80+
<ul id='global-container' class='summary'>
81+
<?= SiteMeta::getBookshelf()->getHtml(); ?>
82+
<li class='divider'></li>
83+
<li>
84+
<a href='https://github.com/Eyre-S/ph-Bookshelf' target='blank' class='gitbook-link'>
85+
Generated with ph-Bookshelf
86+
<br/><span class="annotation"><?= sprintf("%s at %s/%s", VERSION, CHANNEL, BRANCH) ?></span>
87+
</a>
88+
</li>
89+
<li>
90+
<a href='https://www.gitbook.com' target='blank' class='gitbook-link'>
91+
Front-End by GitBook
92+
<br/><span class="annotation"><?= GITBOOK_VERSION ?></span>
93+
</a>
94+
</li>
95+
</ul>
8096
</nav>
8197
</div>
8298
<div class="book-body">

src/Data/SiteMeta.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
<?php
22

33
require_once "./src/Element/Bookshelf.php";
4+
require_once "./constant.php";
45

56
class SiteMeta {
67

78
private static Bookshelf $BOOKSHELF;
9+
10+
static function get_frontpage_generate_version (): string {
11+
return APP_NAME." ".VERSION." with Gitbook ".GITBOOK_VERSION;
12+
}
813

914
/**
1015
* @throws Exception

src/Element/Bookshelf.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,12 @@ public function getRootBook (): BookContented {
7171
}
7272

7373
public function getHtml (): string {
74-
$str = "<ul id='global-container' class='summary'>";
75-
$str .= $this->links->getHtml();
74+
$str = $this->links->getHtml();
7675
$str .= "<li class='divider block-start'></li><div class='summary-container" . (PageMeta::$isMainPage?" on":"") . "'>";
7776
$str .= $this->books->getHtml();
7877
$str .= "</div><li class='divider block-end'></li>";
7978
$str .= PageMeta::$book->getSummaryHtml();
80-
$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>";
81-
$str .= "</ul>";
79+
$str .= "";
8280
return $str;
8381
}
8482

template/header.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<?php require_once "./constant.php" ?>
21
<?php require_once "./src/Data/SiteMeta.php" ?>
32
<?php require_once "./src/Data/PageMeta.php" ?>
43
<!DOCTYPE HTML>
@@ -17,7 +16,7 @@
1716
<!-- Unused: <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png"> -->
1817
<title><?= PageMeta::getPageTitle() ?></title>
1918
<meta name="description" content="<?= PageMeta::getDescription() ?>">
20-
<meta name="generator" content="<?= get_frontpage_generate_version() ?>">
19+
<meta name="generator" content="<?= SiteMeta::get_frontpage_generate_version() ?>">
2120
<!-- Gitbook Assets(css) -->
2221
<?php
2322
foreach (SiteMeta::getGitbookStylesheetsList() as $item) {

0 commit comments

Comments
 (0)