##// END OF EJS Templates
hgweb: make templater mostly compatible with log templates...
Yuya Nishihara -
r36535:7937850a default
parent child Browse files
Show More
@@ -27,6 +27,7 b' from .request import wsgirequest'
27 27 from .. import (
28 28 encoding,
29 29 error,
30 formatter,
30 31 hg,
31 32 hook,
32 33 profiling,
@@ -197,7 +198,7 b' class requestcontext(object):'
197 198 return templatefilters.websub(text, self.websubtable)
198 199
199 200 # create the templater
200
201 # TODO: export all keywords: defaults = templatekw.keywords.copy()
201 202 defaults = {
202 203 'url': req.url,
203 204 'logourl': logourl,
@@ -212,9 +213,11 b' class requestcontext(object):'
212 213 'style': style,
213 214 'nonce': self.nonce,
214 215 }
216 tres = formatter.templateresources(self.repo.ui, self.repo)
215 217 tmpl = templater.templater.frommapfile(mapfile,
216 218 filters={'websub': websubfilter},
217 defaults=defaults)
219 defaults=defaults,
220 resources=tres)
218 221 return tmpl
219 222
220 223
@@ -352,8 +352,8 b' def linerange(req):'
352 352 def formatlinerange(fromline, toline):
353 353 return '%d:%d' % (fromline + 1, toline)
354 354
355 def succsandmarkers(repo, ctx):
356 for item in templatekw.showsuccsandmarkers(repo, ctx):
355 def succsandmarkers(repo, ctx, **args):
356 for item in templatekw.showsuccsandmarkers(repo, ctx, **args):
357 357 item['successors'] = _siblings(repo[successor]
358 358 for successor in item['successors'])
359 359 yield item
@@ -361,6 +361,11 b' def succsandmarkers(repo, ctx):'
361 361 def commonentry(repo, ctx):
362 362 node = ctx.node()
363 363 return {
364 # TODO: perhaps ctx.changectx() should be assigned if ctx is a
365 # filectx, but I'm not pretty sure if that would always work because
366 # fctx.parents() != fctx.changectx.parents() for example.
367 'ctx': ctx,
368 'revcache': {},
364 369 'rev': ctx.rev(),
365 370 'node': hex(node),
366 371 'author': ctx.user(),
@@ -369,7 +374,7 b' def commonentry(repo, ctx):'
369 374 'extra': ctx.extra(),
370 375 'phase': ctx.phasestr(),
371 376 'obsolete': ctx.obsolete(),
372 'succsandmarkers': lambda **x: succsandmarkers(repo, ctx),
377 'succsandmarkers': succsandmarkers,
373 378 'instabilities': [{"instability": i} for i in ctx.instabilities()],
374 379 'branch': nodebranchnodefault(ctx),
375 380 'inbranch': nodeinbranch(repo, ctx),
General Comments 0
You need to be logged in to leave comments. Login now