comparison mercurial/templater.py @ 1964:778281d46bb2

fix template bug that made hgweb break. problem found by Shun-ichi Goto <shunichi.goto@gmail.com>. this fix tested with command template and hgweb templates.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Wed, 15 Mar 2006 11:28:00 -0800
parents 2f500a4b6e99
children 6e1a8ea5d717
comparison
equal deleted inserted replaced
1963:39eb64b23cb5 1964:778281d46bb2
57 {key%format}. 57 {key%format}.
58 58
59 filter uses function to transform value. syntax is 59 filter uses function to transform value. syntax is
60 {key|filter1|filter2|...}.''' 60 {key|filter1|filter2|...}.'''
61 61
62 def __init__(self, mapfile, filters={}, cache={}): 62 def __init__(self, mapfile, filters={}, defaults={}, cache={}):
63 '''set up template engine. 63 '''set up template engine.
64 mapfile is name of file to read map definitions from. 64 mapfile is name of file to read map definitions from.
65 filters is dict of functions. each transforms a value into another. 65 filters is dict of functions. each transforms a value into another.
66 defaults is dict of default map definitions.''' 66 defaults is dict of default map definitions.'''
67 self.mapfile = mapfile or 'template' 67 self.mapfile = mapfile or 'template'
68 self.cache = {} 68 self.cache = cache
69 self.map = {} 69 self.map = {}
70 self.base = (mapfile and os.path.dirname(mapfile)) or '' 70 self.base = (mapfile and os.path.dirname(mapfile)) or ''
71 self.filters = filters 71 self.filters = filters
72 self.defaults = {} 72 self.defaults = defaults
73 self.cache = cache
74 73
75 if not mapfile: 74 if not mapfile:
76 return 75 return
77 i = 0 76 i = 0
78 for l in file(mapfile): 77 for l in file(mapfile):