mirror of
https://github.com/suk-ws/ph-Bookshelf.git
synced 2024-12-05 01:16:53 +08:00
使正文不再自动输出主标题,使xml解析器允许注释,使 #text 仅在没有字符时被忽略
This commit is contained in:
parent
6a56ee1730
commit
fdbc6ed8f3
@ -2,6 +2,6 @@
|
||||
|
||||
const APP_NAME = "ph-Bookshelf";
|
||||
|
||||
const VERSION = "0.3.0.6";
|
||||
const VERSION = "0.3.0.7";
|
||||
const CHANNEL = "suk-ws";
|
||||
const BRANCH = "master";
|
||||
|
@ -44,8 +44,10 @@ class BookCollection {
|
||||
case "Collection":
|
||||
array_push($node->array, BookCollection::parse($child, $node));
|
||||
break;
|
||||
case "#text":
|
||||
case "#comment":
|
||||
break;
|
||||
case "#text":
|
||||
if (empty(trim($child->nodeValue))) break;
|
||||
default:
|
||||
throw new Exception("Unsupported element type \"$child->nodeName\" in BookCollection named \"$name\"");
|
||||
}
|
||||
|
@ -37,8 +37,10 @@ class Chapter {
|
||||
case "Chapter":
|
||||
array_push($node->childs, self::parse($child, $node));
|
||||
break;
|
||||
case "#text":
|
||||
case "#comment":
|
||||
break;
|
||||
case "#text":
|
||||
if (empty(trim($child->nodeValue))) break;
|
||||
default:
|
||||
throw new Exception("Unsupported element type \"$child->nodeName\" in Chapter \"$node->name\"");
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ class Page {
|
||||
for ($child = $xmlData->firstChild;$child != null ; $child = $child->nextSibling) {
|
||||
switch ($child->nodeName) {
|
||||
case "#text":
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Unsupported element type \"$child->nodeName\" in Page with id $id");
|
||||
}
|
||||
|
@ -42,8 +42,10 @@ class Bookshelf {
|
||||
case "rootBook":
|
||||
$return->rootBook = BookContented::parse($rc);
|
||||
break;
|
||||
case "#text":
|
||||
case "#comment":
|
||||
break;
|
||||
case "#text":
|
||||
if (empty(trim($rc->nodeValue))) break;
|
||||
default:
|
||||
throw new Exception("Unsupported element type \"$rc->nodeName\" in root child of Bookshelf");
|
||||
}
|
||||
|
@ -43,8 +43,10 @@ class LinkCollection {
|
||||
case "Collection":
|
||||
array_push($node->array, LinkCollection::parse($child, $node));
|
||||
break;
|
||||
case "#text":
|
||||
case "#comment":
|
||||
break;
|
||||
case "#text":
|
||||
if (empty(trim($child->nodeValue))) break;
|
||||
default:
|
||||
throw new Exception("Unsupported element type \"$child->nodeName\" in LinkCollection named \"$name\"");
|
||||
}
|
||||
|
@ -8,5 +8,5 @@ $parser = new ParsedownExtend();
|
||||
$parser->setMarkupEscaped(false);
|
||||
$parser->setSafeMode(false);
|
||||
|
||||
echo "<h1 id='phb-page-".PageMeta::$page->getId()."'>".PageMeta::$page->getName()."</h1>\n";
|
||||
//echo "<h1 id='phb-page-".PageMeta::$page->getId()."'>".PageMeta::$page->getName()."</h1>\n";
|
||||
echo $parser->text(PageMeta::$page->getMarkdownContent());
|
||||
|
Loading…
Reference in New Issue
Block a user