##// END OF EJS Templates
template: provide a termwidth keyword (issue5395)...
Simon Farnsworth -
r30088:d1f5f158 default
parent child Browse files
Show More
@@ -589,5 +589,10 b' def loadkeyword(ui, extname, registrarob'
589 for name, func in registrarobj._table.iteritems():
589 for name, func in registrarobj._table.iteritems():
590 keywords[name] = func
590 keywords[name] = func
591
591
592 @templatekeyword('termwidth')
593 def termwidth(repo, ctx, templ, **args):
594 """Integer. The width of the current terminal."""
595 return repo.ui.termwidth()
596
592 # tell hggettext to extract docstrings from these functions:
597 # tell hggettext to extract docstrings from these functions:
593 i18nfunctions = keywords.values()
598 i18nfunctions = keywords.values()
@@ -3214,6 +3214,11 b' Test recursive evaluation:'
3214 hg: parse error: fill expects an integer width
3214 hg: parse error: fill expects an integer width
3215 [255]
3215 [255]
3216
3216
3217 $ COLUMNS=25 hg log -l1 --template '{fill(desc, termwidth, "{node|short}:", "termwidth.{rev}:")}'
3218 bcc7ff960b8e:desc to be
3219 termwidth.1:wrapped desc
3220 termwidth.1:to be wrapped (no-eol)
3221
3217 $ hg log -l 1 --template '{sub(r"[0-9]", "-", author)}'
3222 $ hg log -l 1 --template '{sub(r"[0-9]", "-", author)}'
3218 {node|short} (no-eol)
3223 {node|short} (no-eol)
3219 $ hg log -l 1 --template '{sub(r"[0-9]", "-", "{node|short}")}'
3224 $ hg log -l 1 --template '{sub(r"[0-9]", "-", "{node|short}")}'
General Comments 0
You need to be logged in to leave comments. Login now