Re: [PATCHv5 08/12] gitweb: auxiliary function to group data

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

 



2010/9/26 Jakub Narebski <jnareb@xxxxxxxxx>:
> On Fri, 24 Sep 2010, Giuseppe Bilotta wrote:
>
>> Subject: gitweb: auxiliary function to group data
>>
>
> Errr... what!?  git_group() is not "auxiliary function to group data",
> but a template for output of group of data.

I will rephrase

> It would be probably good to describe how this output looks like
> (using e.g. ASII-art mockup) in a commit message.

Well, that would depend on the CSS that is used ... should I squash
the styling in this patch then?

>> +sub git_group {
>
> Name?

git_collection? git_collect_data? I'm a little short on ideas.
git_section? git_subsection? the function (with different styling) can
probably be used even for the main sections in each view (think
summary view in particular).

>> +     my ($class, $id, @rest) = @_;
>> +
>> +     my $content_func = pop @rest;
>> +
>> +     $class = join(' ', 'group', $class);
>> +
>> +     print $cgi->start_div({
>> +             -class => $class,
>> +             -id => $id,
>> +     });
>> +     git_print_header_div(@rest);
>> +     $content_func->() if defined $content_func;
>
> More defensive programming would be to use
>
>  +     $content_func->() if ref($content_func) eq 'CODE';
>
> Or even:
>
>  +     if (ref($content) eq 'CODE') {
>  +             $content->();
>  +     } elsif (ref($content) eq 'ARRAY') {
>  +             print @$content;
>  +     } elsif (!ref($content) && defined($content)) {
>  +             print $content;
>  +     }
>
> Well, $content could be also open filehandle...

Ah, very interesting and very flexible, I'll steal your idea.

-- 
Giuseppe "Oblomov" Bilotta
--
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]