Mercurial > hg
comparison mercurial/formatter.py @ 32835:9d76812f9b0b
formatter: document lookuptemplate()
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 06 May 2017 16:24:21 +0900 |
parents | 99df35499cae |
children | 615ec3f14aa9 |
comparison
equal
deleted
inserted
replaced
32834:edde2e974ed0 | 32835:9d76812f9b0b |
---|---|
372 props['revcache'] = {} | 372 props['revcache'] = {} |
373 g = self._t(self._topic, ui=self._ui, cache=self._cache, **props) | 373 g = self._t(self._topic, ui=self._ui, cache=self._cache, **props) |
374 self._out.write(templater.stringify(g)) | 374 self._out.write(templater.stringify(g)) |
375 | 375 |
376 def lookuptemplate(ui, topic, tmpl): | 376 def lookuptemplate(ui, topic, tmpl): |
377 """Find the template matching the given -T/--template spec 'tmpl' | |
378 | |
379 'tmpl' can be any of the following: | |
380 | |
381 - a literal template (e.g. '{rev}') | |
382 - a map-file name or path (e.g. 'changelog') | |
383 - a reference to [templates] in config file | |
384 - a path to raw template file | |
385 | |
386 A map file defines a stand-alone template environment. If a map file | |
387 selected, all templates defined in the file will be loaded, and the | |
388 template matching the given topic will be rendered. No aliases will be | |
389 loaded from user config. | |
390 """ | |
391 | |
377 # looks like a literal template? | 392 # looks like a literal template? |
378 if '{' in tmpl: | 393 if '{' in tmpl: |
379 return tmpl, None | 394 return tmpl, None |
380 | 395 |
381 # perhaps a stock style? | 396 # perhaps a stock style? |