comparison mercurial/templatefilters.py @ 36921:32f9b7e3f056

templater: move hybrid class and functions to templateutil module And make _hybrid and _mappable classes public. _showlist() is still marked as private since it's weird and third-party codes shouldn't depend on it.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 08 Mar 2018 23:15:09 +0900
parents 6ff6e1d6b5b8
children f0b6fbea00cf
comparison
equal deleted inserted replaced
36920:6ff6e1d6b5b8 36921:32f9b7e3f056
15 encoding, 15 encoding,
16 error, 16 error,
17 node, 17 node,
18 pycompat, 18 pycompat,
19 registrar, 19 registrar,
20 templatekw,
21 templateutil, 20 templateutil,
22 url, 21 url,
23 util, 22 util,
24 ) 23 )
25 from .utils import dateutil 24 from .utils import dateutil
364 return util.pconvert(path) 363 return util.pconvert(path)
365 364
366 @templatefilter('splitlines') 365 @templatefilter('splitlines')
367 def splitlines(text): 366 def splitlines(text):
368 """Any text. Split text into a list of lines.""" 367 """Any text. Split text into a list of lines."""
369 return templatekw.hybridlist(text.splitlines(), name='line') 368 return templateutil.hybridlist(text.splitlines(), name='line')
370 369
371 @templatefilter('stringescape') 370 @templatefilter('stringescape')
372 def stringescape(text): 371 def stringescape(text):
373 return util.escapestr(text) 372 return util.escapestr(text)
374 373