Don't escape quotes ('/") in text nodes and attributes. (#64)

- In text nodes quotes are fine
- In attributes quotes are fine if used reciprocally.

Escaping in the latter case often causes issues, e.g. with quoted font names (#21) or inline CSS styles (#56), while it probably does not gain anything (if quotes are wrongly used in attribute names the XML is most likely invalid to start with)
This commit is contained in:
Eduard Braun 2016-08-16 00:10:41 +02:00 committed by GitHub
parent fe2884c3e8
commit 57f93efc89
2 changed files with 5 additions and 2 deletions

View file

@ -1114,7 +1114,7 @@ class EnsureLineEndings(unittest.TestCase):
class XmlEntities(unittest.TestCase):
def runTest(self):
self.assertEqual( scour.makeWellFormed('<>&"\''), '&lt;&gt;&amp;&quot;&apos;',
self.assertEqual( scour.makeWellFormed('<>&'), '&lt;&gt;&amp;',
'Incorrectly translated XML entities')
class DoNotStripCommentsOutsideOfRoot(unittest.TestCase):