diff --git a/NEWS b/NEWS index e2917b0..7703209 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +1.2.21: March 30, 2008 + * Made Html_cleaner support many more HTML tags and attributes, so users can + cut and paste from other programs into Luminotes. + 1.2.20: March 29, 2008 * Fixed a bug in which closing a Luminotes window with an unsaved note in Firefox would occasionally not save it. diff --git a/controller/Html_cleaner.py b/controller/Html_cleaner.py index d2eed21..6f50412 100644 --- a/controller/Html_cleaner.py +++ b/controller/Html_cleaner.py @@ -37,6 +37,77 @@ class Html_cleaner(HTMLParser): 'p', 'strong', 'u', + 'div', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'blockquote', + 'q', + 'cite', + 'code', + 'samp', + 'kbd', + 'var', + 'dfn', + 'address', + 'big', + 'small', + 'ins', + 'del', + 'acronym', + 'abbr', + 'strike', + 's', + 'sub', + 'sup', + 'tt', + 'pre', + 'center', + 'font', + 'basefont', + 'multicol', + 'spacer', + 'layer', + 'ilayer', + 'nolayer', + 'img', + 'map', + 'area', + 'param', + 'hr', + 'nobr', + 'wbr', + 'ul', + 'ol', + 'li', + 'dl', + 'dt', + 'dd', + 'menu', + 'dir', + 'form', + 'input', + 'button', + 'label', + 'select', + 'option', + 'optgroup', + 'textarea', + 'fieldset', + 'legend', + 'table', + 'tr', + 'td', + 'th', + 'tbody', + 'tfoot', + 'thead', + 'caption', + 'col', + 'colgroup', ] # A list of tags that are forcibly removed from the input. Tags that @@ -44,6 +115,22 @@ class Html_cleaner(HTMLParser): # escaped. self.stripped_tags = [ 'span', + 'blink', + 'marquee', + 'bgsound', + 'meta', + 'object', + 'iframe', + 'script', + 'noscript', + 'applet', + 'embed', + 'style', + 'link', + 'html', + 'title', + 'head', + 'body', ] # A list of tags that require no closing tag. @@ -55,11 +142,17 @@ class Html_cleaner(HTMLParser): # of "background" and "style." self.allowed_attributes = { 'a': [ 'href', 'target' ], + 'p': [ 'align' ], + 'img': [ 'alt', 'border', 'title' ], + 'table': [ 'cellpadding', 'cellspacing', 'border', 'width', 'height' ], + 'font': [ 'color', 'size', 'face' ], + 'td': [ 'rowspan', 'colspan', 'width', 'height' ], + 'th': [ 'rowspan', 'colspan', 'width', 'height' ], } # The only schemes allowed in URLs (for href and src attributes). # Adding "javascript" or "vbscript" to this list would not be smart. - self.allowed_schemes = ['http','https','ftp', ''] + self.allowed_schemes = ['http','https','ftp', 'irc', ''] def handle_data(self, data): if data: