I've noticed that the PHP mimeviewer output in Trac (as of 0.10rc1)  
isn't quite right.

An indented multiple-line comment block, such as:

     /**
      * Here's a comment
      */

... is being marked up like this:

<tr><th id="L###"><a href="#L###">###</a></th>
<td><span class="code-keyword">&nbsp;&nbsp; &nbsp;</span><span  
class="code-comment">/**</span></td>
</tr><tr><th id="L###"><a href="#L###">###</a></th>
<td><span class="code-keyword">&nbsp;&nbsp; &nbsp; * Here's a  
comment</span></td>
</tr><tr><th id="L###"><a href="#L###">###</a></th>
<td><span class="code-keyword">&nbsp;&nbsp; &nbsp; */</span></td>
</tr>

In other words, only the first line is being matched as a comment.

I believe the problem stems from PHP's highlighter not explicitly  
highlighting each line, but instead wraps a multi-line comment with  
one <span> that colorizes the entire comment.

When Trac's mimeviewer splits up the highlighted string for creating  
the line-numbered table, the highlighting is then lost for all but  
the first line of multi-line indented comments.

Rather than pass this issue off to the Trac team, I've written a  
little PHP script that takes PHP's highlight_string() output and  
explicitly tags each line. As a result, this script is a drop-in  
replacement for PHP mimeview in older trac versions.

The script is here:
http://pearified.com/index.php?package=Tools_PHP_MimeView

It can be installed with PEAR like this:

$ pear channel-discover pearified.com
$ pear install pearified/Tools_PHP_MimeView

This should drop a script in /usr/bin/php_mimeviewer or /usr/local/ 
bin/php_mimeviewer, depending on your setup.

Then just edit trac.ini:

[mimeviewer]
php_path = /usr/local/bin/php_mimeview

... and your colorized PHP scripts will look a lot better. :)

Perhaps this is worth a ticket in Trac -- the question is whether or  
not the mimeview-handling scripts should be changed to deal with what  
php_mimeview does, or if the ticket should request that php_mimeview  
be distributed with Trac to take this PHP-based problem to a PHP- 
based solution?

-Clay

--
Killersoft.com




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/trac-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to