Mercurial > hg-stable
diff mercurial/hgweb/hgweb_mod.py @ 36547:7937850a523d
hgweb: make templater mostly compatible with log templates
Prepares for gradually switching templatekw.showsuccsandmarkers() to new API.
This was a PoC showing how to reuse templatekw functions in hgweb. We could
remove rev, node, author, etc. from the commonentry() table, but we'll have
to carefully remove all corresponding symbols from webcommands.*(). Otherwise,
we would face the issue5612.
Still templatekw.keywords aren't exported. Otherwise some tests would fail
because the atom template expects {files} to be empty in filelog, but
templatekw.showfiles() provides the {files} implementation.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 22 Dec 2017 21:59:38 +0900 |
parents | a87093e2805d |
children | 2442927cdd96 |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Sun Feb 25 14:42:18 2018 +0900 +++ b/mercurial/hgweb/hgweb_mod.py Fri Dec 22 21:59:38 2017 +0900 @@ -27,6 +27,7 @@ from .. import ( encoding, error, + formatter, hg, hook, profiling, @@ -197,7 +198,7 @@ return templatefilters.websub(text, self.websubtable) # create the templater - + # TODO: export all keywords: defaults = templatekw.keywords.copy() defaults = { 'url': req.url, 'logourl': logourl, @@ -212,9 +213,11 @@ 'style': style, 'nonce': self.nonce, } + tres = formatter.templateresources(self.repo.ui, self.repo) tmpl = templater.templater.frommapfile(mapfile, filters={'websub': websubfilter}, - defaults=defaults) + defaults=defaults, + resources=tres) return tmpl