hgext/color.py
changeset 28373 9a9dd71e882c
parent 28348 ccedb17a5657
child 28374 af3bd9d1dbc1
equal deleted inserted replaced
28372:74d03766f962 28373:9a9dd71e882c
   483 def templatelabel(context, mapping, args):
   483 def templatelabel(context, mapping, args):
   484     if len(args) != 2:
   484     if len(args) != 2:
   485         # i18n: "label" is a keyword
   485         # i18n: "label" is a keyword
   486         raise error.ParseError(_("label expects two arguments"))
   486         raise error.ParseError(_("label expects two arguments"))
   487 
   487 
   488     # add known effects to the mapping so symbols like 'red', 'bold',
       
   489     # etc. don't need to be quoted
       
   490     mapping.update(dict([(k, k) for k in _effects]))
       
   491 
       
   492     thing = templater.evalstring(context, mapping, args[1])
   488     thing = templater.evalstring(context, mapping, args[1])
   493 
   489 
   494     # apparently, repo could be a string that is the favicon?
   490     # apparently, repo could be a string that is the favicon?
   495     repo = mapping.get('repo', '')
   491     repo = mapping.get('repo', '')
   496     if isinstance(repo, str):
   492     if isinstance(repo, str):
   497         return thing
   493         return thing
   498 
   494 
   499     label = templater.evalstring(context, mapping, args[0])
   495     # preserve unknown symbol as literal so effects like 'red', 'bold',
       
   496     # etc. don't need to be quoted
       
   497     label = templater.evalstringliteral(context, mapping, args[0])
   500 
   498 
   501     return repo.ui.label(thing, label)
   499     return repo.ui.label(thing, label)
   502 
   500 
   503 def uisetup(ui):
   501 def uisetup(ui):
   504     if ui.plain():
   502     if ui.plain():