diff --git a/constant.php b/constant.php index 421eed3..6a327b0 100644 --- a/constant.php +++ b/constant.php @@ -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"; diff --git a/src/Element/BookCollection.php b/src/Element/BookCollection.php index 50ab88a..74b03f9 100644 --- a/src/Element/BookCollection.php +++ b/src/Element/BookCollection.php @@ -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\""); } diff --git a/src/Element/BookContent/Chapter.php b/src/Element/BookContent/Chapter.php index 0210313..8029230 100644 --- a/src/Element/BookContent/Chapter.php +++ b/src/Element/BookContent/Chapter.php @@ -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\""); } diff --git a/src/Element/BookContent/Page.php b/src/Element/BookContent/Page.php index 9c79f9a..ee08a42 100644 --- a/src/Element/BookContent/Page.php +++ b/src/Element/BookContent/Page.php @@ -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"); } diff --git a/src/Element/Bookshelf.php b/src/Element/Bookshelf.php index cf78aa0..2d86397 100644 --- a/src/Element/Bookshelf.php +++ b/src/Element/Bookshelf.php @@ -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"); } diff --git a/src/Element/LinkCollection.php b/src/Element/LinkCollection.php index 08ff67c..11c3c50 100644 --- a/src/Element/LinkCollection.php +++ b/src/Element/LinkCollection.php @@ -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\""); } diff --git a/template/raw-article.php b/template/raw-article.php index 4a0e86e..47c17cf 100644 --- a/template/raw-article.php +++ b/template/raw-article.php @@ -8,5 +8,5 @@ $parser = new ParsedownExtend(); $parser->setMarkupEscaped(false); $parser->setSafeMode(false); -echo "

".PageMeta::$page->getName()."

\n"; +//echo "

".PageMeta::$page->getName()."

\n"; echo $parser->text(PageMeta::$page->getMarkdownContent());