Mercurial > hg
changeset 37986:7a9e9fbaa559
hgweb: use template context to render {lines} of {diff}
This is a preferred way to process nested templates.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 03 Apr 2018 23:43:41 +0900 |
parents | 6a4de2dc78dd |
children | 8cc23a46df37 |
files | mercurial/hgweb/webutil.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py Tue Apr 03 23:42:15 2018 +0900 +++ b/mercurial/hgweb/webutil.py Tue Apr 03 23:43:41 2018 +0900 @@ -519,7 +519,7 @@ return templateutil.mappedgenerator(_listfilediffsgen, args=(files, node, max)) -def _prettyprintdifflines(context, tmpl, lines, blockno, lineidprefix): +def _prettyprintdifflines(context, lines, blockno, lineidprefix): for lineno, l in enumerate(lines, 1): difflineno = "%d.%d" % (blockno, lineno) if l.startswith('+'): @@ -530,7 +530,7 @@ ltype = "difflineat" else: ltype = "diffline" - yield tmpl.generate(ltype, { + yield context.process(ltype, { 'line': l, 'lineno': lineno, 'lineid': lineidprefix + "l%s" % difflineno, @@ -563,7 +563,7 @@ lines.extend(hunklines) if lines: l = templateutil.mappedgenerator(_prettyprintdifflines, - args=(web.tmpl, lines, blockno, + args=(lines, blockno, lineidprefix)) yield web.tmpl.generate('diffblock', { 'parity': next(parity),