Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#10725 closed enhancement (duplicate)

Add groovy language to KNOWN_MIME_TYPES

Reported by: Jason Winnebeck <gillius@…> 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

     
    367367# extend the above with simple (text/x-<something>: <something>) mappings
    368368
    369369TEXT_X_TYPES = """
    370     ada asm asp awk idl inf java ksh lua m4 mail psp rfc rst sql tcl tex zsh
     370    ada asm asp awk groovy idl inf java ksh lua m4 mail psp rfc rst sql tcl tex zsh
    371371"""
    372372for x in TEXT_X_TYPES.split():
    373373    KNOWN_MIME_TYPES.setdefault('text/x-%s' % x, []).append(x)

Attachments (0)

Change History (2)

comment:1 by Christian Boos, 8 years ago

Milestone: 0.12.4
Resolution: duplicate
Status: newclosed

Yes, it should be possible to add MIME types for all Pygment supported lexers, see #5533.

comment:2 by Jason Winnebeck <gillius@…>, 8 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 :(.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.