Mercurial > hg
comparison mercurial/formatter.py @ 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 | 78759f78a44e |
children | b501579147f1 |
comparison
equal
deleted
inserted
replaced
28956:eea98190ed73 | 28957:d813132ea361 |
---|---|
195 return templater.templater.frommapfile(mapfile) | 195 return templater.templater.frommapfile(mapfile) |
196 return maketemplater(ui, topic, tmpl) | 196 return maketemplater(ui, topic, tmpl) |
197 | 197 |
198 def maketemplater(ui, topic, tmpl, filters=None, cache=None): | 198 def maketemplater(ui, topic, tmpl, filters=None, cache=None): |
199 """Create a templater from a string template 'tmpl'""" | 199 """Create a templater from a string template 'tmpl'""" |
200 t = templater.templater(filters=filters, cache=cache) | 200 aliases = ui.configitems('templatealias') |
201 t = templater.templater(filters=filters, cache=cache, aliases=aliases) | |
201 if tmpl: | 202 if tmpl: |
202 t.cache[topic] = tmpl | 203 t.cache[topic] = tmpl |
203 return t | 204 return t |
204 | 205 |
205 def formatter(ui, topic, opts): | 206 def formatter(ui, topic, opts): |