# HG changeset patch # User Mikael Berthe # Date 1179647209 -7200 # Node ID 2123977057c5a177440bf4cd8ff1f3dadff8d9ae # Parent a81dc352e96eb565f119dc98f3f69cf5f25c34d7 Cleanup patch from Loic Berthe diff -r a81dc352e96e -r 2123977057c5 plugins/rss_plugin.py --- a/plugins/rss_plugin.py Sat May 19 15:22:09 2007 +0200 +++ b/plugins/rss_plugin.py Sun May 20 09:46:49 2007 +0200 @@ -17,25 +17,24 @@ ################################################################################ import re -def rss_remove_html(text): - exp = re.compile('<[^>]*>') - text = exp.sub('', text) - notags = text.replace('<', '<').replace('>', '>') - noescape = notags.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"') - noescape = noescape.replace('<p>', '') - noescape = noescape.replace('</p>', '') - noescape = noescape.replace('<p />', '').replace('<p/>', '') - return noescape -""" OLD CODE: REMOVE LATER IF NEW FUNCTION (added 2005-10-12) WORKS +html_table = [ + ('<p>' , '' ), + ('</p>' , '' ), + ('<p />', '' ), + ('<p/>' , '' ), + ('>' , '>'), + ('>' , '>'), + ('<' , '<'), + ('"' , '"'), + ('&' , '&'), +] + def rss_remove_html(text): - notags = text.replace('<', '<').replace('>', '>') - noescape = notags.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"') - noescape = noescape.replace('<p>', '') - noescape = noescape.replace('</p>', '') - noescape = noescape.replace('<p />', '').replace('<p/>', '') - return noescape -""" + text = re.sub(r'<[^>]*>', '', text) + for bad, new in html_table : + text = text.replace(bad, new) + return text def rss_update_file(): global RSS_CACHE