adding comments to filtering function

This commit is contained in:
Miroslav Stampar 2011-02-03 23:09:08 +00:00
parent 1aecbe6b08
commit 9a1a28c804

View File

@ -1286,8 +1286,7 @@ def getFilteredPageContent(page, onlyText=True):
retVal = page retVal = page
if isinstance(page, basestring): if isinstance(page, basestring):
retVal = re.sub(r"(?s)<script.+?</script>|<style.+?</style>%s" % (r"|<[^>]+>|\t|\n|\r" if onlyText else ""), " ", page) retVal = re.sub(r"(?s)<script.+?</script>|<!--.+?-->|<style.+?</style>%s" % (r"|<[^>]+>|\t|\n|\r" if onlyText else ""), " ", page)
while retVal.find(" ") != -1: while retVal.find(" ") != -1:
retVal = retVal.replace(" ", " ") retVal = retVal.replace(" ", " ")