Mercurial > hg
changeset 29717:a12d13eac513 stable
help: add example of '[templates]' usage
V2:
- move from shortest() with minlength 8 to minlength 4
- mention [templates] in config.txt
- better describe the difference between [templatealias] and [templates]
V3:
- choose a better example template
author | Mathias De Maré <mathias.demare@gmail.com> |
---|---|
date | Mon, 08 Aug 2016 16:47:42 +0200 |
parents | b8f9cdca8807 |
children | 5004ef47f437 |
files | mercurial/help/config.txt mercurial/help/templates.txt |
diffstat | 2 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/help/config.txt Fri Aug 05 16:25:15 2016 -0400 +++ b/mercurial/help/config.txt Mon Aug 08 16:47:42 2016 +0200 @@ -1615,6 +1615,12 @@ Alias definitions for templates. See :hg:`help templates` for details. +``templates`` +------------- + +Use the ``[templates]`` section to define template strings. +See :hg:`help templates` for details. + ``trusted`` -----------
--- a/mercurial/help/templates.txt Fri Aug 05 16:25:15 2016 -0400 +++ b/mercurial/help/templates.txt Mon Aug 08 16:47:42 2016 +0200 @@ -71,6 +71,20 @@ defines two symbol aliases, ``r`` and ``rn``, and a function alias ``leftpad()``. +It's also possible to specify complete template strings, using the +``templates`` section. The syntax used is the general template string syntax. + +For example, + +:: + + [templates] + nodedate = "{node|short}: {date(date, "%Y-%m-%d")}\n" + +defines a template, ``nodedate``, which can be called like:: + + $ hg log -r . -Tnodedate + Some sample command line templates: - Format lists, e.g. files::