mercurial/templatefilters.py
changeset 49494 c96ed4029fda
parent 49284 d44e3c45f0e4
child 50608 046b9cce5850
equal deleted inserted replaced
49493:4367c46a89ee 49494:c96ed4029fda
   388     interpreting it as per RFC 5322.
   388     interpreting it as per RFC 5322.
   389     """
   389     """
   390     return stringutil.person(author)
   390     return stringutil.person(author)
   391 
   391 
   392 
   392 
       
   393 @templatefilter(b'reverse')
       
   394 def reverse(list_):
       
   395     """List. Reverses the order of list items."""
       
   396     if isinstance(list_, list):
       
   397         return templateutil.hybridlist(list_[::-1], name=b'item')
       
   398     raise error.ParseError(_(b'not reversible'))
       
   399 
       
   400 
   393 @templatefilter(b'revescape', intype=bytes)
   401 @templatefilter(b'revescape', intype=bytes)
   394 def revescape(text):
   402 def revescape(text):
   395     """Any text. Escapes all "special" characters, except @.
   403     """Any text. Escapes all "special" characters, except @.
   396     Forward slashes are escaped twice to prevent web servers from prematurely
   404     Forward slashes are escaped twice to prevent web servers from prematurely
   397     unescaping them. For example, "@foo bar/baz" becomes "@foo%20bar%252Fbaz".
   405     unescaping them. For example, "@foo bar/baz" becomes "@foo%20bar%252Fbaz".