[Trac] Re: Pygments + Groovy
On Tuesday, June 12, 2012 12:01:34 PM UTC-7, Jason Winnebeck wrote:
I am trying to get my Trac to support syntax highlighting of Groovy code. I am using Trac 0.12 and Pygments 1.5 (just upgraded from 1.4). Groovy highlighting is a new feature to 1.5: http://pygments.org/docs/lexers/#pygments-lexers-for-jvm-languages.
After upgrading Pygments with easy_install, I can see Pygments 1.5 in "about Trac". But when I use wiki with #!groovy and also load .groovy files, there is no highlighting. In the wiki, if I use #!text/x-groovy, it works. I have tried restarting Apache to cause Trac to totally reload...
The languages Trac can use with Pygments, it's not hard-coded is it? Or is the binding for things like "#!java" hard-coded into Trac source code?
I ran across this issue again recently and made a note to myself to add some additional documentation to Trac under TracSyntaxColoring (1), but haven't gotten around to it yet.
One way to accomplish this is to add an entry to [mimeviewer] mime_map (2). Here is an entry I recently added to add a wiki processor for batch files:
[mimeviewer]
mime_map = application/x-dos-batch:batch
After you successfully add an entry, it will be listed by the KnownMimeTypes macro (3).
For a widely-used language like groovy, you could request that an entry be added to the KNOWN_MIME_TYPES, as I did in (4).
(1) http://trac.edgewall.org/wiki/TracSyntaxColoring
(2) http://trac.edgewall.org/wiki/TracIni#mimeviewer-section
(3) https://trac.physiosonics.com/wiki/TracSyntaxColoring#KnownMIMETypes
(4) http://trac.edgewall.org/ticket/9097
--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/trac-users/-/DKEfLTfyQHkJ.
To post to this group, send email to trac-users-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to trac-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.