From: John 'Warthog9' Hawley Date: Sat, 30 Jan 2010 22:30:43 +0000 (+0100) Subject: gitweb: add a "string" variant of print_sort_th X-Git-Url: https://git.ladys.computer/Gitweb/commitdiff_plain/982bf4d41033e1daf45b9bda8be6dd36de44d4a3a4b1f34a3b6ebdbfc2978de8 gitweb: add a "string" variant of print_sort_th Add a function (named format_sort_th) that returns the string that print_sort_th would print. Signed-off-by: John 'Warthog9' Hawley Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- diff --git a/gitweb.perl b/gitweb.perl index fee6d6e..6cac707 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -4348,17 +4348,24 @@ sub fill_project_list_info { # print 'sort by' 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 "$header\n"; + $sort_th .= "$header\n"; } else { - print "" . - $cgi->a({-href => href(-replay=>1, order=>$name), - -class => "header"}, $header) . - "\n"; + $sort_th .= "" . + $cgi->a({-href => href(-replay=>1, order=>$name), + -class => "header"}, $header) . + "\n"; } + + return $sort_th; } sub git_project_list_body {