Permalink
Browse files

Don't sanitize away unnamespaced HTML5 svg; convert to polyglot syntax

instead.
  • Loading branch information...
1 parent b2147a2 commit 206b21edc9e9eb6f185e5c3778e160f6f563a393 @rubys committed Aug 6, 2010
Showing with 10 additions and 1 deletion.
  1. +10 −1 planet/vendor/feedparser.py
@@ -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,
@@ -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

0 comments on commit 206b21e

Please sign in to comment.