Exemplo n.º 1
0
def makeContentNode(s):
    s = strcons(s)
    s = removeHTMLEscapes(s)
    s = '<span>' + s + '</span>'

    try:
        content = etree.fromstring('<content>' + s + '</content>')
    except etree.ParseError as e:
        sys.stderr.write('Bad content:\n' + s + '\n\n')
        raise e

    for a in content.findall('.//a'):
        a.attrib.setdefault('target', '_blank')
    return content
Exemplo n.º 2
0
def makeContentNode(s):
    s=strcons(s)
    s=removeHTMLEscapes(s)
    s='<span>'+s+'</span>'

    try:
        content = etree.fromstring('<content>'+s+'</content>')
    except etree.ParseError as e:
        sys.stderr.write('Bad content:\n'+s+'\n\n')
        raise e

    for a in content.findall('.//a'):
        a.attrib.setdefault('target','_blank')
    return content