Mercurial > public > mercurial-scm > hg
comparison mercurial/namespaces.py @ 37068:aa97e06a1912
templater: use template context to render old-style list template
Prepares for dropping the 'templ' resource.
This means old-style list templates are processed by the same engine class
as the one for the list node. I think that's fine since templates for the
same list should be tightly coupled, and I believe the extension point for
the engine classes isn't actually used.
Now templatekw._showlist() is a compatibility wrapper for _showcompatlist(),
and will be deprecated soon. The function is still marked as private since
I plan to change the interface to get rid of closures capturing context and
mapping.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 16 Mar 2018 22:47:15 +0900 |
parents | 900e5ee44307 |
children | 4c0683655599 |
comparison
equal
deleted
inserted
replaced
37067:04aafcec00b9 | 37068:aa97e06a1912 |
---|---|
87 self._names[namespace.name] = namespace | 87 self._names[namespace.name] = namespace |
88 | 88 |
89 # we only generate a template keyword if one does not already exist | 89 # we only generate a template keyword if one does not already exist |
90 if namespace.name not in templatekw.keywords: | 90 if namespace.name not in templatekw.keywords: |
91 templatekeyword = registrar.templatekeyword(templatekw.keywords) | 91 templatekeyword = registrar.templatekeyword(templatekw.keywords) |
92 @templatekeyword(namespace.name, requires={'repo', 'ctx', 'templ'}) | 92 @templatekeyword(namespace.name, requires={'repo', 'ctx'}) |
93 def generatekw(context, mapping): | 93 def generatekw(context, mapping): |
94 return templatekw.shownames(context, mapping, namespace.name) | 94 return templatekw.shownames(context, mapping, namespace.name) |
95 | 95 |
96 def singlenode(self, repo, name): | 96 def singlenode(self, repo, name): |
97 """ | 97 """ |