Update to Zend Highlighter

From: Date: Thu, 02 Apr 2009 03:47:17 +0000
Subject: Update to Zend Highlighter
Groups: php.internals 
Request: Send a blank email to internals+get-43583@lists.php.net to get a copy of this message
Hello everyone, I'd like to propose a very small update, which would have no backwards-compatibility problems, and would bring PHP closer to standards compliance. The update I'd like to propose is to the Zend Highlighter for PHP, specifically related to the highlight_file and highlight_string functions, as well as the php -s command. My proposal is a very simple one, which would add a third parameter, which would be optional, which would select between "inline" styling, and external styling. The proposed syntax for highlight_file would be: mixed highlight_file (string $filename [, bool $return= false [, bool $inline= true]]); Currently, syntax highlighting is done inline, by means of the style attribute of the span tag (<span style="color: #FFFFFF">...</span>). My proposition would be for a "class" attribute to be set instead of the style attribute, based on the value of $inline (<span class="phpcomment">...</span>). The issue this modification is intended to fix is that many developers who intend to provide syntax highlighting in their project end up rolling their own code for such. By providing external styling code rather than inline styling, it makes it possible to modify the style of all highlighted code, without modifying the code itself. It also provides the capability to extend the viewing experience with Javascript, such as code folding functionality. I've taken the liberty to produce a very quick and dirty patch, which is by no means complete, but provides a cursory example of what I intend. I'd like to clarify that this is the first time I've modified PHP's code, and I know very little C. The only modifications I've done for PHP in the past have been in the PHP-GTK branch, attempting to fix the documentation generator to work with the non-standard extension structure. If I've submitted my proposal poorly, I apologize. Please offer any comments you have. Thank you, Justin Martin aka FrozenFire

« previous php.internals (#43583) next »