";
+ if ($this->parent != null) $str .= "";
return $str;
}
diff --git a/src/Element/BookContent/Page.php b/src/Element/BookContent/Page.php
index 9e6f8dc..9c79f9a 100644
--- a/src/Element/BookContent/Page.php
+++ b/src/Element/BookContent/Page.php
@@ -1,22 +1,19 @@
id = $id;
$this->name = $name;
$this->parent = $parent;
- $this->segues = $childs;
}
/**
@@ -40,9 +37,6 @@ class Page {
throw new Exception("Book xml data missing attributes");
for ($child = $xmlData->firstChild;$child != null ; $child = $child->nextSibling) {
switch ($child->nodeName) {
- case "Segment":
- array_push($node->segues, Segment::parse($child, $node));
- break;
case "#text":
break;
default:
@@ -60,37 +54,31 @@ class Page {
return $this->name;
}
- /**
- * @return Segment[]
- */
- public function getSegments (): array {
- return $this->segues;
- }
-
public function getParent (): Chapter {
return $this->parent;
}
public function getSummaryHtml (): string {
- $str =
- "- getId()==$this->id ?
- "" :
- "href='/".PageMeta::$book->getId()."/".$this->id."' "
- ) .
- ">$this->name";
- if (sizeof($this->segues) > 0) {
- $str .= "
";
- foreach ($this->segues as $node) {
- $str .= $node->getSummaryHtml();
- }
- $str .= "
";
- }
- $str .= " ";
- return $str;
+// $str =
+// "- getId()==$this->id ?
+// "" :
+// "href='/".PageMeta::$book->getId()."/".$this->id."' "
+// ) .
+// ">$this->name";
+// if (sizeof($this->segues) > 0) {
+// $str .= "
";
+// foreach ($this->segues as $node) {
+// $str .= $node->getSummaryHtml();
+// }
+// $str .= "
";
+// }
+// $str .= " ";
+// return $str;
+ return "";
}
public function getMarkdownContent (): string {
diff --git a/src/Element/BookContent/Segment.php b/src/Element/BookContent/Segment.php
deleted file mode 100644
index d8e40dd..0000000
--- a/src/Element/BookContent/Segment.php
+++ /dev/null
@@ -1,56 +0,0 @@
-id = $id;
- $this->name = $name;
- $this->parent = $parent;
- }
-
- /**
- * @param DOMNode $xmlData
- * @param Page $parent
- * @return Segment
- * @throws Exception
- */
- public static function parse (DOMNode $xmlData, Page $parent): Segment {
- if ($xmlData->hasAttributes()) {
- $attrName = $xmlData->attributes->getNamedItem("name");
- $attrId = $xmlData->attributes->getNamedItem("id");
- if ($attrName == null)
- if ($attrId == null) throw new Exception("Segment xml data missing attribute \"name\"");
- else throw new Exception("Segment xml data with id \"$attrId->nodeValue\" missing attribute \"name\"");
- else $name = $attrName->nodeValue;
- if ($attrId == null) throw new Exception("Segment xml data named \"$name\" missing attribute \"id\"");
- else $id = $attrId->nodeValue;
- } else
- throw new Exception("Segment xml data missing attributes");
- if ($xmlData->hasChildNodes())
- throw new Exception("Segment xml named \"$name\" have some children which are not supported");
- return new Segment($id, $name, $parent);
- }
-
- public function getId (): string {
- return $this->id;
- }
-
- public function getName (): string {
- return $this->name;
- }
-
- public function getParent (): Page {
- return $this->parent;
- }
-
- public function getSummaryHtml (): string {
- return "- $this->name
";
- }
-
-}
diff --git a/src/Element/Bookshelf.php b/src/Element/Bookshelf.php
index 03a7f4c..cf78aa0 100644
--- a/src/Element/Bookshelf.php
+++ b/src/Element/Bookshelf.php
@@ -70,16 +70,6 @@ class Bookshelf {
return $this->rootBook;
}
- public function getHtml (): string {
- $str = $this->links->getHtml();
- $str .= "";
- $str .= $this->books->getHtml();
- $str .= "
";
- $str .= PageMeta::$book->getSummaryHtml();
- $str .= "";
- return $str;
- }
-
public function getBook (string $id): ?Book {
return $this->books->getBook($id);
}
diff --git a/src/Element/Link.php b/src/Element/Link.php
index 7323456..e40c02e 100644
--- a/src/Element/Link.php
+++ b/src/Element/Link.php
@@ -53,7 +53,7 @@ class Link {
}
public function getHtml (): string {
- return "- $this->name
";
+ return "";
}
}
diff --git a/src/Element/LinkCollection.php b/src/Element/LinkCollection.php
index 66ae1b8..08ff67c 100644
--- a/src/Element/LinkCollection.php
+++ b/src/Element/LinkCollection.php
@@ -72,11 +72,11 @@ class LinkCollection {
public function getHtml (): string {
$str = "";
- if ($this->name != self::ROOT) $str .= "- $this->name
";
+ if ($this->name != self::ROOT) $str .= "";
return $str;
}
diff --git a/template/main.php b/template/main.php
new file mode 100644
index 0000000..087be11
--- /dev/null
+++ b/template/main.php
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/template/nav.php b/template/nav.php
new file mode 100644
index 0000000..61485ab
--- /dev/null
+++ b/template/nav.php
@@ -0,0 +1,40 @@
+
+
+
diff --git a/template/raw-article.php b/template/raw-article.php
new file mode 100644
index 0000000..4a0e86e
--- /dev/null
+++ b/template/raw-article.php
@@ -0,0 +1,12 @@
+setMarkupEscaped(false);
+$parser->setSafeMode(false);
+
+echo "".PageMeta::$page->getName()."
\n";
+echo $parser->text(PageMeta::$page->getMarkdownContent());
diff --git a/template/raw-book-contents.php b/template/raw-book-contents.php
new file mode 100644
index 0000000..817b043
--- /dev/null
+++ b/template/raw-book-contents.php
@@ -0,0 +1,5 @@
+getSummaryHtml();