Mercurial > public > mercurial-scm > hg
comparison mercurial/templatefilters.py @ 35444:dad8a5071b0a
templatefilters: add slashpath() to convert path separator to slash
Prepares for deprecating the ui.slash option, which isn't always respected.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 21 Oct 2017 17:19:02 +0900 |
parents | 4fdc4adbc838 |
children | 6d65cef5b038 |
comparison
equal
deleted
inserted
replaced
35443:a8478b808f17 | 35444:dad8a5071b0a |
---|---|
347 @templatefilter('shortdate') | 347 @templatefilter('shortdate') |
348 def shortdate(text): | 348 def shortdate(text): |
349 """Date. Returns a date like "2006-09-18".""" | 349 """Date. Returns a date like "2006-09-18".""" |
350 return util.shortdate(text) | 350 return util.shortdate(text) |
351 | 351 |
352 @templatefilter('slashpath') | |
353 def slashpath(path): | |
354 """Any text. Replaces the native path separator with slash.""" | |
355 return util.pconvert(path) | |
356 | |
352 @templatefilter('splitlines') | 357 @templatefilter('splitlines') |
353 def splitlines(text): | 358 def splitlines(text): |
354 """Any text. Split text into a list of lines.""" | 359 """Any text. Split text into a list of lines.""" |
355 return templatekw.hybridlist(text.splitlines(), name='line') | 360 return templatekw.hybridlist(text.splitlines(), name='line') |
356 | 361 |