cvs: phd / mktoc.php /include PhDReader.class.php

From: Date: Fri, 10 Oct 2008 07:28:59 +0000
Subject: cvs: phd / mktoc.php /include PhDReader.class.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-2226@lists.php.net to get a copy of this message
cweiske Fri Oct 10 07:28:59 2008 UTC Modified files: /phd mktoc.php /phd/include PhDReader.class.php Log: Don't chunk tags that normally would be chunked but have no id. Lays the base for db:chunk=no (at least I think so) http://cvs.php.net/viewvc.cgi/phd/mktoc.php?r1=1.12&r2=1.13&diff_format=u Index: phd/mktoc.php diff -u phd/mktoc.php:1.12 phd/mktoc.php:1.13 --- phd/mktoc.php:1.12 Tue Jun 24 14:54:06 2008 +++ phd/mktoc.php Fri Oct 10 07:28:58 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: mktoc.php,v 1.12 2008/06/24 14:54:06 loudi Exp $ */ +/* $Id: mktoc.php,v 1.13 2008/10/10 07:28:58 cweiske Exp $ */ $r = new PhDReader(); $REFS = $FILENAMES = array(); $CURRENT_FILENAME = $LAST_CHUNK = ""; @@ -34,7 +34,7 @@ $IDs[$lastid]["ldesc"] = trim($r->readContent($name)); } } - + continue; } switch($r->isChunk) { @@ -58,7 +58,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.17&r2=1.18&diff_format=u Index: phd/include/PhDReader.class.php diff -u phd/include/PhDReader.class.php:1.17 phd/include/PhDReader.class.php:1.18 --- phd/include/PhDReader.class.php:1.17 Sat May 24 15:04:50 2008 +++ phd/include/PhDReader.class.php Fri Oct 10 07:28:58 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDReader.class.php,v 1.17 2008/05/24 15:04:50 gwynne Exp $ */ +/* $Id: PhDReader.class.php,v 1.18 2008/10/10 07:28:58 cweiske Exp $ */ //6271 class PhDReader extends XMLReader { @@ -128,7 +128,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; @@ -149,7 +149,7 @@ } return false; } /* }}} */ - + /* Get the attribute value by name, if exists. */ public function readAttribute($attr) { /* {{{ */ $retval = XMLReader::moveToAttribute($attr) ? $this->value : ""; @@ -198,9 +198,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); @@ -224,7 +226,7 @@ "sect1", "preface", "chapter", "appendix", "article", "part", "reference", "refentry", "index", "bibliography", "glossary", "colopone", "book", "set", "setindex", "legalnotice", ); - + $nodeDepth = $this->depth; $i = 1; do {

« previous php.doc.cvs (#2226) next »