Mercurial > hg
diff mercurial/help/templates.txt @ 28957:d813132ea361
templater: load and expand aliases by template engine (API) (issue4842)
Now template aliases are fully supported in log and formatter templates.
As I said before, aliases are not expanded in map files. This avoids possible
corruption of our stock styles and web templates. This behavior is undocumented
since no map file nor [templates] section are documented at all. Later on,
we might want to add [aliases] section to map files if it appears to be useful.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 27 Mar 2016 20:59:36 +0900 |
parents | 6db47740e681 |
children | df838803c1d4 |
line wrap: on
line diff
--- a/mercurial/help/templates.txt Sun Apr 03 13:23:40 2016 +0900 +++ b/mercurial/help/templates.txt Sun Mar 27 20:59:36 2016 +0900 @@ -51,6 +51,26 @@ To prevent it from being interpreted, you can use an escape character ``\{`` or a raw string prefix, ``r'...'``. +New keywords and functions can be defined in the ``templatealias`` section of +a Mercurial configuration file:: + + <alias> = <definition> + +Arguments of the form `a1`, `a2`, etc. are substituted from the alias into +the definition. + +For example, + +:: + + [templatealias] + r = rev + rn = "{r}:{node|short}" + leftpad(s, w) = pad(s, w, ' ', True) + +defines two symbol aliases, ``r`` and ``rn``, and a function alias +``leftpad()``. + Some sample command line templates: - Format lists, e.g. files::