cvs: phd(PHD_0_4) / mktoc.php /include PhDReader.class.php
| From: | Hannes Magnusson | Date: | Sun, 19 Oct 2008 14:02:50 +0000 |
| Subject: | cvs: phd(PHD_0_4) / mktoc.php /include PhDReader.class.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-2257@lists.php.net to get a copy of this message | ||
bjori Sun Oct 19 14:02:50 2008 UTC
Modified files: (Branch: PHD_0_4)
/phd mktoc.php
/phd/include PhDReader.class.php
Log:
MFH: Don't chunk tags that normally would be chunked but have no id.
http://cvs.php.net/viewvc.cgi/phd/mktoc.php?r1=1.10.2.1&r2=1.10.2.1.2.1&diff_format=u
Index: phd/mktoc.php
diff -u phd/mktoc.php:1.10.2.1 phd/mktoc.php:1.10.2.1.2.1
--- phd/mktoc.php:1.10.2.1 Sat Aug 23 13:51:11 2008
+++ phd/mktoc.php Sun Oct 19 14:02:49 2008
@@ -1,5 +1,5 @@
<?php
-/* $Id: mktoc.php,v 1.10.2.1 2008/08/23 13:51:11 bjori Exp $ */
+/* $Id: mktoc.php,v 1.10.2.1.2.1 2008/10/19 14:02:49 bjori Exp $ */
$r = new PhDReader($OPTIONS);
$VARS = $CLASSES = $REFS = $FILENAMES = array();
$CURRENT_FILENAME = $LAST_CHUNK = "";
@@ -38,7 +38,7 @@
$IDs[$lastid]["ldesc"] = trim($r->readContent($name));
}
}
-
+
continue;
}
switch($r->isChunk) {
@@ -62,7 +62,7 @@
$IDs[$id] = array(
"filename" => $CURRENT_FILENAME,
- "parent" => $r->isChunk ? $PARENTS[$r->depth-1] : $CURRENT_FILENAME,
+ "parent" => $r->isChunk ? (isset($PARENTS[$r->depth-1]) ?
$PARENTS[$r->depth-1] : $PARENTS[$r->depth-2]) : $CURRENT_FILENAME,
"sdesc" => null,
"ldesc" => null,
"children" => array(),
http://cvs.php.net/viewvc.cgi/phd/include/PhDReader.class.php?r1=1.16&r2=1.16.4.1&diff_format=u
Index: phd/include/PhDReader.class.php
diff -u phd/include/PhDReader.class.php:1.16 phd/include/PhDReader.class.php:1.16.4.1
--- phd/include/PhDReader.class.php:1.16 Sat May 24 14:49:14 2008
+++ phd/include/PhDReader.class.php Sun Oct 19 14:02:49 2008
@@ -1,5 +1,5 @@
<?php
-/* $Id: PhDReader.class.php,v 1.16 2008/05/24 14:49:14 gwynne Exp $ */
+/* $Id: PhDReader.class.php,v 1.16.4.1 2008/10/19 14:02:49 bjori Exp $ */
//6271
class PhDReader extends XMLReader {
@@ -129,7 +129,7 @@
$this->PREVIOUS_SIBLING = $this->STACK[$depth];
}
$this->STACK[$depth] = $name;
- $isChunk = $this->isChunk($name);
+ $isChunk = $this->isChunk($name, $this->getID());
if ($isChunk) {
$this->isChunk = PhDReader::OPEN_CHUNK;
$this->chunkDepths[] = $this->lastChunkDepth = $depth;
@@ -150,7 +150,7 @@
}
return false;
} /* }}} */
-
+
/* Get the attribute value by name, if exists. */
public function readAttribute($attr) { /* {{{ */
$retval = XMLReader::moveToAttribute($attr) ? $this->value : "";
@@ -199,9 +199,11 @@
return XMLReader::read() && !($this->nodeType === XMLReader::END_ELEMENT
&& $this->name == $nodeName);
} /* }}} */
-
- public function isChunk($tag) { /* {{{ */
- if (isset($this->CHUNK_ME[$tag])) {
+
+ public function isChunk($tag, $id) { /* {{{ */
+ if (!$id) {
+ return false;
+ } else if (isset($this->CHUNK_ME[$tag])) {
$isChunk = $this->CHUNK_ME[$tag];
if (is_array($isChunk)) {
$isChunk = $this->notXPath($isChunk);
@@ -225,7 +227,7 @@
"sect1", "preface", "chapter", "appendix",
"article", "part", "reference", "refentry",
"index", "bibliography", "glossary",
"colopone", "book", "set", "setindex",
"legalnotice",
);
-
+
$nodeDepth = $this->depth;
$i = 1;
do {