Re: [PATCH] gitweb: Added syntax highlight support for golang
- From
Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
- Date
- Feb 7, 2014, 21:56 UTC
- Message-ID
- <CAK9CXBXXge+ZGN_ocWMH5jkPJcTg74rhtWsDiOuqAeeGXDW_tg@mail.gmail.com>
- In-Reply-To
- <xmqqiosqtwqk.fsf@gitster.dls.corp.google.com>
The highlight project which is being used by gitweb supports this. I checked it before submitting the patch.
Thanks
On Sat, Feb 8, 2014 at 3:24 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 34 quoted lines
> Pavan Kumar Sunkara <pavan.sss1991@gmail.com> writes:
>
>> Golang is quickly becoming one of the major programming languages.
>>
>> This change switches on golang syntax highlight support by default
>> in gitweb rather than asking the users to do it using config files.
>
> Looks trivially harmless ;-)
>
> I haven't touched this part of our system, but the patch makes me
> wonder if there is a way for us to _ask_ the installed 'highlight'
> binary what languages it knows about. This hash is used only in
> guess_file_syntax sub, and it may not be unreasonable to populate it
> lazily there, or at least generate this part by parsing output from
> 'highlight -p' at build-install time.
>
>> Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
>> ---
>> gitweb/gitweb.perl | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
>> index bf7fd67..aa6fcfd 100755
>> --- a/gitweb/gitweb.perl
>> +++ b/gitweb/gitweb.perl
>> @@ -273,7 +273,7 @@ our %highlight_basename = (
>> our %highlight_ext = (
>> # main extensions, defining name of syntax;
>> # see files in /usr/share/highlight/langDefs/ directory
>> - (map { $_ => $_ } qw(py rb java css js tex bib xml awk bat ini spec tcl sql)),
>> + (map { $_ => $_ } qw(py rb java go css js tex bib xml awk bat ini spec tcl sql)),
>> # alternate extensions, see /etc/highlight/filetypes.conf
>> (map { $_ => 'c' } qw(c h)),
>> (map { $_ => 'sh' } qw(sh bash zsh ksh)),-- - Pavan Kumar Sunkara