html - How to make yattag source better formatted? -
i'm using yattag generate html:
doc, tag, text = doc().tagtext() tag("p"): text("my paragraph.") while works enough, when @ html source comes out on 1 line. there kind of switch or other trick makes yattag create more readable source?
use indent function.
from yattag import doc, indent doc, tag, text = doc().tagtext() tag("p"): text("my paragraph.") print(indent(doc.getvalue())) # indent tags not text directly contained between <tag> , </tag> print(indent(doc.getvalue(), indent_text = true)) # indent text directly contained between <tag> , </tag>
Comments
Post a Comment