Skip to content

Commit

Permalink
Don't sanitize away unnamespaced HTML5 svg; convert to polyglot syntax
Browse files Browse the repository at this point in the history
instead.
  • Loading branch information
rubys committed Aug 6, 2010
1 parent b2147a2 commit 206b21e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion planet/vendor/feedparser.py
Expand Up @@ -11,7 +11,7 @@
Recommended: CJKCodecs and iconv_codec <http://cjkpython.i18n.org/>
"""

__version__ = "4.2-pre-" + "$Revision: 308 $"[11:14] + "-svn"
__version__ = "4.2-pre-" + "$Revision: 314 $"[11:14] + "-svn"
__license__ = """Copyright (c) 2002-2008, Mark Pilgrim, All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -2467,6 +2467,15 @@ def unknown_starttag(self, tag, attrs):
if tag in self.unacceptable_elements_with_end_tag:
self.unacceptablestack += 1

# add implicit namespaces to html5 inline svg/mathml
if self.type.endswith('html'):
if tag=='svg':
if not dict(attrs).get('xmlns'):
attrs.append( ('xmlns','http://www.w3.org/2000/svg') )
if tag=='math':
if not dict(attrs).get('xmlns'):
attrs.append( ('xmlns','http://www.w3.org/1998/Math/MathML') )

# not otherwise acceptable, perhaps it is MathML or SVG?
if tag=='math' and ('xmlns','http://www.w3.org/1998/Math/MathML') in attrs:
self.mathmlOK += 1
Expand Down

0 comments on commit 206b21e

Please sign in to comment.