[pygtk] quoting text for markup
Neil Muller
drnlmuller+gtk at gmail.com
Fri Mar 20 01:01:52 WST 2009
On Thu, Mar 19, 2009 at 5:28 PM, Darren Hart <darren at dvhart.com> wrote:
> 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:
>>> from gobject import markup_escape_text
>>> markup_escape_text('A & B <C>')
'A & B <C>'
For completeness, this is reversible via pango's parse_markup
>>> from pango import parse_markup
>>> parse_markup(markup_escape_text('A & B <C>'))[1] # Since parse_markup returns a (pango.AttrList, text, accel_char) tuple (see docs)
'A & B <C>'
--
Neil Muller
drnlmuller at gmail.com
I've got a gmail account. Why haven't I become cool?
More information about the pygtk
mailing list