[Trac] Creating a mimeviewer for php files

Christian Boos cboos at bct-technology.com
Wed Apr 6 12:27:31 EDT 2005


Clay Loveless wrote:

>Hello,
>
>I'm another person who's on the hunt for proper syntax highlighting of PHP
>files.
>...
>I have read the comments here:
>
>http://projects.edgewall.com/trac/ticket/984
>
>... And haven't had luck getting any of them to work. (In part, I suspect,
>  
>
The trick is to change the __init__.py file in the mimeviewers folder so 
that the php.py mime
 processor can be loaded.

Anyway, that's now part of the trunk [1500].
It works for me on Linux, but I suspect that it won't be the case on Windows
(I don't have php on Windows).

>The php.py file from ticket 984 seems to include code from the enscript.py
>mimeviewer ... That seems like it shouldn't really be necessary, since "php
>-s" puts out marked-up source by itself.
>  
>
The original patch used the 'Deuglifier' class, to replace font element 
with given color
by span elements of the appropriate class. The color codes needed to be 
adapted
for PHP. I'll put basic support for adaptation in place, but as I know 
nothing about PHP's
syntax (<?flamewar echo "except it's ugly" :) ?>), it could need further 
adaptation.

Quick implementation question: is there a better way to set up class 
variables than what I did
in util.py/Deuglifier.format?

-- Christian



More information about the Trac mailing list