mirror of
https://github.com/suk-ws/ph-Bookshelf.git
synced 2025-01-19 15:25:03 +08:00
add support of <configurations> in book.xml
This commit is contained in:
parent
175b1ad04a
commit
4d9985da1e
@ -14,6 +14,8 @@
|
||||
|
||||
<xs:element name="book_name" type="xs:string" />
|
||||
|
||||
<xs:element name="configurations" type="phb-config-level-book" />
|
||||
|
||||
<xs:element name="contents" type="bookContents" />
|
||||
|
||||
</xs:sequence>
|
||||
|
@ -8,9 +8,9 @@
|
||||
|
||||
<xs:complexType name="phb-config-level-site">
|
||||
<xs:all>
|
||||
<xs:element minOccurs="0" name="highlightjs" type="xs:boolean" />
|
||||
<xs:element minOccurs="0" name="highlightjs.languages" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="highlightjs.theme" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="prism" type="xs:boolean" />
|
||||
<xs:element minOccurs="0" name="prism.theme" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="prism.plugins" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="codeblock.bg-color" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="codeblock.fg-color" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="codeblock.tab-size" type="xs:integer" />
|
||||
@ -22,10 +22,25 @@
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="phb-config-level-book">
|
||||
<xs:all>
|
||||
<xs:element minOccurs="0" name="prism" type="xs:boolean" />
|
||||
<xs:element minOccurs="0" name="prism.theme" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="prism.plugins" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="codeblock.bg-color" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="codeblock.fg-color" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="codeblock.tab-size" type="xs:integer" />
|
||||
<xs:element minOccurs="0" name="regex.highlight" type="xs:boolean" />
|
||||
<xs:element minOccurs="0" name="listing.marker.rainbow" type="xs:boolean" />
|
||||
<xs:element minOccurs="0" name="title.permalink.flash" type="xs:boolean" />
|
||||
<xs:element minOccurs="0" name="web-title.rolling" type="xs:boolean" />
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:attributeGroup name="phb-config-level-page">
|
||||
<xs:attribute name="highlightjs" type="xs:boolean" />
|
||||
<xs:attribute name="highlightjs.languages" type="xs:string" />
|
||||
<xs:attribute name="highlightjs.theme" type="xs:string" />
|
||||
<xs:attribute name="prism" type="xs:boolean" />
|
||||
<xs:attribute name="prism.theme" type="xs:string" />
|
||||
<xs:attribute name="prism.plugins" type="xs:string" />
|
||||
<xs:attribute name="codeblock.bg-color" type="xs:string" />
|
||||
<xs:attribute name="codeblock.fg-color" type="xs:string" />
|
||||
<xs:attribute name="codeblock.tab-size" type="xs:integer" />
|
||||
|
@ -2,6 +2,6 @@
|
||||
|
||||
const APP_NAME = "ph-Bookshelf";
|
||||
|
||||
const VERSION = "0.5.0-alpha4";
|
||||
const VERSION = "0.5.0-alpha5";
|
||||
const CHANNEL = "suk-ws";
|
||||
const BRANCH = "config-v2.0";
|
||||
|
@ -5,6 +5,7 @@ namespace SukWs\Bookshelf\Element\BookContent;
|
||||
use DOMDocument;
|
||||
use DOMNode;
|
||||
use Exception;
|
||||
use SukWs\Bookshelf\Element\Bookshelf;
|
||||
|
||||
class BookContented {
|
||||
|
||||
@ -32,13 +33,17 @@ class BookContented {
|
||||
for ($child = $nodeBook->firstChild; $child != null; $child = $child->nextSibling) {
|
||||
switch ($child->nodeName) {
|
||||
case "book_name":
|
||||
if (!empty($return->name)) throw new Exception("Duplicated contents in Book.xml");
|
||||
if (!empty($return->name)) throw new Exception("Duplicated book_name in Book.xml");
|
||||
$return->name = $child->nodeValue;
|
||||
break;
|
||||
case "contents":
|
||||
if (!empty($return->children)) throw new Exception("Duplicated contents in Book.xml");
|
||||
$return->children = Chapter::parse($child, null);
|
||||
break;
|
||||
case "configurations":
|
||||
if (!empty($return->children)) throw new Exception("Duplicated configurations in Book.xml");
|
||||
Bookshelf::parseConfiguration($child, $return->configurations);
|
||||
break;
|
||||
case "#comment":
|
||||
case "#text":
|
||||
if (empty(trim($child->nodeValue))) break;
|
||||
|
Loading…
Reference in New Issue
Block a user