git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitweb: pull ref markes pull out of subject <a> tag

From
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date
Aug 23, 2009, 08:28 UTC
Message-ID
<1251016089-10548-1-git-send-email-giuseppe.bilotta@gmail.com>

Since 4afbaefffa9095fe1391b4b61289a7dc954e9f7b ref markers that accompain the subject in views such as shortlog and history point to something different from the subject itself. Therefore, they should not be included in the same <a> tag.

Benefits of the change are:
* better compliance to the XHTML standards, that forbid links within
  links even though the restriction cannot be imposed via DTD; this also
  benefits visualization in some older browsers;
* when hovering the subject, only the subject itself is underlined; when
  hovering the ref markers, only the text in the hovered ref marker is
  underlined; previously, hovering any written part of the subject
  column led to complete underlying of everything at the same time,
  with unpleasing effects.
---
 gitweb/gitweb.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

The next step would be to find a way to layout decently the case when some shortlog entries have a _humongous_ amount of ref markers. See for example http://git.oblomov.eu/acecad/shortlog

I honestly doubt these cases happen in normal git repositories, but it might still be worth taking them into consideration. Possibilities include hard-limiting the title column maximum width (in browsers for which the corresponding attributes and rules work), manual insertion of hard line breaks <br/> every n-th ref marker, or something more dynamic such as hiding most of the ref markers when they are more than, say, 5, and showing them on hover.

Suggestions? Comments?
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ce6e8f6..bb9648b 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1524,10 +1524,10 @@ sub format_subject_html {
 		$long =~ s/[[:cntrl:]]/?/g;
 		return $cgi->a({-href => $href, -class => "list subject",
 		                -title => to_utf8($long)},
-		       esc_html($short) . $extra);
+		       esc_html($short)) . $extra;
 	} else {
 		return $cgi->a({-href => $href, -class => "list subject"},
-		       esc_html($long)  . $extra);
+		       esc_html($long)) . $extra;
 	}
 }
 
-- 
1.6.3.rc1.192.gdbfcb
Next: Jakub Narebski
Message 1 of 4 in “gitweb: pull ref markes pull out of subject <a> tag”
  1. gitweb: pull ref markes pull out of subject <a> tagGiuseppe Bilotta, Aug 23, 2009
  2. Jakub NarebskiAug 23, 2009
  3. Giuseppe BilottaAug 23, 2009
  4. Junio C HamanoAug 23, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.