HTML::PrettyPrinter is based on TreeBuilder and reformats files for readability. If I were doing this, I would use HTML-Tidy, a C program. And I would fix things based on what HTML-Tidy told me was wrong manually. It sounds like the HTML is seriously
b0rk3d