Skip to content

Commit 048b399

Browse files
Richard Hubbellpeff
authored andcommitted
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 <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent 7e20105 commit 048b399

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

gitweb/gitweb.perl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -270,16 +270,15 @@ sub evaluate_uri {
270270
our %highlight_ext = (
271271
# main extensions, defining name of syntax;
272272
# see files in /usr/share/highlight/langDefs/ directory
273-
map { $_ => $_ }
274-
qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl sql make),
273+
(map { $_ => $_ } qw(py rb java css js tex bib xml awk bat ini spec tcl sql)),
275274
# alternate extensions, see /etc/highlight/filetypes.conf
276-
'h' => 'c',
277-
map { $_ => 'sh' } qw(bash zsh ksh),
278-
map { $_ => 'cpp' } qw(cxx c++ cc),
279-
map { $_ => 'php' } qw(php3 php4 php5 phps),
280-
map { $_ => 'pl' } qw(perl pm), # perhaps also 'cgi'
281-
map { $_ => 'make'} qw(mak mk),
282-
map { $_ => 'xml' } qw(xhtml html htm),
275+
(map { $_ => 'c' } qw(c h)),
276+
(map { $_ => 'sh' } qw(sh bash zsh ksh)),
277+
(map { $_ => 'cpp' } qw(cpp cxx c++ cc)),
278+
(map { $_ => 'php' } qw(php php3 php4 php5 phps)),
279+
(map { $_ => 'pl' } qw(pl perl pm)), # perhaps also 'cgi'
280+
(map { $_ => 'make'} qw(make mak mk)),
281+
(map { $_ => 'xml' } qw(xml xhtml html htm)),
283282
);
284283

285284
# You define site-wide feature defaults here; override them with

0 commit comments

Comments
 (0)