changeset 38060:aeccb08af311

hgweb: wrap {lines} of filerevision with mappinggenerator No bare generator of mappings should be put in a template mapping.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 04 Apr 2018 00:24:09 +0900
parents 4c3ab15f3532
children d3b4c4769b5c
files mercurial/hgweb/webcommands.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Wed Apr 04 00:21:52 2018 +0900
+++ b/mercurial/hgweb/webcommands.py	Wed Apr 04 00:24:09 2018 +0900
@@ -149,7 +149,7 @@
         mt = mimetypes.guess_type(f)[0] or 'application/octet-stream'
         text = '(binary:%s)' % mt
 
-    def lines():
+    def lines(context):
         for lineno, t in enumerate(text.splitlines(True)):
             yield {"line": t,
                    "lineid": "l%d" % (lineno + 1),
@@ -160,7 +160,7 @@
         'filerevision',
         file=f,
         path=webutil.up(f),
-        text=lines(),
+        text=templateutil.mappinggenerator(lines),
         symrev=webutil.symrevorshortnode(web.req, fctx),
         rename=webutil.renamelink(fctx),
         permissions=fctx.manifest().flags(f),