leforestier / yattag

Python library to generate HTML or XML in a readable, concise and pythonic way.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'>' and '<' as text with intendation

hansronald opened this issue · comments

Is there a workaround that indent() interprets '>' and '<' as non closed tags?

This example code yields the error "in tokenize raise XMLTokenError("Unrecognized XML token near %s" % repr(string[:100])) yattag.indentation.XMLTokenError: Unrecognized XML token near '> 1'"

from yattag import Doc
from yattag import indent
doc, tag, text = Doc().tagtext()

with tag('b'):
doc.asis('2 > 1')

print indent(doc.getvalue())