Mercurial > hg-stable
changeset 31879:868ec199cad0
templater: rewrite doc of _hybrid class as docstring
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 24 Apr 2016 19:15:34 +0900 |
parents | 4d0465dd13d2 |
children | a0f2d83f8083 |
files | mercurial/templatekw.py |
diffstat | 1 files changed, 10 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templatekw.py Sun Apr 09 11:57:09 2017 +0900 +++ b/mercurial/templatekw.py Sun Apr 24 19:15:34 2016 +0900 @@ -19,14 +19,17 @@ util, ) -# This helper class allows us to handle both: -# "{files}" (legacy command-line-specific list hack) and -# "{files % '{file}\n'}" (hgweb-style with inlining and function support) -# and to access raw values: -# "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}" -# "{get(extras, key)}" +class _hybrid(object): + """Wrapper for list or dict to support legacy template -class _hybrid(object): + This class allows us to handle both: + - "{files}" (legacy command-line-specific list hack) and + - "{files % '{file}\n'}" (hgweb-style with inlining and function support) + and to access raw values: + - "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}" + - "{get(extras, key)}" + """ + def __init__(self, gen, values, makemap, joinfmt): self.gen = gen self.values = values