generated from simonw/python-lib-template-repository
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
I need to think more carefully about whitespace handling.
You can’t just trim all the strings, since whitespace is (to a degree) significant in HTML.
At the same time, precise whitespace preservation from t-string literal to final output is clearly not a goal: some of the whitespace in the HTML we process will be incidental, as a side effect of code formatting in Python itself.
I propose adding a render() method to the Node hierarchy; str() will invoke it directly. We should support a “compact” (all whitespace removed except significant whitespace) and a “pretty” (multiline and indented, for debugging if for nothing else) output mode. Probably we need to support an "exact" mode as well, since <pre>
tags, etc. should keep spacing unaltered.
Metadata
Metadata
Assignees
Labels
No labels