Changeset 3599 for trunk/manual/lib

Show
Ignore:
Timestamp:
01/23/08 16:37:39 (12 months ago)
Author:
jepso
Message:

fixes #527

Location:
trunk/manual/lib/Text/Wiki/Render
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/manual/lib/Text/Wiki/Render/Latex/Code.php

    r2308 r3599  
    22 
    33class Text_Wiki_Render_Latex_Code extends Text_Wiki_Render { 
    4      
    5      
     4 
     5 
    66    /** 
    7     *  
     7    * 
    88    * Renders a token into text matching the requested format. 
    9     *  
     9    * 
    1010    * @access public 
    11     *  
     11    * 
    1212    * @param array $options The "options" portion of the token (second 
    1313    * element). 
    14     *  
     14    * 
    1515    * @return string The text rendered from the token options. 
    16     *  
     16    * 
    1717    */ 
    18      
     18 
    1919    function token($options) 
    2020    { 
     
    2222        $attr = $options['attr']; 
    2323        $type = strtolower($attr['type']); 
    24          
     24 
    2525        if ($type == 'php') { 
    2626            if (substr($options['text'], 0, 5) != '<?php') { 
     
    3030            } 
    3131        } 
    32              
    33         $text = "\\begin{lstlisting}\n$text\n\\end{lstlisting}\n\n";  
    34          
     32 
     33        $text = "\\begin{lstlisting}[caption={} {}]\n$text\n\\end{lstlisting}\n\n"; 
     34 
    3535        if ($type != '') { 
    3636            $text = "\\lstset{language=$type}\n" . $text; 
  • trunk/manual/lib/Text/Wiki/Render/Xhtml/Code.php

    r2308 r3599  
    3131        'css_php'  => null, // class for PHP <code> 
    3232        'css_html' => null, // class for HTML <code> 
    33         'css_filename' => null // class for optional filename <div> 
     33        'css_filename' => null, // class for optional filename <div> 
     34        'code_begin_callback' => null 
    3435    ); 
    3536 
     
    4849 
    4950    function token($options) 
    50     {    
     51    { 
    5152        $text = $options['text']; 
    5253        $attr = $options['attr']; 
     
    105106        } 
    106107 
     108        $callback = $this->getConf('code_begin_callback'); 
     109        if ($callback) { 
     110            $text = call_user_func($callback) . $text; 
     111        } 
     112 
    107113        return "\n$text\n\n"; 
    108114    }