hgweb template author name person modifier

Mads Kiilerich mads at kiilerich.com
Fri Nov 26 05:34:32 CST 2010


On 11/26/2010 10:24 AM, Jouni Airaksinen wrote:
> I was just fixing up an existing theme (monoblue) and noticed the use of
> author|person in the map file. In our repository this results in strange
> thing and I'm not entirely sure now how it should behave. It seems to
> drop too much (or too little) of the author's name in this way:
>
> "Firstname Lastname (emailaddress)" turns into "Firstname"
>
> and for another user it is:
>
> "Firstname Lastname <emailaddress>" turns into "Firstname Lastname"
>
> Probably just issue now with the usage of brackets? Which one is more
> correct now?

RFC 822 defined almost 30 years ago that email addresses (essentially) 
could be written as these examples shows:

some.thing at example.com
Firstname Lastname <some.thing at example.com>
"Firstname Lastname, something" <some.thing at example.com>
(comments)some.(are)thing at example.com(ignored)

The latter form was usually used as "some.thing at example.com (Firstname 
Lastname)", but "nobody" uses that form any more. Mercurial do not 
support parentheses at all.

_If_ Mercurial handled "Firstname Lastname (emailaddress)" it should 
assume that the person name was in the parantheses and yield 
"emailaddress" as the persons name. So no matter what, the format you 
are using is nonstandard and you can't expect that it is handled the way 
you would like to see it handled.

Mercurials extract-person-name-from-email-address functionality is an 
approximation that works fine in most cases but could be improved. It 
could for example handle '<some.thing at example.com>' and '"Firstname 
Lastname" <some.thing at example.com>' better.

The relevant code can be found in templatefilters.person and util.shortuser.

/Mads


More information about the Mercurial mailing list