def html2xhtml(html, **options):
    """
    Convert a HTML text to XHTML.
    Currently this is very basic and will be extended as needed.

    http://meiert.com/de/publications/translations/whatwg.org/html-vs-xhtml/
    http://de.selfhtml.org/html/xhtml/unterschiede.htm    
    """
    p = MyHTMLParser()
    p.feed(html)
    p.close()
    while len(p.context) > 0:
        e = p.context.pop()
        p.write_endtag(e.name)
        p.result += '\n'

    if len(p.context) > 0:
        expected = ''.join([te.name % "</%s>" for te in p.context])
        raise Exception("Unexpected end of document. Expected at least %s" %
                        expected)
    return p.result.rstrip()
dataset/ETHPy150Open lsaffre/lino/lino/utils/mytidylib.py/html2xhtml/swapped operands of `%`