[PATCHv6 9/8] gitweb: put signoff lines in a table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This allows us to give better alignments to the components.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@xxxxxxxxx>
---

Better, but still far from perfect.

 gitweb/gitweb.css  |    6 +++++-
 gitweb/gitweb.perl |   47 +++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index ad82f86..21c24fa 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -115,10 +115,14 @@ span.age {
 	font-style: italic;
 }
 
-span.signoff {
+.signoff {
 	color: #888888;
 }
 
+table.signoff td:first-child {
+	text-align: right;
+}
+
 div.log_link {
 	padding: 0px 8px;
 	font-size: 70%;
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d385f55..53b8817 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3402,15 +3402,31 @@ sub git_print_log {
 	# print log
 	my $signoff = 0;
 	my $empty = 0;
+	my $signoff_table = 0;
 	foreach my $line (@$log) {
-		if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|(?:trivially[ \-])?acked[ \-]by[ :]|cc[ :])/i) {
-			$signoff = 1;
+		if ($line =~ s/^ *(signed[ \-]off[ \-]by|(?:trivially[ \-])?acked[ \-]by|cc|looks[ \-]right[ \-]to[ \-]me[ \-]by)[ :]//i) {
+			$signoff = $1;
 			$empty = 0;
 			if (! $opts{'-remove_signoff'}) {
-				my ($email) = $line =~ /<(\S+@\S+)>/;
-				print "<span class=\"signoff\">" . esc_html($line) . "</span>";
-				print git_get_avatar($email, 'pad_before' => 1) if $email;
-				print "<br/>\n";
+				if (!$signoff_table) {
+					print "<table class=\"signoff\">\n";
+					$signoff_table = 1;
+				}
+				my $email;
+				if ($line =~ s/\s*<(\S+@\S+)>//) {
+					$email = $1;
+				}
+				print "<tr>";
+				print "<td>$signoff</td>";
+				print "<td>" . esc_html($line) . "</td>";
+				if ($email && $git_avatar) {
+					print "<td>";
+					print git_get_avatar($email);
+					print "</td>";
+				} else {
+					print "<td>" . esc_html("<$email>") . "</td>";
+				}
+				print "</tr>\n";
 				next;
 			} else {
 				# remove signoff lines
@@ -3429,7 +3445,26 @@ sub git_print_log {
 			$empty = 0;
 		}
 
+		# if we're in a signoff block, empty lines
+		# are empty rows, other lines terminate
+		# the block
+		if ($signoff_table) {
+			if ($empty) {
+				print "<tr />\n";
+				next;
+			}
+			print "</table>\n";
+			$signoff_table = 0;
+		}
+
 		print format_log_line_html($line) . "<br/>\n";
+
+	}
+
+	# close the signoff table if it's still open
+	if ($signoff_table) {
+		print "</table>\n";
+		$signoff_table = 0;
 	}
 
 	if ($opts{'-final_empty_line'}) {
-- 
1.6.3.rc1.192.gdbfcb

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]