mercurial/templatefilters.py
changeset 16235 eb39bbda167b
parent 15155 f4a8d754cd0a
child 16251 db68ee3289b6
equal deleted inserted replaced
16234:a6941d7033fa 16235:eb39bbda167b
   240     if "x" in flags:
   240     if "x" in flags:
   241         return "-rwxr-xr-x"
   241         return "-rwxr-xr-x"
   242     return "-rw-r--r--"
   242     return "-rw-r--r--"
   243 
   243 
   244 def person(author):
   244 def person(author):
   245     """:person: Any text. Returns the text before an email address."""
   245     """:person: Any text. Returns the name before an email address,
       
   246     interpreting it as per RFC 5322.
       
   247     """
   246     if not '@' in author:
   248     if not '@' in author:
   247         return author
   249         return author
   248     f = author.find('<')
   250     f = author.find('<')
   249     if f != -1:
   251     if f != -1:
   250         return author[:f].rstrip()
   252         return author[:f].strip(' "').replace('\\"', '"')
   251     f = author.find('@')
   253     f = author.find('@')
   252     return author[:f].replace('.', ' ')
   254     return author[:f].replace('.', ' ')
   253 
   255 
   254 def rfc3339date(text):
   256 def rfc3339date(text):
   255     """:rfc3339date: Date. Returns a date using the Internet date format
   257     """:rfc3339date: Date. Returns a date using the Internet date format