##// END OF EJS Templates
templater: make pad function evaluate both string and rawstring templates...
Yuya Nishihara -
r25509:576d6c74 default
parent child Browse files
Show More
@@ -310,10 +310,7 b' def pad(context, mapping, args):'
310 310
311 311 width = int(args[1][1])
312 312
313 text = stringify(args[0][0](context, mapping, args[0][1]))
314 if args[0][0] == runstring:
315 text = stringify(runtemplate(context, mapping,
316 compiletemplate(text, context)))
313 text = stringify(_evalifliteral(args[0], context, mapping))
317 314
318 315 right = False
319 316 fillchar = ' '
@@ -3042,6 +3042,14 b' Test pad function'
3042 3042 1------------------- {node|short}
3043 3043 0------------------- test
3044 3044
3045 Test template string in pad function
3046
3047 $ hg log -r 0 -T '{pad("\{{rev}}", 10)} {author|user}\n'
3048 {0} test
3049
3050 $ hg log -r 0 -T '{pad(r"\{rev}", 10)} {author|user}\n'
3051 \0 test
3052
3045 3053 Test ifcontains function
3046 3054
3047 3055 $ hg log --template '{rev} {ifcontains(rev, "2 two 0", "is in the string", "is not")}\n'
General Comments 0
You need to be logged in to leave comments. Login now