diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-06-11 17:12:42 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-06-11 17:12:42 -0700 |
commit | 295f5a859e4b128d40b042bf7021acdf09cf3dde (patch) | |
tree | 700ed8c743b0a7a4dd1ea637f0a84084abe030b5 | |
parent | f31bb51ade76790b35a14517635d5e1da45f4ea5 (diff) |
normalize.py: Don't collapse whitespace in pre tag.
-rw-r--r-- | test/normalize.py | 3 |
1 files changed, 2 insertions, 1 deletions
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() |