Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.7.3

Bug #3063 function to re-initialize renderer buffer ouput
Submitted: 2004-12-30 12:17 UTC Modified: 2005-02-04 02:14 UTC
From: farell Assigned: blindman
Status: Closed Package: Text_Highlighter
PHP Version: 4.3.9 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  


 [2004-12-30 12:17 UTC] farell
Description: ------------ I've tried to output 3 scripts syntax hilighted on the same page, and i got a mixed / collapsed of the 3 sources. It's not marvellous! Try it, and you'll see what i means. I suggest you to add a function that allows to re-initialise renderer output buffer (var $_output). It will be more effenciency than a loop who unset text_hilighter instance and then re-creates it. Even it's work fine (my solution in waiting a better one). I think it will be the last request(bug) i'll send you, this year! Happy New Year Andrey :o) Best regards Laurent Reproduce code: --------------- <?php $sources = array('script1.php', 'script2.php', 'script3.php'); $hl =& Text_Highlighter::factory('PHP',array('numbers'=>HL_NUMBERS_TABLE)); foreach($sources as $src) { $code = file_get_contents('sources/'. $src); $html = $hl->highlight($code); echo "<p>$html<br/></p>"; } ?> Expected result: ---------------- 3 distinct highlight source code like this code will do : <?php $sources = array('script1.php', 'script2.php', 'script3.php'); foreach($sources as $src) { $hl =& Text_Highlighter::factory('PHP',array('numbers'=>HL_NUMBERS_TABLE)); $code = file_get_contents('sources/'. $src); $html = $hl->highlight($code); echo "<p>$html<br/></p>"; unset($hl); } ?>

Comments

 [2004-12-30 12:36 UTC] farell
Finally it's a bug on HTML renderer. There are not the same problem with Console renderer: the var $_output is set to null (see reset method, line 141). Sorry (one more bug for you Andrey!)
 [2005-02-04 02:14 UTC] blindman
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Text_Highlighter