From 467c8fccaea08d68d8cdf4725cea83aaa044f803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Mon, 9 Feb 2015 22:41:01 +0100 Subject: [PATCH 1/2] Add some missing MathML elements and attributes. --- html5lib/sanitizer.py | 49 ++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/html5lib/sanitizer.py b/html5lib/sanitizer.py index 469d9b40..5b38e670 100644 --- a/html5lib/sanitizer.py +++ b/html5lib/sanitizer.py @@ -24,11 +24,15 @@ class HTMLSanitizerMixin(object): 'sub', 'sup', 'table', 'tbody', 'td', 'textarea', 'time', 'tfoot', 'th', 'thead', 'tr', 'tt', 'u', 'ul', 'var', 'video'] - mathml_elements = ['maction', 'math', 'merror', 'mfrac', 'mi', - 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', - 'mprescripts', 'mroot', 'mrow', 'mspace', 'msqrt', 'mstyle', 'msub', - 'msubsup', 'msup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', - 'munderover', 'none'] + mathml_elements = ['annotation', 'annotation-xml', 'maction', 'maligngroup', + 'malignmark', 'math', 'menclose', 'merror', 'mfenced', + 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mlongdiv', + 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', + 'mphantom', 'mprescripts', 'mroot', 'mrow', 'ms', + 'mscarries', 'mscarry', 'msgroup', 'msline', 'mstack', + 'mspace', 'msqrt', 'msrow', 'mstack' 'mstyle', 'msub', + 'msubsup', 'msup', 'mtable', 'mtd', 'mtext', 'mtr', + 'munder', 'munderover', 'none', 'semantics'] svg_elements = ['a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'clipPath', 'circle', 'defs', 'desc', 'ellipse', @@ -61,15 +65,32 @@ class HTMLSanitizerMixin(object): 'urn', 'valign', 'value', 'variable', 'volume', 'vspace', 'vrml', 'width', 'wrap', 'xml:lang'] - mathml_attributes = ['actiontype', 'align', 'columnalign', 'columnalign', - 'columnalign', 'columnlines', 'columnspacing', 'columnspan', 'depth', - 'display', 'displaystyle', 'equalcolumns', 'equalrows', 'fence', - 'fontstyle', 'fontweight', 'frame', 'height', 'linethickness', 'lspace', - 'mathbackground', 'mathcolor', 'mathvariant', 'mathvariant', 'maxsize', - 'minsize', 'other', 'rowalign', 'rowalign', 'rowalign', 'rowlines', - 'rowspacing', 'rowspan', 'rspace', 'scriptlevel', 'selection', - 'separator', 'stretchy', 'width', 'width', 'xlink:href', 'xlink:show', - 'xlink:type', 'xmlns', 'xmlns:xlink'] + mathml_attributes = ['accent', 'accentunder', 'actiontype', 'align', + 'alignmentscope', 'altimg', 'altimg-height', + 'altimg-valign', 'altimg-width', 'alttext', 'bevelled', + 'charalign', 'close', 'columnalign', 'columnlines', + 'columnspacing', 'columnspan', 'columnwidth', + 'crossout', 'decimalpoint', 'denomalign', 'depth', + 'dir', 'display', 'displaystyle', 'edge', + 'equalcolumns', 'equalrows', 'fence', 'fontstyle', + 'fontweight', 'form', 'frame', 'framespacing', + 'groupalign', 'height', 'href', 'id', 'indentalign', + 'indentalignfirst', 'indentalignlast', 'indentshift', + 'indentshiftfirst', 'indentshiftlast', 'indenttarget', + 'infixlinebreakstyle', 'largeop', 'length', + 'linebreak', 'linebreakmultchar', 'linebreakstyle', + 'lineleading', 'linethickness', 'location', + 'longdivstyle', 'lquote', 'lspace', 'mathbackground', + 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', + 'minlabelspacing', 'minsize', 'movablelimits', + 'notation', 'numalign', 'open', 'overflow', 'position', + 'rowalign', 'rowlines', 'rowspacing', 'rowspan', + 'rquote', 'rspace', 'scriptlevel', 'scriptminsize', + 'scriptsizemultiplier', 'selection', 'separator', + 'separators', 'shift', 'side', 'src', 'stackalign', + 'stretchy', 'subscriptshift', 'superscriptshift', + 'symmetric', 'voffset', 'width', 'xlink:href', + 'xlink:show', 'xlink:type', 'xmlns', 'xmlns:xlink'] svg_attributes = ['accent-height', 'accumulate', 'additive', 'alphabetic', 'arabic-form', 'ascent', 'attributeName', 'attributeType', From f62cd1bb73c37f5a72fcf3270bee084306969b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Tue, 14 Apr 2015 23:10:15 +0200 Subject: [PATCH 2/2] Add encoding and other attributes to be in sync with feedparser #181 See https://github.com/distler/venus/commit/fdb788e798b58b92eec9f0a85eb53d7682f7fd8e#commitcomment-10724078 --- html5lib/sanitizer.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/html5lib/sanitizer.py b/html5lib/sanitizer.py index 5b38e670..3ef0beb6 100644 --- a/html5lib/sanitizer.py +++ b/html5lib/sanitizer.py @@ -71,7 +71,7 @@ class HTMLSanitizerMixin(object): 'charalign', 'close', 'columnalign', 'columnlines', 'columnspacing', 'columnspan', 'columnwidth', 'crossout', 'decimalpoint', 'denomalign', 'depth', - 'dir', 'display', 'displaystyle', 'edge', + 'dir', 'display', 'displaystyle', 'edge', 'encoding', 'equalcolumns', 'equalrows', 'fence', 'fontstyle', 'fontweight', 'form', 'frame', 'framespacing', 'groupalign', 'height', 'href', 'id', 'indentalign', @@ -83,14 +83,15 @@ class HTMLSanitizerMixin(object): 'longdivstyle', 'lquote', 'lspace', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minlabelspacing', 'minsize', 'movablelimits', - 'notation', 'numalign', 'open', 'overflow', 'position', - 'rowalign', 'rowlines', 'rowspacing', 'rowspan', - 'rquote', 'rspace', 'scriptlevel', 'scriptminsize', - 'scriptsizemultiplier', 'selection', 'separator', - 'separators', 'shift', 'side', 'src', 'stackalign', - 'stretchy', 'subscriptshift', 'superscriptshift', - 'symmetric', 'voffset', 'width', 'xlink:href', - 'xlink:show', 'xlink:type', 'xmlns', 'xmlns:xlink'] + 'notation', 'numalign', 'open', 'other', 'overflow', + 'position', 'rowalign', 'rowlines', 'rowspacing', + 'rowspan', 'rquote', 'rspace', 'scriptlevel', + 'scriptminsize', 'scriptsizemultiplier', 'selection', + 'separator', 'separators', 'shift', 'side', 'src', + 'stackalign', 'stretchy', 'subscriptshift', + 'superscriptshift', 'symmetric', 'voffset', 'width', + 'xlink:href', 'xlink:show', 'xlink:type', 'xmlns', + 'xmlns:xlink'] svg_attributes = ['accent-height', 'accumulate', 'additive', 'alphabetic', 'arabic-form', 'ascent', 'attributeName', 'attributeType',