summaryrefslogtreecommitdiff
path: root/beautifulsoup/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'beautifulsoup/__init__.py')
-rw-r--r--beautifulsoup/__init__.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/beautifulsoup/__init__.py b/beautifulsoup/__init__.py
index cee55e7..53130e0 100644
--- a/beautifulsoup/__init__.py
+++ b/beautifulsoup/__init__.py
@@ -262,8 +262,9 @@ class BeautifulSoup(Tag):
def handle_data(self, data):
self.currentData.append(data)
- def decode(self, pretty_print=False, indent_level=0,
- eventual_encoding=DEFAULT_OUTPUT_ENCODING):
+ def decode(self, pretty_print=False,
+ eventual_encoding=DEFAULT_OUTPUT_ENCODING,
+ substitute_html_entities=False):
"""Returns a string or Unicode representation of this document.
To get Unicode, pass None for encoding."""
if self.is_xml:
@@ -274,8 +275,13 @@ class BeautifulSoup(Tag):
prefix = u'<?xml version="1.0"%s>\n' % encoding_part
else:
prefix = u''
+ if not pretty_print:
+ indent_level = None
+ else:
+ indent_level = 0
return prefix + super(BeautifulSoup, self).decode(
- pretty_print, indent_level, eventual_encoding)
+ indent_level, eventual_encoding,
+ substitute_html_entities)
class StopParsing(Exception):