git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCHv2] gitweb: gravatar support
Date: Sat, 20 Jun 2009 21:24:31 +0200	[thread overview]
Message-ID: <200906202124.33278.jnareb@gmail.com> (raw)
In-Reply-To: <7v63esklxh.fsf@alter.siamese.dyndns.org>

On Fri, 19 June 2009, Junio C Hamano wrote:
> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:

> I see these repeated patterns in your patch.
> 
> > @@ -4145,7 +4179,7 @@ sub git_shortlog_body {
> >  		my $author = chop_and_escape_str($co{'author_name'}, 10);
> >  		# git_summary() used print "<td><i>$co{'age_string'}</i></td>\n" .
> >  		print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
> > -		      "<td><i>" . $author . "</i></td>\n" .
> > +		      "<td>" . git_get_gravatar($co{'author_email'}, 16, 1) . "<i>" . $author . "</i></td>\n" .
> >...
> > -		      "<td><i>" . $author . "</i></td>\n" .
> > +		      "<td>" . git_get_gravatar($co{'author_email'}, 16, 1) . "<i>" . $author . "</i></td>\n" .
> >...
> > -		      "<td><i>" . $author . "</i></td>\n" .
> > +		      "<td>" . git_get_gravatar($co{'author_email'}, 16, 1) . "<i>" . $author . "</i></td>\n" .
> >...
> > -	print "<tr><td>author</td><td>" . esc_html($co{'author'}) . "</td></tr>\n".
> > +	print "<tr><td>author</td><td>" . esc_html($co{'author'}) . "</td>".
> > +	      "<td rowspan=\"2\">" .git_get_gravatar($co{'author_email'}) . "</td></tr>\n" .
> >...
> > -	print "<tr><td>committer</td><td>" . esc_html($co{'committer'}) . "</td></tr>\n";
> > +	print "<tr><td>committer</td><td>" . esc_html($co{'committer'}) . "</td>".
> > +	      "<td rowspan=\"2\">" .git_get_gravatar($co{'committer_email'}) . "</td></tr>\n";
> >...
> 
> Doesn't it strike you as needing a bit more refactoring?  The first three
> are identical, and you can refactor them to
> 
> -		      "<td><i>" . $author . "</i></td>\n" .
> +		      "<td>" . oneline_person($author) . "</td>\n" .
> 
> where oneline_person is
> 
> 	sub oneline_person {
>         	my ($me) = @_;
>                 return ($me->{'smallicon'} .
> 			"<i>" . $me->{'name_escaped'} . "</i>");
>         }
[...]

Well, gitweb certainly needs some love^W refactoring.  That is only one
of areas.  But should we postpone introducing new features till gitweb
gets cleaned up?  Although in this case I guess we can do cleanup during
introduction of new feature (which makes stronger case for factorizing
common elements, as they just get larger, those common elements, now with
this feature).

> That way, people who do not like italics, or people who want to have the
> icon at the end instead of at the beginning, can touch only one place
> (i.e. "sub oneline_person").

About using presentational HTML: I think one reason behind keeping it
is to have gitweb work also in text browsers like lynx, w3m or lynx, 
which can not understand CSS.

[...]
> In the medium term, we may want to go one step further and do
> 
>     package person;
> 
> and make sets of methods like "oneline_person".

That would be first in gitweb.

BTW. Should we split gitweb into packages? Should we split gitweb into
separate files (one package per file)?
-- 
Jakub Narebski
Poland

  parent reply	other threads:[~2009-06-20 19:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-19 18:21 [PATCHv2] gitweb: gravatar support Giuseppe Bilotta
2009-06-19 18:26 ` Johannes Schindelin
2009-06-19 18:36   ` Johannes Schindelin
2009-06-19 20:28 ` Junio C Hamano
2009-06-19 22:43   ` Giuseppe Bilotta
2009-06-20 19:24   ` Jakub Narebski [this message]
2009-06-20 10:57 ` Jakub Narebski
2009-06-20 14:16 ` Aaron Crane
2009-06-20 16:58   ` Jakub Narebski

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=200906202124.33278.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=giuseppe.bilotta@gmail.com \
    /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 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).