Text_Wiki
[ class tree: Text_Wiki ] [ index: Text_Wiki ] [ all elements ]

Source for file Toc.php

Documentation is available at Toc.php

  1. <?php
  2.  
  3. // $Id: Toc.php,v 1.7 2004/09/25 19:05:14 pmjones Exp $
  4.  
  5. class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render {
  6.     
  7.     var $conf = array(
  8.         'css_list' => null,
  9.         'css_item' => null,
  10.         'title' => '<strong>Table of Contents</strong>',
  11.         'div_id' => 'toc'
  12.     );
  13.     
  14.     var $min = 2;
  15.     
  16.     /**
  17.     * 
  18.     * Renders a token into text matching the requested format.
  19.     * 
  20.     * @access public
  21.     * 
  22.     * @param array $options The "options" portion of the token (second
  23.     *  element).
  24.     * 
  25.     * @return string The text rendered from the token options.
  26.     * 
  27.     */
  28.     
  29.     function token($options)
  30.     {
  31.         // type, id, level, count, attr
  32.         extract($options);
  33.         
  34.         switch ($type{
  35.         
  36.         case 'list_start':
  37.         
  38.             $html '<div';
  39.             
  40.             $css $this->getConf('css_list');
  41.             if ($css{
  42.                 $html .= " class=\"$css\"";
  43.             }
  44.             
  45.             $div_id $this->getConf('div_id');
  46.             if ($div_id{
  47.                 $html .= " id=\"$div_id\"";
  48.             }
  49.             
  50.             $html .= '>';
  51.             $html .= $this->getConf('title');
  52.             return $html;
  53.             break;
  54.         
  55.         case 'list_end':
  56.             return "</div>\n";
  57.             break;
  58.             
  59.         case 'item_start':
  60.             $html '<div';
  61.             
  62.             $css $this->getConf('css_item');
  63.             if ($css{
  64.                 $html .= " class=\"$css\"";
  65.             }
  66.             
  67.             $pad ($level $this->min);
  68.             $html .= " style=\"margin-left: {$pad}em;\">";
  69.             
  70.             $html .= "<a href=\"#$id\">";
  71.             return $html;
  72.             break;
  73.         
  74.         case 'item_end':
  75.             return "</a></div>\n";
  76.             break;
  77.         }
  78.     }
  79. }
  80. ?>

Documentation generated on Mon, 11 Mar 2019 13:56:12 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.