From 6affdbe677c4b2b8547bd9aa471464dd31a94a1c Mon Sep 17 00:00:00 2001 From: Kevin Cernekee Date: Wed, 16 Mar 2011 15:34:13 -0700 Subject: 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 /* * test */ vim list mode: ^I/*$ ^I * test$ ^I */$ 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 Acked-by: John 'Warthog9' Hawley Signed-off-by: Junio C Hamano diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 1b9369d..b04ab8c 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -3468,7 +3468,7 @@ sub run_highlighter { close $fd; open $fd, quote_command(git_cmd(), "cat-file", "blob", $hash)." | ". quote_command($highlight_bin). - " --fragment --syntax $syntax |" + " --replace-tabs=8 --fragment --syntax $syntax |" or die_error(500, "Couldn't open file or run syntax highlighter"); return $fd; } -- cgit v0.10.2-6-g49f6