diff options
author | Richard Hubbell <richard_hubbe11@lavabit.com> | 2012-11-04 09:45:55 -0800 |
---|---|---|
committer | Jeff King <peff@peff.net> | 2012-11-08 12:59:23 -0500 |
commit | 048b3991924a0666a2ab4f381caac8d62962de38 (patch) | |
tree | 32c4642e73eb0e6b0e04c8e04dd4922abaa4a686 /gitweb/gitweb.perl | |
parent | 7e2010537e96d0a1144520222f20ba1dc3d61441 (diff) | |
download | git-048b3991924a0666a2ab4f381caac8d62962de38.tar.gz |
gitweb.perl: fix %highlight_ext mappings
When commit 592ea41 refactored the list of extensions for
syntax highlighting, it failed to take into account perl's
operator precedence within lists. As a result, we end up
creating a dictionary of one-to-one elements when the intent
was to map mutliple related types to one main type (e.g.,
bash, ksh, zsh, and sh should all map to sh since they share
similar syntax, but we ended up just mapping "bash" to
"bash" and so forth).
This patch adds parentheses to make the mapping as the
original change intended. It also reorganizes the list to
keep mapped extensions together.
Signed-off-by: Richard Hubbell <richard_hubbe11@lavabit.com>
Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'gitweb/gitweb.perl')
-rwxr-xr-x | gitweb/gitweb.perl | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 10ed9e51a5..ce8cb4af16 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -270,16 +270,15 @@ our %highlight_basename = ( our %highlight_ext = ( # main extensions, defining name of syntax; # see files in /usr/share/highlight/langDefs/ directory - map { $_ => $_ } - qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl sql make), + (map { $_ => $_ } qw(py rb java css js tex bib xml awk bat ini spec tcl sql)), # alternate extensions, see /etc/highlight/filetypes.conf - 'h' => 'c', - map { $_ => 'sh' } qw(bash zsh ksh), - map { $_ => 'cpp' } qw(cxx c++ cc), - map { $_ => 'php' } qw(php3 php4 php5 phps), - map { $_ => 'pl' } qw(perl pm), # perhaps also 'cgi' - map { $_ => 'make'} qw(mak mk), - map { $_ => 'xml' } qw(xhtml html htm), + (map { $_ => 'c' } qw(c h)), + (map { $_ => 'sh' } qw(sh bash zsh ksh)), + (map { $_ => 'cpp' } qw(cpp cxx c++ cc)), + (map { $_ => 'php' } qw(php php3 php4 php5 phps)), + (map { $_ => 'pl' } qw(pl perl pm)), # perhaps also 'cgi' + (map { $_ => 'make'} qw(make mak mk)), + (map { $_ => 'xml' } qw(xml xhtml html htm)), ); # You define site-wide feature defaults here; override them with |