← Back to team overview

launchpad-dev team mailing list archive

Re: Today's project page review

 

On Thu, 2009-09-03 at 14:47 +0100, Gavin Panella wrote:
> On Wed, 2 Sep 2009 17:15:04 -0300
> Christian Robottom Reis <kiko@xxxxxxxxxxxxx> wrote:
> 
> > On Wed, Sep 02, 2009 at 08:03:29PM +0100, Julian Edwards wrote:
> > > On Wednesday 02 September 2009 17:14:51 Curtis Hovey wrote:
> > > > >         * The font for the files is too big, which leads to them being
> > > > >           super-truncated. I think the middle of the filename could be
> > > > >           truncated when too long (Little_[...]_3.0.tgz).
> > > > 
> > > > I saw Julian working on this. I want to make this happen for all uses of
> > > > this portlet. yes, the font is too big.
> > > 
> > > Actually I cheated, it was a hard-coded string in a mock-up.  We've now 
> > > ditched that mock-up in favour of something else, so I'm not working on it.  
> > 
> > Well, it's pretty easy to build a formatter which truncates this way; I
> > could even help somebody do it if there's an interested hacker that is
> > game.
> 
> Erm, I got tempted, for fun.
> 
> http://pastebin.ubuntu.com/264420/

This is nice. I was thinking of doing this as a tales formatter like
shorten:
    release/file/name/fmt:ellipse/32

I will steal liberally from you example. I was planning to use kiko's
thoughts.

        kiko: middle = len(str)/2
        kiko: return s[:middle - 2] + "[...]" + s[middle+2]
        kiko: or something like that
        kiko: taking care of the corner cases (len(s) < middle * 2, etc)

-- 
__Curtis C. Hovey_________
http://launchpad.net/

Attachment: signature.asc
Description: This is a digitally signed message part


Follow ups

References