cvs: phd /themes/pear pearchunkedhtml.php peartheme.php

From: Date: Tue, 28 Oct 2008 17:13:16 +0000
Subject: cvs: phd /themes/pear pearchunkedhtml.php peartheme.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-2318@lists.php.net to get a copy of this message
cweiske Tue Oct 28 17:13:16 2008 UTC Modified files: /phd/themes/pear pearchunkedhtml.php peartheme.php Log: Make the PEARdoc TOC behave correctly http://cvs.php.net/viewvc.cgi/phd/themes/pear/pearchunkedhtml.php?r1=1.8&r2=1.9&diff_format=u Index: phd/themes/pear/pearchunkedhtml.php diff -u phd/themes/pear/pearchunkedhtml.php:1.8 phd/themes/pear/pearchunkedhtml.php:1.9 --- phd/themes/pear/pearchunkedhtml.php:1.8 Thu Oct 16 21:15:28 2008 +++ phd/themes/pear/pearchunkedhtml.php Tue Oct 28 17:13:15 2008 @@ -5,7 +5,7 @@ * PEAR theme for the normal-html-in-many-files version * * @package PhD -* @version CVS: $Id: pearchunkedhtml.php,v 1.8 2008/10/16 21:15:28 cweiske Exp $ +* @version CVS: $Id: pearchunkedhtml.php,v 1.9 2008/10/28 17:13:15 cweiske Exp $ */ class pearchunkedhtml extends pearweb { @@ -34,7 +34,7 @@ */ public function header($id) { - $title = PhDHelper::getDescription($id, true); + $title = PhDHelper::getDescription($id); $parent = PhDHelper::getParent($id); $this->next = $this->prev = $this->up = array(null, null); $strNext = $strPrev = ''; http://cvs.php.net/viewvc.cgi/phd/themes/pear/peartheme.php?r1=1.9&r2=1.10&diff_format=u Index: phd/themes/pear/peartheme.php diff -u phd/themes/pear/peartheme.php:1.9 phd/themes/pear/peartheme.php:1.10 --- phd/themes/pear/peartheme.php:1.9 Thu Oct 16 19:54:09 2008 +++ phd/themes/pear/peartheme.php Tue Oct 28 17:13:15 2008 @@ -234,6 +234,29 @@ $this->chunked = $chunked; } + /** + * Determines if the second level of a TOC should be displayed + * + * @param string $id xml:id value + * @param string $name Tag name + * @param array $children Array of children items (mktoc) + * + * @return boolean true if the second level should be displayed. + */ + protected function displayTocSecondLevel($id, $name, $children) + { + return $id == 'index'; + + //we currently don't need that + if (count($children) == 0) { + return false; + } + if ($name == 'set' && substr($id, 0, 8) == 'package.' || $id == 'packages') { + return false; + } + return true; + } + public function format_chunk($open, $name, $attrs, $props) { $id = null; if (isset($attrs[PhDReader::XMLNS_XML]["id"])) { @@ -316,18 +339,19 @@ if (count($chunks)) { $content .= '<ul class="chunklist chunklist_'.$name.'">' . "\n"; foreach ($chunks as $chunkid => $junk) { - $href = $this->chunked ? $chunkid .'.'. $this->ext : "#$chunkid"; - $long = $this->format->TEXT(PhDHelper::getDescription($chunkid, true)); - $short = $this->format->TEXT(PhDHelper::getDescription($chunkid, false)); - $content .= ' <li><a href="' .$href. '">' .($long ? $long : $short). '</a>'; + $href = $this->chunked ? $chunkid .'.'. $this->ext : "#$chunkid"; + $long = $this->format->TEXT(PhDHelper::getDescription($chunkid, true)); + $short = $this->format->TEXT(PhDHelper::getDescription($chunkid, false)); + $title = $long ? ' title="' . htmlspecialchars($long) . '"': ''; + $content .= ' <li><a href="' .$href. '"' . $title . '>' . $short . '</a>'; $children = PhDHelper::getChildren($chunkid); - if (count($children)) { + if ($this->displayTocSecondLevel($id, $name, $children)) { $content .= "\n" . ' <ul class="chunklist chunklist_'.$name.' chunklist_children">' . "\n"; foreach (PhDHelper::getChildren($chunkid) as $childid => $junk) { $href = $this->chunked ? $childid .'.'. $this->ext : "#$childid"; $long = $this->format->TEXT(PhDHelper::getDescription($childid, true)); $short = $this->format->TEXT(PhDHelper::getDescription($childid, false)); - $content .= ' <li><a href="' .$href. '">' .($long ? $long : $short). "</a></li>\n"; + $content .= ' <li><a href="' .$href. '">' . $short . "</a></li>\n"; } $content .= " </ul>\n "; }

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