From 295f5a859e4b128d40b042bf7021acdf09cf3dde Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 11 Jun 2015 17:12:42 -0700 Subject: normalize.py: Don't collapse whitespace in pre tag. --- test/normalize.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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