From 6628fc01dc27ecc522eb449fa654185fecdf5f8c Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Tue, 28 Feb 2012 10:33:15 -0500 Subject: Fixed the generated XML declaration. --- NEWS.txt | 4 +++- bs4/__init__.py | 2 +- bs4/builder/_lxml.py | 2 +- bs4/testing.py | 6 +++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 9a1ac3f..3079aa1 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,8 +1,10 @@ -= 4.0.0b9 () = += 4.0.0b9 (20110228) = * Fixed the string representation of DOCTYPEs that have both a public ID and a system ID. +* Fixed the generated XML declaration. + * Renamed Tag.nsprefix to Tag.prefix, for consistency with NamespacedAttribute. diff --git a/bs4/__init__.py b/bs4/__init__.py index cbd0fd6..7a36493 100644 --- a/bs4/__init__.py +++ b/bs4/__init__.py @@ -319,7 +319,7 @@ class BeautifulSoup(Tag): encoding_part = '' if eventual_encoding != None: encoding_part = ' encoding="%s"' % eventual_encoding - prefix = u'\n' % encoding_part + prefix = u'\n' % encoding_part else: prefix = u'' if not pretty_print: diff --git a/bs4/builder/_lxml.py b/bs4/builder/_lxml.py index e5e30d4..39ad396 100644 --- a/bs4/builder/_lxml.py +++ b/bs4/builder/_lxml.py @@ -142,7 +142,7 @@ class LXMLTreeBuilderForXML(TreeBuilder): def test_fragment_to_document(self, fragment): """See `TreeBuilder`.""" - return u'\n%s' % fragment + return u'\n%s' % fragment class LXMLTreeBuilder(HTMLTreeBuilder, LXMLTreeBuilderForXML): diff --git a/bs4/testing.py b/bs4/testing.py index 49644c3..717e721 100644 --- a/bs4/testing.py +++ b/bs4/testing.py @@ -370,17 +370,17 @@ class XMLTreeBuilderSmokeTest(object): def test_docstring_generated(self): soup = self.soup("") self.assertEqual( - soup.encode(), b'\n') + soup.encode(), b'\n') def test_docstring_includes_correct_encoding(self): soup = self.soup("") self.assertEqual( soup.encode("latin1"), - b'\n') + b'\n') def test_real_xhtml_document(self): """A real XHTML document should come out the same as it went in.""" - markup = b""" + markup = b""" Hello. -- cgit v1.2.3