cvs: pear /Text_Wiki/Text/Wiki/Render/Xhtml Toc.php

From: Date: Sat, 28 May 2005 21:30:33 +0000
Subject: cvs: pear /Text_Wiki/Text/Wiki/Render/Xhtml Toc.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-32195@lists.php.net to get a copy of this message
pmjones Sat May 28 17:30:33 2005 EDT Modified files: /pear/Text_Wiki/Text/Wiki/Render/Xhtml Toc.php Log: added a 'collapse' key to collapse the div horizontally within a table; this is for aesthetics, nothing else. 'collapse' is true by default. http://cvs.php.net/diff.php/pear/Text_Wiki/Text/Wiki/Render/Xhtml/Toc.php?r1=1.7&r2=1.8&ty=u Index: pear/Text_Wiki/Text/Wiki/Render/Xhtml/Toc.php diff -u pear/Text_Wiki/Text/Wiki/Render/Xhtml/Toc.php:1.7 pear/Text_Wiki/Text/Wiki/Render/Xhtml/Toc.php:1.8 --- pear/Text_Wiki/Text/Wiki/Render/Xhtml/Toc.php:1.7 Sat Sep 25 15:05:14 2004 +++ pear/Text_Wiki/Text/Wiki/Render/Xhtml/Toc.php Sat May 28 17:30:33 2005 @@ -1,6 +1,6 @@ <?php -// $Id: Toc.php,v 1.7 2004/09/25 19:05:14 pmjones Exp $ +// $Id: Toc.php,v 1.8 2005/05/28 21:30:33 pmjones Exp $ class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render { @@ -8,7 +8,8 @@ 'css_list' => null, 'css_item' => null, 'title' => '<strong>Table of Contents</strong>', - 'div_id' => 'toc' + 'div_id' => 'toc', + 'collapse' => true ); var $min = 2; @@ -35,9 +36,17 @@ case 'list_start': - $html = '<div'; - $css = $this->getConf('css_list'); + $html = ''; + + // collapse div within a table? + if ($this->getConf('collapse')) { + $html .= '<table border="0" cellspacing="0" cellpadding="0">'; + $html .= "<tr><td>\n"; + } + + // add the div, class, and id + $html .= '<div'; if ($css) { $html .= " class=\"$css\""; } @@ -47,17 +56,22 @@ $html .= " id=\"$div_id\""; } + // add the title, and done $html .= '>'; $html .= $this->getConf('title'); return $html; break; case 'list_end': - return "</div>\n"; + if ($this->getConf('collapse')) { + return "\n</div>\n</td></tr></table>\n\n"; + } else { + return "\n</div>\n\n"; + } break; case 'item_start': - $html = '<div'; + $html = "\n\t<div"; $css = $this->getConf('css_item'); if ($css) { @@ -72,7 +86,7 @@ break; case 'item_end': - return "</a></div>\n"; + return "</a></div>"; break; } }

« previous php.pear.cvs (#32195) next »