Mercurial > hg
comparison mercurial/ui.py @ 11302:e1dde7363601
color: labeled text should be passed to ui.write() as ui.labeled
Some implementations of ui.label() (HTML versions in particular) must escape
the provided text and then markup the text with their tags. When this marked
up text is then passed to ui.write(), we must label the text as 'ui.labeled'
so the implementation knows not to escape it a second time (exposing the initial
markup).
This required the addition of a 'ui.plain' label for text that is purposefully
not marked up.
I was a little pedantic here, passing even ' ' strings to ui.label() when it
would be included with other labeled text in a ui.write() call. But it seemed
appropriate to lean to the side of caution.
author | Steve Borho <steve@borho.org> |
---|---|
date | Thu, 03 Jun 2010 23:18:18 -0500 |
parents | d6dbd5e4ee72 |
children | ef7636efeb01 ac873ecfc3c2 |
comparison
equal
deleted
inserted
replaced
11301:3d0591a66118 | 11302:e1dde7363601 |
---|---|
544 and GUI tools can override it to allow styling output without | 544 and GUI tools can override it to allow styling output without |
545 writing it. | 545 writing it. |
546 | 546 |
547 ui.write(s, 'label') is equivalent to | 547 ui.write(s, 'label') is equivalent to |
548 ui.write(ui.label(s, 'label')). | 548 ui.write(ui.label(s, 'label')). |
549 | |
550 Callers of ui.label() should pass labeled text back to | |
551 ui.write() with a label of 'ui.labeled' so implementations know | |
552 that the text has already been escaped and marked up. | |
549 ''' | 553 ''' |
550 return msg | 554 return msg |