Re: [viewvc-users] new syntax higlighting and tab size

"C. Michael Pilato" <[email protected]>
Newsgroups gmane.comp.version-control.cvs.viewcvs.user
Organization CollabNet, Inc.
Message-ID <[email protected]>
Tomasz Sowa wrote:
> Hello
> 
> I have upgraded my ViewVC to viewvc-1.1.1 and I have a small problem
> with syntax higlighting. It's not working for C++ header files (*.h),
> sample:
> http://publicrep.ttmath.org/viewvc.py/ttcalc/trunk/src/messages.h?revision=77&view=markup

The highlighting code is driven largely by mime-types.  What does your
server assign as the mime-type for .h files?  Does the file carry a
mime-type in its Subversion svn:mime-type property?

> And a last question. How can I change the size of tabs from 8 to 4 spaces?

It appears that Pygments supports an option for declaring the tabs-to-spaces
value.  ViewVC is not using that option right now, though.

There's a section of code like this in lib/viewvc.py:

    try:
      lexer = get_lexer_for_mimetype(mime_type,
                                     encoding=encoding,
                                     stripnl=False)
    except ClassNotFound:
      try:
        lexer = get_lexer_for_filename(filename,
                                       encoding=encoding,
                                       stripnl=False)

Try tweaking those get_lexer_for_* calls to include a tabsize=4 parameter.
(I'd do this myself, but I'm not in a test-ready state at the moment.)  If
it works, let me know, and I'll built that into a ViewVC as a
user-configurable option so folks don't have to hack the source to get the
feature.

-- 
C. Michael Pilato <[email protected]>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4255&dsMessageId=2386613

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.