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