All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH 3/9] gitweb: Refactor printing shortened title in git_shortlog_body and git_tags_body
Date: Mon, 14 Aug 2006 02:08:27 +0200	[thread overview]
Message-ID: <200608140208.27246.jnareb@gmail.com> (raw)
In-Reply-To: <200608140202.46160.jnareb@gmail.com>

Separate printing of perhaps shortened title (subject) in
git_shortlog_body and git_tags_body into format_subject_html.

While at it, remove presentation element <b>...</b> used to format
title (subject) and move formatting to CSS.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
CSS is used in such a way as to not change output

 gitweb/gitweb.css  |    5 +++++
 gitweb/gitweb.perl |   34 ++++++++++++++++++----------------
 2 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index 47c1ade..f58a418 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -117,9 +117,14 @@ div.list_head {
 
 a.list {
 	text-decoration: none;
+	font-weight: bold;
 	color: #000000;
 }
 
+table.tags a.list {
+	font-weight: normal;
+}
+
 a.list:hover {
 	text-decoration: underline;
 	color: #880000;
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 0c4ec92..c4d6eab 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -372,6 +372,22 @@ sub format_ref_marker {
 	}
 }
 
+# format, perhaps shortened and with markers, title line
+sub format_subject_html {
+	my ($long, $short, $query, $extra) = @_;
+	$extra = '' unless defined($extra);
+
+	if (length($short) < length($long)) {
+		return $cgi->a({-href => "$my_uri?" . esc_param($query),
+		               -class => "list", -title => $long},
+		       esc_html($short) . $extra);
+	} else {
+		return $cgi->a({-href => "$my_uri?" . esc_param($query),
+		               -class => "list"},
+		       esc_html($long)  . $extra);
+	}
+}
+
 ## ----------------------------------------------------------------------
 ## git utility subroutines, invoking git commands
 
@@ -1085,15 +1101,7 @@ sub git_shortlog_body {
 		print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
 		      "<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
 		      "<td>";
-		if (length($co{'title_short'}) < length($co{'title'})) {
-			print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"),
-			               -class => "list", -title => "$co{'title'}"},
-			      "<b>" . esc_html($co{'title_short'}) . "$ref</b>");
-		} else {
-			print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"),
-			               -class => "list"},
-			      "<b>" . esc_html($co{'title'}) . "$ref</b>");
-		}
+		print format_subject_html($co{'title'}, $co{'title_short'}, "p=$project;a=commit;h=$commit", $ref);
 		print "</td>\n" .
 		      "<td class=\"link\">" .
 		      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") . " | " .
@@ -1139,13 +1147,7 @@ sub git_tags_body {
 		      "</td>\n" .
 		      "<td>";
 		if (defined $comment) {
-			if (length($comment_short) < length($comment)) {
-				print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"),
-				               -class => "list", -title => $comment}, $comment_short);
-			} else {
-				print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"),
-				               -class => "list"}, $comment);
-			}
+			print format_subject_html($comment, $comment_short, "p=$project;a=tag;h=$tag{'id'}");
 		}
 		print "</td>\n" .
 		      "<td class=\"selflink\">";
-- 
1.4.1.1

  parent reply	other threads:[~2006-08-14 10:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-14  0:02 [PATCH 0/9] gitweb: Great subroutine renaming + task separation into subroutines + improvements Jakub Narebski
2006-08-14  0:05 ` [PATCH 1/9] gitweb: Great subroutines renaming Jakub Narebski
2006-08-14 23:28   ` Junio C Hamano
2006-08-14  0:07 ` [PATCH 2/9] gitweb: Separate ref parsing in git_get_refs_list into parse_ref Jakub Narebski
2006-08-15  0:29   ` Junio C Hamano
2006-08-15 16:18     ` Jakub Narebski
2006-08-14  0:08 ` Jakub Narebski [this message]
2006-08-15  0:29   ` [PATCH 3/9] gitweb: Refactor printing shortened title in git_shortlog_body and git_tags_body Junio C Hamano
2006-08-14  0:09 ` [PATCH 4/9] gitweb: Separate main part of git_history into git_history_body Jakub Narebski
2006-08-14  0:10 ` [PATCH 5/9] gitweb: Separate finding project owner into git_get_project_owner Jakub Narebski
2006-08-14  0:14 ` [PATCH 6/9] gitweb: Change appereance of marker of refs pointing to given object Jakub Narebski
2006-08-14  9:30   ` Jakub Narebski
2006-08-15  0:27   ` Junio C Hamano
2006-08-15 16:34     ` Jakub Narebski
2006-08-14  0:15 ` [PATCH 7/9] gitweb: Skip comments in mime.types like file Jakub Narebski
2006-08-14  0:16 ` [PATCH 8/9] gitweb: True fix: Support for the standard mime.types map in gitweb Jakub Narebski
2006-08-15  0:33   ` Junio C Hamano
2006-08-15 16:43     ` Jakub Narebski
2006-08-14  0:18 ` [PATCH 9/9] gitweb: Separate printing difftree in git_commit into git_difftree_body Jakub Narebski
2006-08-15  0:40   ` Junio C Hamano
2006-08-15 16:45     ` Jakub Narebski
2006-08-14 10:40 ` [PATCH 0/9] gitweb: Great subroutine renaming + task separation into subroutines + improvements Jakub Narebski
2006-08-15  0:42   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200608140208.27246.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.