diff options
author | Leonard Richardson <leonardr@segfault.org> | 2019-08-21 18:36:32 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2019-08-21 18:36:32 -0400 |
commit | c9aef4f30b233ee3b1b5a6822751cf33b0fb05ed (patch) | |
tree | 31c8167bfc02f45d70fba0614d9a1139f3751cce /bs4/element.py | |
parent | 25a4efbf0aedba46687a2c151f1230eeeaacea35 (diff) |
Fixed a crash when pretty-printing tags that were not created
during initial parsing. [bug=1838903]
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bs4/element.py b/bs4/element.py index a57027e..07bd893 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -1173,7 +1173,10 @@ class Tag(PageElement): """Should this tag be pretty-printed?""" return ( indent_level is not None - and self.name not in self.preserve_whitespace_tags + and ( + not self.preserve_whitespace_tags + or self.name not in self.preserve_whitespace_tags + ) ) def prettify(self, encoding=None, formatter="minimal"): |