Mercurial > hg
comparison mercurial/util.py @ 5975:75d9fe70c654
templater: move email function to util
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 31 Jan 2008 14:44:19 -0600 |
parents | 48d01b1e315f |
children | 3c9dbb743d20 |
comparison
equal
deleted
inserted
replaced
5974:bed929082b58 | 5975:75d9fe70c654 |
---|---|
1634 f = user.find('.') | 1634 f = user.find('.') |
1635 if f >= 0: | 1635 if f >= 0: |
1636 user = user[:f] | 1636 user = user[:f] |
1637 return user | 1637 return user |
1638 | 1638 |
1639 def email(author): | |
1640 '''get email of author.''' | |
1641 r = author.find('>') | |
1642 if r == -1: r = None | |
1643 return author[author.find('<')+1:r] | |
1644 | |
1639 def ellipsis(text, maxlength=400): | 1645 def ellipsis(text, maxlength=400): |
1640 """Trim string to at most maxlength (default: 400) characters.""" | 1646 """Trim string to at most maxlength (default: 400) characters.""" |
1641 if len(text) <= maxlength: | 1647 if len(text) <= maxlength: |
1642 return text | 1648 return text |
1643 else: | 1649 else: |