diff options
-rw-r--r-- | CHANGELOG | 21 | ||||
-rw-r--r-- | doc/source/index.rst | 14 | ||||
-rw-r--r-- | prepare-release.sh | 8 |
3 files changed, 29 insertions, 14 deletions
@@ -1,11 +1,16 @@ = 4.8.0 (20190720, "One Small Soup") -* It's now possible to customize the TreeBuilder object by passing - keyword arguments into the BeautifulSoup constructor. The main - reason to do this right now is to change how which attributes are - treated as multi-valued attributes (the way 'class' is treated by - default). You can do this with the `multi_valued_attributes` argument. - [bug=1832978] +This release focuses on making it easier to customize Beautiful Soup's +input mechanism (the TreeBuilder) and output mechanism (the Formatter). + +* You can customize the TreeBuilder object by passing keyword + arguments into the BeautifulSoup constructor. Those keyword + arguments will be passed along into the TreeBuilder constructor. + + The main reason to do this right now is to change how which + attributes are treated as multi-valued attributes (the way 'class' + is treated by default). You can do this with the + 'multi_valued_attributes' argument. [bug=1832978] * The role of Formatter objects has been greatly expanded. The Formatter class now controls the following: @@ -20,9 +25,9 @@ All preexisting code should work as before. * Added a new method to the API, Tag.smooth(), which consolidates - multiple adjacent NavigableString elements. + multiple adjacent NavigableString elements. [bug=1697296] -* ' (which is valid in XML, XHTML, and HTML 5, but not HTML 4) is now +* ' (which is valid in XML, XHTML, and HTML 5, but not HTML 4) is always recognized as a named entity and converted to a single quote. [bug=1818721] = 4.7.1 (20190106) diff --git a/doc/source/index.rst b/doc/source/index.rst index cea1be5..0c94d6a 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -428,7 +428,7 @@ consolidated:: print(rel_soup.p) # <p>Back to the <a rel="index contents">homepage</a></p> - You can disable this by passing ``multi_valued_attributes=None`` as a +You can disable this by passing ``multi_valued_attributes=None`` as a keyword argument into the ``BeautifulSoup`` constructor:: no_list_soup = BeautifulSoup('<p class="body strikeout"></p>', 'html', multi_valued_attributes=None) @@ -2240,7 +2240,7 @@ invalid HTML or XML:: You can change this behavior by providing a value for the ``formatter`` argument to ``prettify()``, ``encode()``, or -``decode()``. Beautiful Soup recognizes six possible values for +``decode()``. Beautiful Soup recognizes five possible values for ``formatter``. The default is ``formatter="minimal"``. Strings will only be processed @@ -2332,7 +2332,8 @@ attributes in every tag by default:: To turn this off, you can subclass the ``Formatter.attributes()`` method, which controls which attributes are output and in what -order. This implementation also filters out out one of the attributes. +order. This implementation also filters out the attribute called "m" +whenever it appears:: class UnsortedAttributes(HTMLFormatter): def attributes(self, tag): @@ -2345,9 +2346,10 @@ order. This implementation also filters out out one of the attributes. One last caveat: if you create a ``CData`` object, the text inside that object is always presented `exactly as it appears, with no -formatting`. Beautiful Soup will call the formatter method, just in -case you've written a custom method that counts all the strings in the -document or something, but it will ignore the return value:: +formatting`. Beautiful Soup will call your entity substitution +function, just in case you've written a custom function that counts +all the strings in the document or something, but it will ignore the +return value:: from bs4.element import CData soup = BeautifulSoup("<a></a>") diff --git a/prepare-release.sh b/prepare-release.sh index b26c07c..0424ba6 100644 --- a/prepare-release.sh +++ b/prepare-release.sh @@ -18,9 +18,17 @@ rm -rf build dist python setup.py sdist bdist_wheel # Run this in Python 3 env. + +# Upload to test twine upload --repository-url https://test.pypi.org/legacy/ dist/* + +# Upload for real twine upload dist/* + +# How to install from test PYPI: you need to reference the real server to get the soupstrainer dependency. +pip install -i https://testpypi.python.org/pypi beautifulsoup4 --extra-index-url=https://pypi.python.org/pypi + # Old instructions: |