Thursday, May 22, 2008

HTML prettyprint, cont.

Came to realization that I am trying to anticipate browser failures from lack of whitespace, but I would know nothing about it until I start rendering a few dozen pages programmatically. So skip the whitespace tom-foolery. Trim all the whitespace, normalize all to spaces, just use "textwrap" to wrap nicely. The idea, since the general algorithm has the potential to be exponential, is to use heuristics at the tips of the branches and the base of the tree, then clean up. Then use recursive algorithm, but with checks before descending if a computation is deemed to be "likely expensive". Going to add "minimum_total_charlength", because easy to calculate. Why did I forget to clean "tail" along with "text"?

No comments: