check-templates: Rewrite pretty_print (again).

It now does everything based on the tokens, rather
than walking the lines and trying to match up tokens
to lines.
This commit is contained in:
Steve Howell
2021-12-02 16:10:42 +00:00
committed by Tim Abbott
parent 7e7b628054
commit fb574431cb
9 changed files with 135 additions and 197 deletions

View File

@@ -281,8 +281,9 @@ GOOD_HTML11 = """
def pretty_print(html: str) -> str:
tokens = validate(fn=None, text=html)
return pretty_print_html(html, tokens)
fn = "<test str>"
tokens = validate(fn=fn, text=html)
return pretty_print_html(tokens, fn=fn)
class TestPrettyPrinter(unittest.TestCase):