KNotificationItem specification - first draft

Shaun McCance shaunm at gnome.org
Thu Sep 10 08:53:07 PDT 2009


On Tue, 2009-09-08 at 18:02 +0200, Aurélien Gâteau wrote:
> 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.

If you're doing printf-like stuff with markup strings, you really
should be using a function like g_markup_printf_escaped:

http://library.gnome.org/devel/glib/2.20/glib-Simple-XML-Subset-Parser.html#g-markup-printf-escaped

If you're not, you're asking for trouble.

That said, I don't much care for markup suppressing markup.  It
doesn't work that way in HTML, and it certainly doesn't in XML.

--
Shaun




More information about the xdg mailing list