From a5e762fbcbc882dffad22a53823f6e8be12c6583 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Tue, 7 Apr 2020 08:16:56 -0400 Subject: Added a notice about the new behavior of .text to the documentation. --- doc/source/index.rst | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'doc') diff --git a/doc/source/index.rst b/doc/source/index.rst index a233e89..dbc8c15 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -18,7 +18,7 @@ with examples. I show you what the library is good for, how it works, how to use it, how to make it do what you want, and what to do when it violates your expectations. -This document covers Beautiful Soup version 4.8.1. The examples in +This document covers Beautiful Soup version 4.9.0. The examples in this documentation should work the same way in Python 2.7 and Python 3.2. @@ -1708,18 +1708,17 @@ tag it contains. CSS selectors ------------- -As of version 4.7.0, Beautiful Soup supports most CSS4 selectors via -the `SoupSieve `_ -project. If you installed Beautiful Soup through ``pip``, SoupSieve -was installed at the same time, so you don't have to do anything extra. +``BeautifulSoup`` has a ``.select()`` method which uses the `SoupSieve +`_ package to run a CSS +selector against a parsed document and return all the matching +elements. ``Tag`` has a similar method which runs a CSS selector +against the contents of a single tag. -``BeautifulSoup`` has a ``.select()`` method which uses SoupSieve to -run a CSS selector against a parsed document and return all the -matching elements. ``Tag`` has a similar method which runs a CSS -selector against the contents of a single tag. - -(Earlier versions of Beautiful Soup also have the ``.select()`` -method, but only the most commonly-used CSS selectors are supported.) +(The SoupSieve integration was added in Beautiful Soup 4.7.0. Earlier +versions also have the ``.select()`` method, but only the most +commonly-used CSS selectors are supported. If you installed Beautiful +Soup through ``pip``, SoupSieve was installed at the same time, so you +don't have to do anything extra.) The SoupSieve `documentation `_ lists all the currently @@ -2436,6 +2435,12 @@ generator instead, and process the text yourself:: [text for text in soup.stripped_strings] # [u'I linked to', u'example.com'] +*As of Beautiful Soup version 4.9.0, when lxml or html.parser are in +use, the contents of