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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -