#10725 closed enhancement (duplicate)
Add groovy language to KNOWN_MIME_TYPES
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | rendering | Version: | 0.12-stable |
Severity: | normal | Keywords: | mimetypes |
Cc: | Branch: | ||
Release Notes: |
Added groovy as supported mime type for Pygments highlighting |
||
API Changes: | |||
Internal Changes: |
Description
I upgraded my Pygments to get syntax highlighting for our Groovy language (dynamic language for Java Virtual Machine), but was surprised that support did not work unless MIME type was "text/x-groovy".
I figured that Trac would have some way to scan the supported Lexers of Pygments. But my only reason for thinking that is because the page http://pygments.org/docs/lexers/ appears to be auto-generated.
Patch against latest branches/0.12-stable:
-
trac/mimeview/api.py
367 367 # extend the above with simple (text/x-<something>: <something>) mappings 368 368 369 369 TEXT_X_TYPES = """ 370 ada asm asp awk idl inf java ksh lua m4 mail psp rfc rst sql tcl tex zsh370 ada asm asp awk groovy idl inf java ksh lua m4 mail psp rfc rst sql tcl tex zsh 371 371 """ 372 372 for x in TEXT_X_TYPES.split(): 373 373 KNOWN_MIME_TYPES.setdefault('text/x-%s' % x, []).append(x)
Attachments (0)
Change History (2)
comment:1 by , 12 years ago
Milestone: | 0.12.4 |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
comment:2 by , 12 years ago
It does look like get_all_lexers has the information you need, I was able to print out some of that information from python on command line, but my python skills are pretty mediocre — I had to Google search how to do import and loop over the generator :(.
Yes, it should be possible to add MIME types for all Pygment supported lexers, see #5533.