Syntax Highlighter

From: Date: Sat, 28 Sep 2002 19:01:45 +0000
Subject: Syntax Highlighter
Groups: php.doc.chm 
Request: Send a blank email to php-doc-chm+get-537@lists.php.net to get a copy of this message
ok, this is a complete php source highlighter written in js. it has been tested with numerous examples from the php chm documentation on ie6 and ie5. I have yet to find any bugs except for the ones listed below. most of these bugs can be fixed but at a slight speed decrease. none of the bugs are what I would call serious. This js highlighter actually fixes some inconsistencies and small bugs that exist the existing php highlighter. http://knightsweb.net/_color_code.zip the php source highlighter does not run as fast as hard coded pages do(at least in machines with less powerful cpu's. it may actually increase the speed with fast cpu's and large examples) but never the less is not quite as fast as I would like it to be on my P1 200. it is my suggestion that as long as we find the source highlighter works consistently, it be used instead of the old one. I would also recommend that this highlighter be applied by default to the manual pages and off by default on the note pages. If at all possible, an option to switch on-off the syntax highlighter for ether section would be nice. if the ether section is disabled, a link should be displayed to highlight the code example over top of the example. a good place for it may be in the "copy to clipboard" tab. bugs - (reason for not fixing) - probably the most serious problem is caused by js not acting like it should. (where have I heard of this before?) it causes some dots to have the wrong color eg. ".=" will make the dot blue(default) and "8.9" will cause the dot to be green(keyword). however in the majority of cases the dot displays correctly.(speed) - as you may notice when viewing the source highlighter, some key words that are also links are not the right color. this only happens when an unneeded <span> tag is inserted. but it does not matter as all span tags can be safely removed.(current tags) - does not support heredoc string support fully. in the 4 or 5 simple examples there is not really a big problem. (time, speed) - does not have support for vars and constructs in echo construct. (speed,time) - does not color first $ green on something like ($$lake)... I think the green dollar sign sitting next to the blue one looks stupid any ways. (speed) - does not support <script></script> php calls. if any one feels the need to color the one line of code that exists in the one example that exists in the php documentation, by all means uncomment the code to support it. (speed) - in ie 5, some small code examples are not highlighted. (time, speed) Fixes over the default php source highlighter - displays echo text constantly (sometimes was not coloring properly) - colors "=" green in <?= $sally?> - colors all examples (in ie6). does not leave behind some and color others possible improvement I am thinking about changing the way the highlighter works (a little) right now if you are using cast typing, what ever type may be in the green brackets is also green eg. (string), (array), (bool). I personally find it much easier to read with the inside text blue(or a different color), and it would also decrease the time it takes for this syntax highlighter to process. I would appreciate it if I could have some input on any or all of the above. lets decide if we are going to use it and if so, lets decide how many if any of the above fixes and improvements we want to implement. I am not saying we should absolutely use this highlighter but it gives us more options to work with. btw. I would also highly recommend that we pre tags to remove the unneeded &nbsp;'s and the <br>'s at the end of the line. this would not only decrease the download time but would also decrease the display time and would speed up this php syntax highlighter. Brendan

« previous php.doc.chm (#537) next »