Hi!

As a person who has been recently dealing with lots of Objective C
code, I found it a bit uncomfortable that Trac with Pygments didn't
color such code in pretty colors. So I made this quick patch.

The cause of this particular problem was that Pygments expected the
mimetype in the form text/x-objective-c and the mimetype defined by
Trac was text/x-objc.

However, there is a design issue here. Trac defines a hardcoded list
of supported mimetypes associated with filenames. It also defines
explicit lists for types supported by GNU Enscript and Silvercity
lexers. The list of mimetypes for the particular version of Pygments
is obtained by calling a library method. Now, as far as I know, there
is no official standard for the names of several widely-used source
content types. This means that with every new version of Pygments or
any of these libraries, the lists in the Trac source must be cheked to
be consistent.

Proposed solutions:
1) leave Pygments to be the only supported syntax highlighter.
2) as Pygments is the preferred highlighter anyway, rearrange the
mimeview code so that if the Pygments library is available, it can try
to guess the mimetype based on the file extension / content with its
own methods. Only if this fails, can the other renderers take a shot,
based on the current explicit lists.

What are the current popular thoughts on the issue? I could try to
elaborate on this, if necessary.

Aleksei

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" 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-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Attachment: ObjCHightlighting.diff
Description: Binary data

Reply via email to