mercurial/templatefilters.py
changeset 37222 54355c243042
parent 37155 fb7140f1d09d
child 37223 08e042f0a67c
equal deleted inserted replaced
37221:307ee8883975 37222:54355c243042
   352 
   352 
   353 @templatefilter('stringescape')
   353 @templatefilter('stringescape')
   354 def stringescape(text):
   354 def stringescape(text):
   355     return stringutil.escapestr(text)
   355     return stringutil.escapestr(text)
   356 
   356 
   357 @templatefilter('stringify')
   357 @templatefilter('stringify', intype=bytes)
   358 def stringify(thing):
   358 def stringify(thing):
   359     """Any type. Turns the value into text by converting values into
   359     """Any type. Turns the value into text by converting values into
   360     text and concatenating them.
   360     text and concatenating them.
   361     """
   361     """
   362     return templateutil.stringify(thing)
   362     return thing  # coerced by the intype
   363 
   363 
   364 @templatefilter('stripdir')
   364 @templatefilter('stripdir')
   365 def stripdir(text):
   365 def stripdir(text):
   366     """Treat the text as path and strip a directory level, if
   366     """Treat the text as path and strip a directory level, if
   367     possible. For example, "foo" and "foo/bar" becomes "foo".
   367     possible. For example, "foo" and "foo/bar" becomes "foo".