diff options
author | Leonard Richardson <leonardr@segfault.org> | 2015-06-24 07:09:24 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2015-06-24 07:09:24 -0400 |
commit | 8b63da202f6d1c55f41f4011e686938eee7e4cee (patch) | |
tree | 67d83ed4f0c977dd2c01b367c7174c2f23ba7fb4 /bs4/element.py | |
parent | bc336731a8a035270eb97b04ff705fd8208cdb86 (diff) |
Improved docstring for encode_contents() and decode_contents(). [bug=1441543]
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/bs4/element.py b/bs4/element.py index 9dc7b47..0c2e11a 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -1115,12 +1115,18 @@ class Tag(PageElement): formatter="minimal"): """Renders the contents of this tag as a Unicode string. + :param indent_level: Each line of the rendering will be + indented this many spaces. + :param eventual_encoding: The tag is destined to be encoded into this encoding. This method is _not_ responsible for performing that encoding. This information is passed in so that it can be substituted in if the document contains a <META> tag that mentions the document's encoding. + + :param formatter: The output formatter responsible for converting + entities to Unicode characters. """ # First off, turn a string formatter into a function. This # will stop the lookup from happening over and over again. @@ -1149,7 +1155,17 @@ class Tag(PageElement): def encode_contents( self, indent_level=None, encoding=DEFAULT_OUTPUT_ENCODING, formatter="minimal"): - """Renders the contents of this tag as a bytestring.""" + """Renders the contents of this tag as a bytestring. + + :param indent_level: Each line of the rendering will be + indented this many spaces. + + :param eventual_encoding: The bytestring will be in this encoding. + + :param formatter: The output formatter responsible for converting + entities to Unicode characters. + """ + contents = self.decode_contents(indent_level, encoding, formatter) return contents.encode(encoding) |