hgkw/keyword.py
changeset 253 22e08d0f25dc
parent 252 001902b60bdd
child 254 474eccf2964f
equal deleted inserted replaced
252:001902b60bdd 253:22e08d0f25dc
   166         self.t = expand or None
   166         self.t = expand or None
   167         self.path = path
   167         self.path = path
   168         self.node = node
   168         self.node = node
   169 
   169 
   170         kwmaps = self.ui.configitems('keywordmaps')
   170         kwmaps = self.ui.configitems('keywordmaps')
   171         if kwmaps:
   171         if kwmaps: # override default templates
   172             self.templates = {}
   172             kwmaps = [(k, templater.parsestring(v, quoted=False))
   173             for k, v in kwmaps:
   173                       for (k, v) in kwmaps]
   174                 self.templates[k] = templater.parsestring(v, quoted=False)
   174             self.templates = dict(kwmaps)
   175         escaped = [re.escape(k) for k in self.templates.keys()]
   175         escaped = [re.escape(k) for k in self.templates.keys()]
   176         kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
   176         kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
   177         self.re_kw = re.compile(kwpat)
   177         self.re_kw = re.compile(kwpat)
   178         if self.t:
   178         if self.t:
   179             templater.common_filters['utcdate'] = utcdate
   179             templater.common_filters['utcdate'] = utcdate