Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Trac: Users

Pygments + Groovy

 

 

Trac users RSS feed   Index | Next | Previous | View Threaded


gillius at gillius

Jun 12, 2012, 12:01 PM

Post #1 of 3 (218 views)
Permalink
Pygments + Groovy

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?

--
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/-/NGNHjqCBiwUJ.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.


ryano at physiosonics

Jun 13, 2012, 3:49 AM

Post #2 of 3 (206 views)
Permalink
Re: Pygments + Groovy [In reply to]

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 [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.


gillius at gillius

Jun 14, 2012, 8:21 AM

Post #3 of 3 (207 views)
Permalink
Re: Pygments + Groovy [In reply to]

Thanks, I got the impression that since so many lexers are added constantly
to Pygments, and that http://pygments.org/docs/lexers/ appeared to be
auto-generated that there was probably some way for Trac to iterate over
supported Pygments lexers. for example the lexers doc showed the "short
names" and file extensions; I thought maybe Trac enumerated those. Maybe it
is possible to do that and no one has done it yet? If so, I don't think I'm
up to it.

I did decide to make a patch like you did on ticket 9097, because of how
easy it was. I filed the ticket as http://trac.edgewall.org/ticket/10725.
Since I already had my code modified, I just rebuilt and installed Trac
that way instead of modifying the ini file (I follow svn
branches/0.12-stable and periodically python setup.py install on that SVN
working copy).

BTW, thanks for your work on maintaining plantuml, while checking my plugin
SVN checkouts I saw you committed a patch for that horribly annoying comma
bug!!!

Jason

On Wednesday, June 13, 2012 6:49:48 AM UTC-4, RjOllos wrote:
>
> 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/-/Jh9769aAmLsJ.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.

Trac users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.