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

Source for file List.php

Documentation is available at List.php

  1. <?php
  2.  
  3.  
  4.     
  5.     /**
  6.     * 
  7.     * Renders a token into text matching the requested format.
  8.     * 
  9.     * This rendering method is syntactically and semantically compliant
  10.     * with XHTML 1.1 in that sub-lists are part of the previous list item.
  11.     * 
  12.     * @access public
  13.     * 
  14.     * @param array $options The "options" portion of the token (second
  15.     *  element).
  16.     * 
  17.     * @return string The text rendered from the token options.
  18.     * 
  19.     */
  20.     
  21.     function token($options)
  22.     {
  23.         // make nice variables (type, level, count)
  24.         extract($options);
  25.         
  26.         // set up indenting so that the results look nice; we do this
  27.         // in two steps to avoid str_pad mathematics.  ;-)
  28.         $pad str_pad(''$level"\t");
  29.         $pad str_replace("\t"'    '$pad);
  30.                 
  31.         switch ($type{
  32.         
  33.         case 'bullet_list_start':
  34.             break;
  35.         
  36.         case 'bullet_list_end':
  37.             if ($level == 0{
  38.                 return "\n\n";
  39.             }
  40.             break;
  41.         
  42.         case 'number_list_start':
  43.             break;
  44.         
  45.         case 'number_list_end':
  46.             if ($level == 0{
  47.                 return "\n\n";
  48.             }
  49.             break;
  50.         
  51.         case 'bullet_item_start':
  52.         case 'number_item_start':
  53.             return "\n$pad";
  54.             break;
  55.         
  56.         case 'bullet_item_end':
  57.         case 'number_item_end':
  58.         default:
  59.             // ignore item endings and all other types.
  60.             // item endings are taken care of by the other types
  61.             // depending on their place in the list.
  62.             return;
  63.             break;
  64.         }
  65.     }
  66. }
  67. ?>

Documentation generated on Tue, 12 Mar 2019 21:49:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.