Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(0)  |  Derive(0)  |  Import(1)
Decodes html entities and xml entities.

        def decode_htmlentities(string):
    """
    Decodes html entities and xml entities.
    """
    entity_re = re.compile("&(#?)(\d{1,5}|\w{1,8});")

    def substitute_entity(match):
        ent = match.group(2)
        if match.group(1) == "#":
            return unichr(int(ent))

        else:
            cp = n2cp.get(ent)

            if cp:
                return unichr(cp)

            else:
                return match.group()

    return entity_re.subn(substitute_entity, string)[0]
        


src/f/t/ftw.pdfgenerator-1.3.0/ftw/pdfgenerator/html2latex/subconverters/htmlentities.py   ftw.pdfgenerator(Download)
from ftw.pdfgenerator import interfaces
from ftw.pdfgenerator.html2latex import subconverter
from ftw.pdfgenerator.utils import decode_htmlentities