]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: add a "string" variant of print_sort_th
authorJohn 'Warthog9' Hawley <redacted>
Sat, 30 Jan 2010 22:30:43 +0000 (23:30 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:50:39 +0000 (00:50 -0400)
Add a function (named format_sort_th) that returns the string that
print_sort_th would print.

Signed-off-by: John 'Warthog9' Hawley <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index fee6d6e24ceb4b98df5a2a040fbd8023284603ae942d1109bd7570a4289e8bad..6cac707865e78d3bb476ab20711564fb36d8422a5b773b1f99147ad4ab454731 100755 (executable)
@@ -4348,17 +4348,24 @@ sub fill_project_list_info {
 # print 'sort by' <th> element, generating 'sort by $name' replay link
 # if that order is not selected
 sub print_sort_th {
+       print format_sort_th(@_);
+}
+
+sub format_sort_th {
        my ($name, $order, $header) = @_;
+       my $sort_th = "";
        $header ||= ucfirst($name);
 
        if ($order eq $name) {
-               print "<th>$header</th>\n";
+               $sort_th .= "<th>$header</th>\n";
        } else {
-               print "<th>" .
-                     $cgi->a({-href => href(-replay=>1, order=>$name),
-                              -class => "header"}, $header) .
-                     "</th>\n";
+               $sort_th .= "<th>" .
+                           $cgi->a({-href => href(-replay=>1, order=>$name),
+                                    -class => "header"}, $header) .
+                           "</th>\n";
        }
+
+       return $sort_th;
 }
 
 sub git_project_list_body {
This page took 0.209679 seconds and 4 git commands to generate.