Re: [PEPr] +1 for Text::Text_Highlighter
| From: | Andrey Demenev | Date: | Thu, 20 May 2004 13:22:43 +0000 |
| Subject: | Re: [PEPr] +1 for Text::Text_Highlighter | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-29445@lists.php.net to get a copy of this message | ||
Bertrand Mansion wrote:
I forgot one thing: bandwidth wise, it could be interesting to have the possibility to set the color of an token to null, for example with 'identifier' in JS highlighter, because the technique used to find keywords is done through the use of 'identifier' and the associated regex. This can create a lot of <span class="identifier"> when all you need is the holder to find the keywords later on. So I suggest that if an class attribute is not set, then the span tag is not in the final output: reduces file size.'identifier' block in javascript highlighter represents a general identifier that can be a reserved word (function), builtin type (String) or other identifier(custom function name or variable name). I made it to be highlight in different color than the default ('code' class, represents all symbols that did not match any regexp , for example operators : +,-,etc). But the idea seems reasonable, if we want to have a block that does not have special highlighting unless it also matches a keyword). And there is one thing that should be done: check if the chunk of text only contains whitespace, and do not change color in this case. This would reduce output size.
And one more thing: I noticed the attributes for color are called :innerColor, etc. In the resulting html, they are called "class" and used in the span. Might be better to call them directly 'innerClass'.You are right. The attributes were initially called 'innerColor' and 'delimColor' because they could represent not only classes, but also colors or styles. But now it may be changed to 'innerClass' and 'delimClass'
Bertrand Mansion Mamasam-- Andrey Demenev aka Blindman demenev@on-line.jar.ru