On Thu, Mar 19, 2009 at 12:59 AM, Walter Leibbrandt
<wal...@translate.org.za> wrote:
> Hi
>
> Darren Hart wrote:
>>
>> When adding text with an & character to a cellrenderertext I get some
>> rendering glitches (and the actual text doesn't get rendered at all).
>> Is there a standard mechanism for quoting text destined for the markup
>> property?
>
> Since Pango markup strings are XML strings, you should also quote your
> markup strings as such. That means that an & should become &amp;.

RIght & < and > - but my question was if there is some python call to
do this or if I just have to roll my own.  I recently added this to my
code base:

def quote_markup(str):
    return str.replace("&", "&amp;").replace(">", "&gt;").replace("<", "&lt;")

It just would be nice if gtk offered something like that - or at least
didn't break if you put an & in the text.  My version is pretty
braindead, but if I use it carefully in my app, it works fine.

Thanks,

> --
> Walter Leibbrandt                  Software Developer
> Recent blogs:
> * Firefox-style button with a pop-up menu
> http://www.translate.org.za/blogs/walter/en/content/firefox-style-button-pop-menu

Heh, I recently wrote one of those as well - with some examples from a
google code project.

-- 
Darren Hart
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to