# HG changeset patch # User Christian Ebert # Date 1185467075 -7200 # Node ID f35a0c38216833708483c764642107ef068780f9 # Parent ff719fcc10a357cb850b285696b08824d254f860 Stricter regex; regroup kwtemplater init code diff -r ff719fcc10a3 -r f35a0c382168 hgkw/keyword.py --- a/hgkw/keyword.py Tue Jul 24 15:13:16 2007 +0200 +++ b/hgkw/keyword.py Thu Jul 26 18:24:35 2007 +0200 @@ -127,9 +127,6 @@ templates[k] = templater.parsestring(templates[k], quoted=False) self.templates = templates or self.deftemplates - escaped = [re.escape(k) for k in self.templates.keys()] - rawkeyword = r'\$(%s)[^$\n\r]*?\$' - self.re_kw = re.compile(rawkeyword % '|'.join(escaped)) if self.t: templater.common_filters['utcdate'] = utcdate try: @@ -139,6 +136,9 @@ # depending on hg rev changeset_templater has extra "brinfo" arg self.t = cmdutil.changeset_templater(self.ui, self.repo, False, None, '', False) + escaped = [re.escape(k) for k in self.templates.keys()] + rawkeyword = r'\$(%s)(: [^$\n\r]*? )??\$' + self.re_kw = re.compile(rawkeyword % '|'.join(escaped)) def _ctxnode(self, node): '''Obtains missing node from file context.'''