Enabling `*.go` files in the syntax highlighter.
[gitweb-sgk] / gitweb.cgi
index d83d5e1..93d9600 100755 (executable)
@@ -118,10 +118,8 @@ our $favicon = "static/git-favicon.png";
 our $javascript = "static/gitweb.js";
 
 # URI and label (title) of GIT logo link
 our $javascript = "static/gitweb.js";
 
 # URI and label (title) of GIT logo link
-#our $logo_url = "http://www.kernel.org/pub/software/scm/git/docs/";
-#our $logo_label = "git documentation";
-our $logo_url = "http://git-scm.com/";
-our $logo_label = "git homepage";
+our $logo_url = "http://subgeniuskitty.com/";
+our $logo_label = "SGK Homepage";
 
 # source of projects list
 our $projects_list = "";
 
 # source of projects list
 our $projects_list = "";
@@ -277,7 +275,7 @@ our %highlight_basename = (
 our %highlight_ext = (
        # main extensions, defining name of syntax;
        # see files in /usr/share/highlight/langDefs/ directory
 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 css js tex bib xml awk bat ini spec tcl sql go)),
        # alternate extensions, see /etc/highlight/filetypes.conf
        (map { $_ => 'c'   } qw(c h)),
        (map { $_ => 'sh'  } qw(sh bash zsh ksh)),
        # alternate extensions, see /etc/highlight/filetypes.conf
        (map { $_ => 'c'   } qw(c h)),
        (map { $_ => 'sh'  } qw(sh bash zsh ksh)),
@@ -6413,9 +6411,9 @@ sub git_search_files {
                                $ltext = esc_html($ltext, -nbsp=>1);
                        }
                        print "<div class=\"pre\">" .
                                $ltext = esc_html($ltext, -nbsp=>1);
                        }
                        print "<div class=\"pre\">" .
-                               $cgi->a({-href => $file_href.'#l'.$lno,
-                                       -class => "linenr"}, sprintf('%4i', $lno)) .
-                               ' ' .  $ltext . "</div>\n";
+                               "<a href=\"" . $file_href.'#l'.$lno . "\" " .
+                               "class=\"linenr\" unselectable-linenr=\"" . sprintf('%4i', $lno) . " \">" .
+                               "</a>" .  $ltext . "</div>\n";
                }
        }
        if ($lastfile) {
                }
        }
        if ($lastfile) {
@@ -6619,18 +6617,18 @@ sub git_summary {
        my $basedir = '';
 
        print "<table class=\"projects_list\">\n" .
        my $basedir = '';
 
        print "<table class=\"projects_list\">\n" .
-             "<tr id=\"metadata_desc\"><td>description</td><td>" . esc_html($descr) . "</td></tr>\n";
+             "<tr id=\"metadata_desc\"><td>Description</td><td>" . esc_html($descr) . "</td></tr>\n";
         if ($owner and not $omit_owner) {
         if ($owner and not $omit_owner) {
-               print  "<tr id=\"metadata_owner\"><td>owner</td><td>" . esc_html($owner) . "</td></tr>\n";
+               print  "<tr id=\"metadata_owner\"><td>Owner</td><td>" . esc_html($owner) . "</td></tr>\n";
         }
        if (defined $cd{'rfc2822'}) {
         }
        if (defined $cd{'rfc2822'}) {
-               print "<tr id=\"metadata_lchange\"><td>last change</td>" .
+               print "<tr id=\"metadata_lchange\"><td>Last Change</td>" .
                      "<td>".format_timestamp_html(\%cd)."</td></tr>\n";
        }
 
        # use per project git URL list in $projectroot/$project/cloneurl
        # or make project git URL from git base URL and project name
                      "<td>".format_timestamp_html(\%cd)."</td></tr>\n";
        }
 
        # use per project git URL list in $projectroot/$project/cloneurl
        # or make project git URL from git base URL and project name
-       my $url_tag = "clone URL";
+       my $url_tag = "Clone URL";
        my @url_list = git_get_project_url_list($project);
        @url_list = map { "$_/$project" } @git_base_url_list unless @url_list;
        foreach my $git_url (@url_list) {
        my @url_list = git_get_project_url_list($project);
        @url_list = map { "$_/$project" } @git_base_url_list unless @url_list;
        foreach my $git_url (@url_list) {
@@ -7204,13 +7202,20 @@ sub git_blob {
                      href(action=>"blob_plain", hash=>$hash,
                           hash_base=>$hash_base, file_name=>$file_name) .
                      qq!" />\n!;
                      href(action=>"blob_plain", hash=>$hash,
                           hash_base=>$hash_base, file_name=>$file_name) .
                      qq!" />\n!;
+       } elsif ($file_name =~ /\.md$/) {
+               my $absolute_file_name = "$projectroot/$project";
+               $absolute_file_name =~ s/\.git$//;
+               $absolute_file_name = $absolute_file_name . $file_name;
+               print "<div class=\"readme\">";
+               insert_markdown_file($absolute_file_name);
+               print "</div>";
        } else {
                my $nr;
                while (my $line = <$fd>) {
                        chomp $line;
                        $nr++;
                        $line = untabify($line);
        } else {
                my $nr;
                while (my $line = <$fd>) {
                        chomp $line;
                        $nr++;
                        $line = untabify($line);
-                       printf qq!<div class="pre"><a id="l%i" href="%s#l%i" class="linenr">%4i</a> %s</div>\n!,
+                       printf qq!<div class="pre"><a id="l%i" href="%s#l%i" class="linenr" unselectable-linenr="%4i "></a>%s</div>\n!,
                               $nr, esc_attr(href(-replay => 1)), $nr, $nr,
                               $highlight ? sanitize($line) : esc_html($line, -nbsp=>1);
                }
                               $nr, esc_attr(href(-replay => 1)), $nr, $nr,
                               $highlight ? sanitize($line) : esc_html($line, -nbsp=>1);
                }
@@ -7733,7 +7738,7 @@ sub git_object {
 
 sub git_blobdiff {
        my $format = shift || 'html';
 
 sub git_blobdiff {
        my $format = shift || 'html';
-       my $diff_style = $input_params{'diff_style'} || 'inline';
+       my $diff_style = $input_params{'diff_style'} || 'sidebyside';
 
        my $fd;
        my @difftree;
 
        my $fd;
        my @difftree;
@@ -7894,7 +7899,7 @@ sub diff_style_nav {
 sub git_commitdiff {
        my %params = @_;
        my $format = $params{-format} || 'html';
 sub git_commitdiff {
        my %params = @_;
        my $format = $params{-format} || 'html';
-       my $diff_style = $input_params{'diff_style'} || 'inline';
+       my $diff_style = $input_params{'diff_style'} || 'sidebyside';
 
        my ($patch_max) = gitweb_get_feature('patches');
        if ($format eq 'patch') {
 
        my ($patch_max) = gitweb_get_feature('patches');
        if ($format eq 'patch') {