[Trac] Creating a mimeviewer for php files
Clay Loveless
clay at killersoft.com
Wed Apr 6 06:25:41 EDT 2005
Hello,
I'm another person who's on the hunt for proper syntax highlighting of PHP
files.
I haven't looked much at what enscript puts out, since I cleverly installed
SilverCity before my first installation of trac (after reading through the
wiki on syntax highlighting) ... So SilverCity has always taken precedence
for me over enscript.
SilverCity's PHP support is ... weak. It botches the tagging of a number of
chunks of code (particularly anything that might come after a heredoc
block). Searching through SilverCity source shows that it lumps PHP in with
HTML syntax highlighting, with a very small sub-set of PHP keywords.
Like I say -- weak.
So, I'm looking for other solutions.
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,
because I can't figure out how to UNINSTALL SilverCity!)
Rather than spend time learning SilverCity details so as to improve that
parser (no time for that!), I would rather just create a custom mimeviewer
that returns the output of "php -s".
The big question is -- how would I go about doing that?
For example, using these models:
http://projects.edgewall.com/trac/attachment/ticket/984/php.py?format=txt
http://projects.edgewall.com/trac/file/trunk/trac/mimeviewers/default.py
... How would I create a php.py mimeviewer that would take a higher
precedent over SilverCity parsing? (Assuming I don't/can't remove
SilverCity.)
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.
I saw Christopher's comment in ticket 984 about how one should just create a
mimeviewer for PHP files ... So, I'm just trying to do that. (Knowing next
to nothing about Python, of course!)
Any help would be appreciated -- this seems to be something that keeps
coming up, and it would really be nice to pull resources together from this
list to try to get it done properly before trac 0.9 is complete and
released.
Regards,
Clay
--
Killersoft.com
More information about the Trac
mailing list