feedparser fixes for xhtml/svg/metadata

This commit is contained in:
Sam Ruby 2007-12-14 09:08:21 -05:00
parent 0d44180c9b
commit dbdef26baf

View File

@ -11,7 +11,7 @@ Recommended: Python 2.3 or later
Recommended: CJKCodecs and iconv_codec <http://cjkpython.i18n.org/> Recommended: CJKCodecs and iconv_codec <http://cjkpython.i18n.org/>
""" """
__version__ = "4.2-pre-" + "$Revision: 270 $"[11:14] + "-svn" __version__ = "4.2-pre-" + "$Revision: 274 $"[11:14] + "-svn"
__license__ = """Copyright (c) 2002-2007, Mark Pilgrim, All rights reserved. __license__ = """Copyright (c) 2002-2007, Mark Pilgrim, All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
@ -568,6 +568,7 @@ class _FeedParserMixin:
# call special handler (if defined) or default handler # call special handler (if defined) or default handler
methodname = '_end_' + prefix + suffix methodname = '_end_' + prefix + suffix
try: try:
if self.svgOK: raise AttributeError()
method = getattr(self, methodname) method = getattr(self, methodname)
method() method()
except AttributeError: except AttributeError:
@ -2332,19 +2333,19 @@ class _HTMLSanitizer(_BaseHTMLProcessor):
valid_css_values = re.compile('^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|' + valid_css_values = re.compile('^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|' +
'\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$') '\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$')
mathml_elements = ['annotation', 'annotation-xml', 'maction', 'math', 'merror', 'mfrac', 'mi', mathml_elements = ['annotation', 'annotation-xml', 'maction', 'math',
'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'merror', 'mfrac', 'mi', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded',
'mprescripts', 'mroot', 'mrow', 'mspace', 'msqrt', 'mstyle', 'msub', 'mphantom', 'mprescripts', 'mroot', 'mrow', 'mspace', 'msqrt', 'mstyle',
'msubsup', 'msup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'msub', 'msubsup', 'msup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder',
'munderover', 'none', 'semantics'] 'munderover', 'none', 'semantics']
mathml_attributes = ['actiontype', 'align', 'columnalign', 'columnalign', mathml_attributes = ['actiontype', 'align', 'columnalign', 'columnalign',
'columnalign', 'columnlines', 'columnspacing', 'columnspan', 'depth', 'columnalign', 'columnlines', 'columnspacing', 'columnspan', 'depth',
'display', 'displaystyle', 'encoding', 'equalcolumns', 'equalrows', 'fence', 'display', 'displaystyle', 'encoding', 'equalcolumns', 'equalrows',
'fontstyle', 'fontweight', 'frame', 'height', 'linethickness', 'lspace', 'fence', 'fontstyle', 'fontweight', 'frame', 'height', 'linethickness',
'mathbackground', 'mathcolor', 'mathvariant', 'mathvariant', 'maxsize', 'lspace', 'mathbackground', 'mathcolor', 'mathvariant', 'mathvariant',
'minsize', 'other', 'rowalign', 'rowalign', 'rowalign', 'rowlines', 'maxsize', 'minsize', 'other', 'rowalign', 'rowalign', 'rowalign',
'rowspacing', 'rowspan', 'rspace', 'scriptlevel', 'selection', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'scriptlevel', 'selection',
'separator', 'stretchy', 'width', 'width', 'xlink:href', 'xlink:show', 'separator', 'stretchy', 'width', 'width', 'xlink:href', 'xlink:show',
'xlink:type', 'xmlns', 'xmlns:xlink'] 'xlink:type', 'xmlns', 'xmlns:xlink']