]> Lady’s Gitweb - Gitweb/commit
gitweb: highlight: replace tabs with spaces
authorKevin Cernekee <redacted>
Wed, 16 Mar 2011 22:34:13 +0000 (15:34 -0700)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:30 +0000 (00:51 -0400)
commit84c5dbe443953cefaf72c93941b32e279509791359f628f125eaad91d093371b
treef030a4fdd2bd286d8d1642640f151bd2a26d624d38bd0db2ac26cbd706c4e85a
parent380041003dbbb664fea83ed8a63c2f073e4f01dda3e512f26115a01b09db26aa
gitweb: highlight: replace tabs with spaces

Consider the following code fragment:

        /*
         * test
         */

vim ":set list" mode shows that the first character on each line is a
tab:

^I/*$
^I * test$
^I */$

By default, the "highlight" program will retain the tabs in the HTML
output:

$ highlight --fragment --syntax c test.c
        <span class="hl com">/*</span>
<span class="hl com">    * test</span>
<span class="hl com">    */</span>

vim list mode:

^I<span class="hl com">/*</span>$
<span class="hl com">^I * test</span>$
<span class="hl com">^I */</span>$

In gitweb, this winds up looking something like:

   1         /*
   2     * test
   3     */

I tried both Firefox and Opera and saw the same behavior.

The desired output is:

   1         /*
   2          * test
   3          */

This can be accomplished by specifying "--replace-tabs=8" on the
highlight command line.

Signed-off-by: Kevin Cernekee <redacted>
Acked-by: John 'Warthog9' Hawley <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl
This page took 0.020881 seconds and 4 git commands to generate.