Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SuperClean/filters/word.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SuperClean/filters/word.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SuperClean/filters/word.js 13 May 2008 18:53:57 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SuperClean/filters/word.js 16 Jan 2009 09:05:49 -0000 1.3 @@ -1,30 +1,53 @@ -/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */ -/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */ -/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/SuperClean/filters/word.js */ -function(_1){ -_1=_1.replace(//gi,""); -_1=_1.replace(//gi,""); -_1=_1.replace(/<\/?\s*HTML[^>]*>/gi,""); -_1=_1.replace(/<\/?\s*BODY[^>]*>/gi,""); -_1=_1.replace(/<\/?\s*META[^>]*>/gi,""); -_1=_1.replace(/<\/?\s*SPAN[^>]*>/gi,""); -_1=_1.replace(/<\/?\s*FONT[^>]*>/gi,""); -_1=_1.replace(/<\/?\s*IFRAME[^>]*>/gi,""); -_1=_1.replace(/<\/?\s*STYLE[^>]*>(.|[\n\r\t])*<\/\s*STYLE\s*>/gi,""); -_1=_1.replace(/<\s*TITLE[^>]*>(.|[\n\r\t])*<\/\s*TITLE\s*>/gi,""); -_1=_1.replace(/<\s*SCRIPT[^>]*>[^\0]*<\/\s*SCRIPT\s*>/gi,""); -_1=_1.replace(/<\s*HEAD[^>]*>(.|[\n\r\t])*<\/\s*HEAD\s*>/gi,""); -_1=_1.replace(/<\s*(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3"); -_1=_1.replace(/<\s*(\w[^>]*) style="([^"]*)"([^>]*)/gi,"<$1$3"); -_1=_1.replace(/<\s*(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3"); -_1=_1.replace(/<\\?\?xml[^>]*>/gi,""); -_1=_1.replace(/<\/?\w+:[^>]*>/gi,""); -_1=_1.replace(/ /," "); -_1=_1.replace(/<\s*p[^>]*><\s*br\s*\/?>\s*<\/\s*p[^>]*>/gi,"
"); -_1=_1.replace(/<\s*p[^>]*>/gi,""); -_1=_1.replace(/<\/\s*p[^>]*>/gi,"
"); -_1=_1.replace(/(\s*
\s*)*$/,""); -_1=_1.trim(); -return _1; -} +function(html) { + // Remove HTML comments + html = html.replace(//gi, "" ); + html = html.replace(//gi, ''); + // Remove all HTML tags + html = html.replace(/<\/?\s*HTML[^>]*>/gi, "" ); + // Remove all BODY tags + html = html.replace(/<\/?\s*BODY[^>]*>/gi, "" ); + // Remove all META tags + html = html.replace(/<\/?\s*META[^>]*>/gi, "" ); + // Remove all SPAN tags + html = html.replace(/<\/?\s*SPAN[^>]*>/gi, "" ); + // Remove all FONT tags + html = html.replace(/<\/?\s*FONT[^>]*>/gi, ""); + // Remove all IFRAME tags. + html = html.replace(/<\/?\s*IFRAME[^>]*>/gi, ""); + // Remove all STYLE tags & content + html = html.replace(/<\/?\s*STYLE[^>]*>(.|[\n\r\t])*<\/\s*STYLE\s*>/gi, "" ); + // Remove all TITLE tags & content + html = html.replace(/<\s*TITLE[^>]*>(.|[\n\r\t])*<\/\s*TITLE\s*>/gi, "" ); + // Remove javascript + html = html.replace(/<\s*SCRIPT[^>]*>[^\0]*<\/\s*SCRIPT\s*>/gi, ""); + // Remove all HEAD tags & content + html = html.replace(/<\s*HEAD[^>]*>(.|[\n\r\t])*<\/\s*HEAD\s*>/gi, "" ); + // Remove Class attributes + html = html.replace(/<\s*(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ; + // Remove Style attributes + html = html.replace(/<\s*(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ; + // Remove Lang attributes + html = html.replace(/<\s*(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ; + // Remove XML elements and declarations + html = html.replace(/<\\?\?xml[^>]*>/gi, "") ; + // Remove Tags with XML namespace declarations: + html = html.replace(/<\/?\w+:[^>]*>/gi, "") ; + // Replace the   + html = html.replace(/ /, " " ); + // Transform


to
+ //html = html.replace(/<\s*p[^>]*>\s*<\s*br\s*\/>\s*<\/\s*p[^>]*>/gi, "
"); + html = html.replace(/<\s*p[^>]*><\s*br\s*\/?>\s*<\/\s*p[^>]*>/gi, "
"); + + // Remove

+ html = html.replace(/<\s*p[^>]*>/gi, ""); + + // Replace

with
+ html = html.replace(/<\/\s*p[^>]*>/gi, "
"); + + // Remove any
at the end + html = html.replace(/(\s*
\s*)*$/, ""); + + html = html.trim(); + return html; +} \ No newline at end of file