git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [gitweb/patch] commit log bodies should be pre-format tagged
@ 2006-05-28 10:28 Paul Jakma
  0 siblings, 0 replies; only message in thread
From: Paul Jakma @ 2006-05-28 10:28 UTC (permalink / raw)
  To: kay.sievers; +Cc: git list

[-- Attachment #1: Type: TEXT/PLAIN, Size: 697 bytes --]

Hi Kay,

I don't know about you, but when I write commit messages, I don't 
HTML format them. ;)

Attached patch wraps commit log messages in HTML pre tags. Without 
this patch, any commits with any kind of ASCII-formatted structure 
look strange at best (e.g. traditional GNUish ChangeLog style which 
use indentation), and unintelligble at worst (ASCII art or 
diagrammes).

The log, commit and commitdiff pages all still validate, and the RSS 
feed looks /much/ better in Liferea. Probably it could be done in 
some smarter way with divs and CSS though, but hey.

Please apply. :)

regards,
-- 
Paul Jakma	paul@clubi.ie	paul@jakma.org	Key ID: 64A2FF6A
Fortune:
Fiber optics caused gas main leak

[-- Attachment #2: Type: TEXT/PLAIN, Size: 3734 bytes --]

--- gitweb.cgi.orig	2006-05-28 10:30:38.000000000 +0100
+++ gitweb.cgi	2006-05-28 11:12:52.000000000 +0100
@@ -1218,12 +1218,12 @@
 	}
 	print "</table>\n\n" .
 	      "</div>\n";
-	print "<div class=\"page_body\">";
+	print "<div class=\"page_body\"><pre>";
 	my $comment = $tag{'comment'};
 	foreach my $line (@$comment) {
-		print esc_html($line) . "<br/>\n";
+		print esc_html($line) . "\n";
 	}
-	print "</div>\n";
+	print "</pre></div>\n";
 	git_footer_html();
 }
 
@@ -1547,22 +1547,22 @@
 		      "<link>" . esc_html("$my_url?p=$project;a=commit;h=$commit") . "</link>\n" .
 		      "<description>" . esc_html($co{'title'}) . "</description>\n" .
 		      "<content:encoded>" .
-		      "<![CDATA[\n";
+		      "<![CDATA[<pre>\n";
 		my $comment = $co{'comment'};
 		foreach my $line (@$comment) {
 			$line = decode("utf8", $line, Encode::FB_DEFAULT);
-			print "$line<br/>\n";
+			print "$line\n";
 		}
-		print "<br/>\n";
+		print "\n";
 		foreach my $line (@difftree) {
 			if (!($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)$/)) {
 				next;
 			}
 			my $file = validate_input(unquote($7));
 			$file = decode("utf8", $file, Encode::FB_DEFAULT);
-			print "$file<br/>\n";
+			print "$file\n";
 		}
-		print "]]>\n" .
+		print "</pre>]]>\n" .
 		      "</content:encoded>\n" .
 		      "</item>\n";
 	}
@@ -1673,7 +1673,7 @@
 		      "</div>\n" .
 		      "<i>" . esc_html($co{'author_name'}) .  " [$ad{'rfc2822'}]</i><br/>\n" .
 		      "</div>\n" .
-		      "<div class=\"log_body\">\n";
+		      "<div class=\"log_body\"><pre>\n";
 		my $comment = $co{'comment'};
 		my $empty = 0;
 		foreach my $line (@$comment) {
@@ -1688,12 +1688,12 @@
 			} else {
 				$empty = 0;
 			}
-			print format_log_line_html($line) . "<br/>\n";
+			print format_log_line_html($line) . "\n";
 		}
 		if (!$empty) {
-			print "<br/>\n";
+			print "\n";
 		}
-		print "</div>\n";
+		print "</pre></div>\n";
 	}
 	git_footer_html();
 }
@@ -1783,7 +1783,7 @@
 	}
 	print "</table>". 
 	      "</div>\n";
-	print "<div class=\"page_body\">\n";
+	print "<div class=\"page_body\"><pre>\n";
 	my $comment = $co{'comment'};
 	my $empty = 0;
 	my $signed = 0;
@@ -1799,13 +1799,13 @@
 		}
 		if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
 			$signed = 1;
-			print "<span style=\"color: #888888\">" . esc_html($line) . "</span><br/>\n";
+			print "</pre><span style=\"color: #888888\">" . esc_html($line) . "</span><br/><pre>\n";
 		} else {
 			$signed = 0;
-			print format_log_line_html($line) . "<br/>\n";
+			print format_log_line_html($line) . "\n";
 		}
 	}
-	print "</div>\n";
+	print "</pre></div>\n";
 	print "<div class=\"list_head\">\n";
 	if ($#difftree > 10) {
 		print(($#difftree + 1) . " files changed:\n");
@@ -1982,7 +1982,7 @@
 	print "<div>\n" .
 	      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'}) . $ref) . "\n" .
 	      "</div>\n";
-	print "<div class=\"page_body\">\n";
+	print "<div class=\"page_body\"><pre>\n";
 	my $comment = $co{'comment'};
 	my $empty = 0;
 	my $signed = 0;
@@ -2004,9 +2004,9 @@
 		} else {
 			$empty = 0;
 		}
-		print format_log_line_html($line) . "<br/>\n";
+		print format_log_line_html($line) . "\n";
 	}
-	print "<br/>\n";
+	print "</pre><br/>\n";
 	foreach my $line (@difftree) {
 		# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M      ls-files.c'
 		# ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M      rev-tree.c'

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-28 10:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-28 10:28 [gitweb/patch] commit log bodies should be pre-format tagged Paul Jakma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).