mercurial/templater.py
branchstable
changeset 24948 db7463aa080f
parent 24903 09124cce913f
child 24949 890845af1ac2
equal deleted inserted replaced
24933:5bc506ee87d2 24948:db7463aa080f
   616             elif i is not None:
   616             elif i is not None:
   617                 for j in _flatten(i):
   617                 for j in _flatten(i):
   618                     yield j
   618                     yield j
   619 
   619 
   620 def parsestring(s, quoted=True):
   620 def parsestring(s, quoted=True):
   621     '''parse a string using simple c-like syntax.
   621     '''unwrap quotes if quoted is True'''
   622     string must be in quotes if quoted is True.'''
       
   623     if quoted:
   622     if quoted:
   624         if len(s) < 2 or s[0] != s[-1]:
   623         if len(s) < 2 or s[0] != s[-1]:
   625             raise SyntaxError(_('unmatched quotes'))
   624             raise SyntaxError(_('unmatched quotes'))
   626         return s[1:-1].decode('string_escape')
   625         return s[1:-1]
   627 
   626 
   628     return s.decode('string_escape')
   627     return s
   629 
   628 
   630 class engine(object):
   629 class engine(object):
   631     '''template expansion engine.
   630     '''template expansion engine.
   632 
   631 
   633     template expansion works like this. a map file contains key=value
   632     template expansion works like this. a map file contains key=value