# HG changeset patch # User Adrian Buehlmann # Date 2011-04-17 19:34:25 # Node ID 7a6a8a069aac058bfacac9e39a5d0241931cc166 # Parent 14d0553bd48b793db9e5d763bb6fe0ba98ad31fc templatefilters: improve person() for john.doe@example.com BEFORE: person('john.doe@example.com') -> 'john' AFTER: person('john.doe@example.com') -> 'john doe' diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -245,9 +245,10 @@ def person(author): if not '@' in author: return author f = author.find('<') - if f == -1: - return util.shortuser(author) - return author[:f].rstrip() + if f != -1: + return author[:f].rstrip() + f = author.find('@') + return author[:f].replace('.', ' ') def rfc3339date(text): """:rfc3339date: Date. Returns a date using the Internet date format