[PATCH 3 of 3 V2] templatefilters: improve person() for john.doe at example.com
Adrian Buehlmann
adrian at cadifra.com
Mon Apr 18 04:39:20 CDT 2011
# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1303070736 -7200
# Node ID b4a25807e6ad0b2019cf0d178f3186440653df22
# Parent 8636ca39fee0850095d4597d8f418048444acff3
templatefilters: improve person() for john.doe at example.com
diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
--- a/mercurial/templatefilters.py
+++ b/mercurial/templatefilters.py
@@ -245,14 +245,15 @@
>>> person('John Doe <john at example.com>')
'John Doe'
>>> person('john.doe at example.com')
- 'john'
+ 'john doe'
"""
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
More information about the Mercurial-devel
mailing list