From 34e0ce8a9dd43ada1c55b50a156fbce63b1e2ebb Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Sun, 14 Feb 2021 16:53:14 -0500 Subject: NavigableString and its subclasses now implement the get_text() method, as well as the properties .strings and .stripped_strings. These methods will either return the string itself, or nothing, so the only reason to use this is when iterating over a list of mixed Tag and NavigableString objects. [bug=1904309] --- doc/source/index.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/source/index.rst b/doc/source/index.rst index 2b5843d..63e74e2 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -2312,7 +2312,7 @@ omit the closing slash in HTML void tags like "br":: # b'
' In addition, any attributes whose values are the empty string -will become HTML-style boolean attributes: +will become HTML-style boolean attributes:: option = BeautifulSoup('').option print(option.encode(formatter="html")) @@ -2321,6 +2321,8 @@ will become HTML-style boolean attributes: print(option.encode(formatter="html5")) # b'' +*(This behavior is new as of Beautiful Soup 4.10.0.)* + If you pass in ``formatter=None``, Beautiful Soup will not modify strings at all on output. This is the fastest option, but it may lead to Beautiful Soup generating invalid HTML/XML, as in these examples:: @@ -2429,9 +2431,14 @@ generator instead, and process the text yourself:: *As of Beautiful Soup version 4.9.0, when lxml or html.parser are in use, the contents of