KNotificationItem specification - first draft

Aurélien Gâteau aurelien.gateau at canonical.com
Tue Sep 8 09:02:10 PDT 2009


Aaron J. Seigo wrote:

>>>> or:
>>>> State that if an item wishes to use markup, then it must enclose the
>>>> whole text in a <markup> tag.
>>> that would work as well. it's a small amount of overhead for not much
>>> pain. it could also be that we look for the "<pre>" tag instead, and make
>>> markup the default.
>> Doing it this way is not good. It can fail in the (admittedly rare) case
>> where the plain text contains the closing tag.
> 
> how is that different from using <markup>? this just says that rich text is 
> the default, and if you want plain text to use <pre> around your text.

Imagine an application which does not markup, but shows text which is 
not known at compile time. From the app point of view, it uses some a 
"template like this:

<pre>Static text\n%1\nMore static text</pre>

Then in the (admittedly rare) case where %1 is "Foo</pre>", your text is 
cut. Unless of course you do not check for the closing tag, which 
(thinking aloud) you don't really need to... but it feels a bit more 
hackish than having to escape markup.

> or maybe a less hackish way to go about it all would be to add a bool member 
> to the ToolTip structure that says whether or not this is markup or not.

Yes, it's probably simpler.

> in practice, i'm not sure how much this matters one way or the other. we've 
> had rich text tooltips for a while now and there hasn't been any incidents 
> with "but i wanted plain text only! the tooltip unexpectedly looks like crap 
> now!"

Things can go wrong when an app uses dynamic text and the content of the 
dynamic text contents markup which the app did not escape because it 
thought everything was plain-text. By not making markup the default, you 
avoid this.

Aurelien


More information about the xdg mailing list