Re: [PEPr] Comment on Text::Text_Highlighter
| From: | Davey | Date: | Thu, 13 May 2004 12:32:22 +0000 |
| Subject: | Re: [PEPr] Comment on Text::Text_Highlighter | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-29201@lists.php.net to get a copy of this message | ||
Andrey Demenev wrote:
Davey wrote:Excellent! One note, all method names should start with a lowercase letter :) $hl->highlight($code) (and change the class accordingly if need be) I will say now, that you should start creating other highlighters BEFORE call for votes - so we can see its feasible. I'd like to see a JavaScript one - I had problems getting this to highlight properly using my limited regex knowledge. But I think it should support ALL that Text_Highlight does, before it gets a public release. - DaveyI actually realised that after sending this, thats actually one of things I was going to change. Greg brought up that these should be objects for easier extension. But, what I would like, is that if you're only highlighting one type of code, you shouldn't need to use the factory method, you just call the syntax's own class directly. - DaveyIt can be used both ways: <?php require_once 'Text/Highlighter.php'; $hl =& Text_Highlighter::factory('PHP'); $code = file_get_contents('somefile.php'); $html = $hl->Highlight($code); echo $html; ?> <?php require_once 'Text/Highlighter/PHP.php'; $hl =& new Text_Highlighter_PHP; $code = file_get_contents('somefile.php'); $html = $hl->Highlight($code); echo $html; ?>