# Re: [PATCH] gitweb.perl: fix %highlight_ext mappings

3 messages from 2012-11-04 to 2012-11-08. Participants: Jeff King, rh.
Thread: https://gitlist.dev/t/32042

## rh, 2012-11-04 17:45

Subject: [PATCH] gitweb.perl: fix %highlight_ext mappings
Message-ID: <20121104094555.a46992b6d836c1e09524d2cc@lavabit.com>
URL: https://gitlist.dev/e/20121104094555.a46992b6d836c1e09524d2cc%40lavabit.com

```

The previous change created 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, sh all map to sh since they share similar syntax
This makes the mapping as the original change intended.

Signed-off-by: Richard Hubbell <richard_hubbe11@lavabit.com>
---
gitweb.cgi | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/gitweb.cgi.orig b/gitweb.cgi
index 060db27..155b238 100755
--- a/gitweb.cgi.orig
+++ b/gitweb.cgi
@@ -246,19 +246,19 @@ our %highlight_basename = (
 	'Makefile' => 'make',
 );
 # match by extension
+
 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


```

## Jeff King, 2012-11-08 18:01

Subject: Re: [PATCH] gitweb.perl: fix %highlight_ext mappings
Message-ID: <20121108180157.GK15560@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20121108180157.GK15560%40sigill.intra.peff.net
In-Reply-To: <20121104094555.a46992b6d836c1e09524d2cc@lavabit.com>

```
On Sun, Nov 04, 2012 at 09:45:55AM -0800, rh wrote:

> The previous change created 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, sh all map to sh since they share similar syntax
> This makes the mapping as the original change intended.
> 
> Signed-off-by: Richard Hubbell <richard_hubbe11@lavabit.com>

Thanks.

> diff --git a/gitweb.cgi.orig b/gitweb.cgi
> index 060db27..155b238 100755
> --- a/gitweb.cgi.orig
> +++ b/gitweb.cgi

This is not the name of the source file in git.git, so "git am" choked.
I was able to fix it up locally, though. No need to resend.

-Peff

```

## rh, 2012-11-08 18:36

Subject: Re: [PATCH] gitweb.perl: fix %highlight_ext mappings
Message-ID: <20121108103620.eb716adb2d7542c606c8b87a@lavabit.com>
URL: https://gitlist.dev/e/20121108103620.eb716adb2d7542c606c8b87a%40lavabit.com
In-Reply-To: <20121108180157.GK15560@sigill.intra.peff.net>

```
On Thu, 8 Nov 2012 13:01:57 -0500
Jeff King <peff@peff.net> wrote:

> On Sun, Nov 04, 2012 at 09:45:55AM -0800, rh wrote:
> 
> > The previous change created 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, sh all map to sh since they share similar
> > syntax This makes the mapping as the original change intended.
> > 
> > Signed-off-by: Richard Hubbell <richard_hubbe11@lavabit.com>
> 
> Thanks.
> 
> > diff --git a/gitweb.cgi.orig b/gitweb.cgi
> > index 060db27..155b238 100755
> > --- a/gitweb.cgi.orig
> > +++ b/gitweb.cgi
> 
> This is not the name of the source file in git.git, so "git am"
> choked. I was able to fix it up locally, though. No need to resend.

Somehow I knew that it wouldn't be a slam dunk!
Thanks for doing what you do.  FWIW maybe others can follow
this thread to know what not to do.  And save you extra work.

> 
> -Peff

--
"Now, in his heart, Ahab had some glimpse of this, namely; all my means
are sane, my motive and my object mad."


```
