gitweb: Refactor syntax highlighting support
commit592ea4173af6b445042d74b989762fd41aecdf4c
authorJakub Narebski <jnareb@gmail.com>
Tue, 27 Apr 2010 19:34:45 +0000 (27 21:34 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 May 2010 16:38:54 +0000 (3 09:38 -0700)
tree5796be71ed85a7de0b18450576aef2dab3f2162e
parentb331fe54762770c647b8f95c8f5b16004c6120da
gitweb: Refactor syntax highlighting support

This refactoring (adding guess_file_syntax and run_highlighter
subroutines) is meant to make it easier in the future to add support
for other syntax highlighing solutions, or make it smarter by not
re-running `git cat-file` second time.

Instead of looping over list of regexps (keys of %highlight_type hash),
make use of the fact that choosing syntax is based either on full
basename (%highlight_basename), or on file extension (%highlight_ext).

Add some basic test of syntax highlighting (with 'highlight' as
prerequisite) to t/t9500-gitweb-standalone-no-errors.sh test.

While at it make git_blob Perl style prettier.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl
t/t9500-gitweb-standalone-no-errors.sh