Skip to content

Commit e076a0e

Browse files
dsymondsspearce
authored andcommitted
gitweb: Provide title attributes for abbreviated author names.
Signed-off-by: David Symonds <dsymonds@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
1 parent dd8175f commit e076a0e

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

gitweb/gitweb.perl

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3437,9 +3437,15 @@ sub git_shortlog_body {
34373437
print "<tr class=\"light\">\n";
34383438
}
34393439
$alternate ^= 1;
3440+
my $author = chop_str($co{'author_name'}, 10);
3441+
if ($author ne $co{'author_name'}) {
3442+
$author = "<span title=\"" . esc_html($co{'author_name'}) . "\">" . esc_html($author) . "</span>";
3443+
} else {
3444+
$author = esc_html($author);
3445+
}
34403446
# git_summary() used print "<td><i>$co{'age_string'}</i></td>\n" .
34413447
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
3442-
"<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
3448+
"<td><i>" . $author . "</i></td>\n" .
34433449
"<td>";
34443450
print format_subject_html($co{'title'}, $co{'title_short'},
34453451
href(action=>"commit", hash=>$commit), $ref);
@@ -3487,9 +3493,15 @@ sub git_history_body {
34873493
print "<tr class=\"light\">\n";
34883494
}
34893495
$alternate ^= 1;
3496+
# shortlog uses chop_str($co{'author_name'}, 10)
3497+
my $author = chop_str($co{'author_name'}, 15, 3);
3498+
if ($author ne $co{'author_name'}) {
3499+
"<span title=\"" . esc_html($co{'author_name'}) . "\">" . esc_html($author) . "</span>";
3500+
} else {
3501+
$author = esc_html($author);
3502+
}
34903503
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
3491-
# shortlog uses chop_str($co{'author_name'}, 10)
3492-
"<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 3)) . "</i></td>\n" .
3504+
"<td><i>" . $author . "</i></td>\n" .
34933505
"<td>";
34943506
# originally git_history used chop_str($co{'title'}, 50)
34953507
print format_subject_html($co{'title'}, $co{'title_short'},
@@ -3643,8 +3655,14 @@ sub git_search_grep_body {
36433655
print "<tr class=\"light\">\n";
36443656
}
36453657
$alternate ^= 1;
3658+
my $author = chop_str($co{'author_name'}, 15, 5);
3659+
if ($author ne $co{'author_name'}) {
3660+
$author = "<span title=\"" . esc_html($co{'author_name'}) . "\">" . esc_html($author) . "</span>";
3661+
} else {
3662+
$author = esc_html($author);
3663+
}
36463664
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
3647-
"<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
3665+
"<td><i>" . $author . "</i></td>\n" .
36483666
"<td>" .
36493667
$cgi->a({-href => href(action=>"commit", hash=>$co{'id'}), -class => "list subject"},
36503668
esc_html(chop_str($co{'title'}, 50)) . "<br/>");
@@ -5157,8 +5175,14 @@ sub git_search {
51575175
print "<tr class=\"light\">\n";
51585176
}
51595177
$alternate ^= 1;
5178+
my $author = chop_str($co{'author_name'}, 15, 5);
5179+
if ($author ne $co{'author_name'}) {
5180+
$author = "<span title=\"" . esc_html($co{'author_name'}) . "\">" . esc_html($author) . "</span>";
5181+
} else {
5182+
$author = esc_html($author);
5183+
}
51605184
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
5161-
"<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
5185+
"<td><i>" . $author . "</i></td>\n" .
51625186
"<td>" .
51635187
$cgi->a({-href => href(action=>"commit", hash=>$co{'id'}),
51645188
-class => "list subject"},

0 commit comments

Comments
 (0)