comparison mercurial/templatefuncs.py @ 51390:92c7765931e0

doc: document that labels must have a dot in them to have an effect I noticed that the `hg topics` template has a bare `topic` label with no dot, and that makes it useless, as such a label will never receive any effect by the colour extension. This dot has been required for a long time, at least since 2011, but we never formally documented it!
author Jordi Guti?rrez Hermoso <jordigh@octave.org>
date Wed, 14 Feb 2024 15:21:44 -0500
parents 164b6c4878b8
children f4733654f144
comparison
equal deleted inserted replaced
51389:0e063a9b764a 51390:92c7765931e0
437 return joinset.join(context, mapping, joiner) 437 return joinset.join(context, mapping, joiner)
438 438
439 439
440 @templatefunc(b'label(label, expr)', requires={b'ui'}) 440 @templatefunc(b'label(label, expr)', requires={b'ui'})
441 def label(context, mapping, args): 441 def label(context, mapping, args):
442 """Apply a label to generated content. Content with 442 """Apply a label to generated content. Content with a label
443 a label applied can result in additional post-processing, such as 443 applied can result in additional post-processing, such as
444 automatic colorization.""" 444 automatic colorization. In order to receive effects, labels must
445 have a dot, such as `log.secret` or `branch.active`."""
445 if len(args) != 2: 446 if len(args) != 2:
446 # i18n: "label" is a keyword 447 # i18n: "label" is a keyword
447 raise error.ParseError(_(b"label expects two arguments")) 448 raise error.ParseError(_(b"label expects two arguments"))
448 449
449 ui = context.resource(mapping, b'ui') 450 ui = context.resource(mapping, b'ui')