git/list[1] front-page[2] threads[3] people[4] search[5] about
 

gitweb

From
Rrh <richard_hubbe11@lavabit.com>
Date
Oct 28, 2012, 23:56 UTC
Message-ID
<20121028165647.b79fe3fcb6784c4ae547439e@lavabit.com>

I'm not using gitweb I was thinking about using it and was looking at the cgi and saw this in this file: https://github.com/git/git/blob/master/gitweb/gitweb.perl

I think I understand the intention but the outcome is wrong.
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),
	# 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),
);
I think the intent is better met with this, (the print is for show)

our %he = (); $he{'h'} = 'c'; $he{$_} = $_ for (qw(py c cpp rb java css php sh pl js tex bib xml awk bat ini spec tcl sql make)); $he{$_} = 'cpp' for (qw(cxx c++ cc)); $he{$_} = 'php' for (qw(php3 php4 php5 phps)); $he{$_} = 'pl' for (qw(cgi perl pm)); $he{$_} = 'make' for (qw(mak mk)); $he{$_} = 'xml' for (qw(xhtml html htm)); $he{$_} = 'sh' for (qw(bash zsh ksh));

print "$he{$_} $_\n" for(sort {$he{$a} cmp $he{$b}} keys %he);

But then again maybe I misunderstood the intent. And maybe everyone's happy with it as-is.

Next: Jeff King
Message 1 of 4 in “gitweb”
  1. rhOct 28, 2012
  2. Jeff KingOct 29, 2012
  3. Jakub NarębskiOct 29, 2012
  4. Jeff KingOct 29, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.