On 8/16/2012 12:11 PM, Emmanuel Blot wrote:
Hi,
I'm not sure how to add file type that Pygments supports natively, but
that Trac does not recognize.
For example, CMake files have been supported by Pygments for a long
time (since 1.2), but Trac does not manage them.
It seems the way to go (from
http://trac.edgewall.org/wiki/TracIni#mimeviewer-section) is to add
CMake type to the mime_map option.
I've added "text/x-cmake:cmake" and now the syntax highlighter works
with "#!cmake" in quoted blocks. However, Trac file browser does not
highlight CMakeLists.txt files. I've added
"text/x-cmake:CMakeLists.txt" to the mime_map option, but it does not
help.
1. Specific question: How to specify to Trac that "CMakeLists.txt"
files should be highlighted
I believe we only look for the suffix, not for the full name with
fnmatch. See get_mimetype() in trac/mimeview/api.py.
2. Generic question: How to tell Trac to defer all highlighting
decisions to Pygments, which already knows about all supported types,
rather than letting Trac performs the mapping on its own - is it even
possible?
No. This is #5533.
So basically the only "solution" you have for now short of implementing
#5533, is to do a `svn pset svn:mime-type text/x-cmake` on your CMake
files in the repository.
Cheers,
-- Christian
--
You received this message because you are subscribed to the Google Groups "Trac
Users" 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-users?hl=en.