'>>> t = Textile()
>>> t.glyphs("apostrophe\'s")
\'apostrophe&#8217;s\'
>>> t.glyphs("back in \'88")
\'back in &#8217;88\'
>>> t.glyphs(\'foo ...\')
\'foo &#8230;\'
>>> t.glyphs(\'--\')
\'&#8212;\'
>>> t.glyphs(\'FooBar[tm]\')
\'FooBar&#8482;\'
>>> t.glyphs("<p><cite>Cat\'s Cradle</cite> by Vonnegut</p>")
\'<p><cite>Cat&#8217;s Cradle</cite> by Vonnegut</p>\''

def glyphs(self, text):

    text = re.sub('"\\Z', '"    ', text)
    result = []
    for line in re.compile('(<.*?>)', re.U).split(text):
        if (not re.search('<.*>', line)):
            rules = []
            if re.search('{.+?}', line):
                rules = (self.macro_defaults + self.glyph_defaults)
            else:
                rules = self.glyph_defaults
            for (s, r) in rules:
                line = s.sub(r, line)
        result.append(line)
    return ''.join(result)
