+ my $have_highlight = gitweb_check_feature('highlight');
+ my $syntax;
+ if ($have_highlight && defined($file_name)) {
+ my $basename = basename($file_name, '.in');
+ foreach my $regexp (keys %highlight_type) {
+ if ($basename =~ /$regexp/) {
+ $syntax = $highlight_type{$regexp};
+ last;
+ }
+ }
+
+ if ($syntax) {
+ close $fd;
+ open $fd, quote_command(git_cmd(), "cat-file", "blob", $hash)." | ".
+ "highlight --xhtml --fragment -t 8 --syntax $syntax |"
+ or die_error(500, "Couldn't open file or run syntax highlighter");
+ }
+ }
+