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.      * Renders a token into text matching the requested format.
  7.      *
  8.      * This rendering method is syntactically and semantically compliant
  9.      * with XHTML 1.1 in that sub-lists are part of the previous list item.
  10.      *
  11.      * @access public
  12.      *
  13.      * @param array $options The "options" portion of the token (second
  14.      *  element).
  15.      *
  16.      * @return string The text rendered from the token options.
  17.      *
  18.      */
  19.  
  20.     function token($options)
  21.     {
  22.         // make nice variables (type, level, count)
  23.         extract($options);
  24.  
  25.         switch ($type)
  26.             {
  27.             case 'bullet_list_start':
  28.                 return "\\begin{itemize}\n";
  29.  
  30.             case 'bullet_list_end':
  31.                 return "\\end{itemize}\n";
  32.  
  33.             case 'number_list_start':
  34.                 $depth 'enumi' str_pad(''$level'i');
  35.                 $enum '\arabic';
  36.                 if (isset($format)) {
  37.                     switch ($format{
  38.                         case 'a':
  39.                             $enum '\alph';
  40.                             break;
  41.                         case 'A':
  42.                             $enum '\Alph';
  43.                             break;
  44.                         case 'i':
  45.                             $enum '\roman';
  46.                             break;
  47.                         case 'I':
  48.                             $enum '\Roman';
  49.                             break;
  50.                     }
  51.                 }
  52.                 return '\renewcommand{\labelenumi}{' $enum '{' $depth .
  53.                              "}}\n\\begin{enumerate}\n";
  54.  
  55.             case 'number_list_end':
  56.                 return "\\end{enumerate}\n";
  57.  
  58.             case 'bullet_item_start':
  59.             case 'number_item_start':
  60.                 return '\item{';
  61.  
  62.             case 'bullet_item_end':
  63.             case 'number_item_end':
  64.                 return "}\n";
  65.  
  66.             default:
  67.                 // ignore item endings and all other types.
  68.                 // item endings are taken care of by the other types
  69.                 // depending on their place in the list.
  70.                 return '';
  71.                 break;
  72.             }
  73.     }
  74. }
  75. ?>

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