From 50d3b871ad9f63907c5b19bb478aae0b6c1247a4 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 11 Jun 2015 17:17:02 -0700 Subject: normalize.py: don't collapse whitespace in pre contexts. --- test/normalize.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/normalize.py b/test/normalize.py index 03d958e..70bee46 100644 --- a/test/normalize.py +++ b/test/normalize.py @@ -21,7 +21,8 @@ class MyHTMLParser(HTMLParser): after_block_tag = after_tag and self.is_block_tag(self.last_tag) if after_tag and self.last_tag == "br": data = data.lstrip('\n') - data = whitespace_re.sub(' ', data) + if not self.in_pre: + data = whitespace_re.sub(' ', data) if after_block_tag and not self.in_pre: if self.last == "starttag": data = data.lstrip() -- cgit v1.2.3