Update of /var/cvs/contributions/CMSContainer/cmsc/richtext/src/java/org/mmbase/applications/wordfilter In directory james.mmbase.org:/tmp/cvs-serv32289/cmsc/richtext/src/java/org/mmbase/applications/wordfilter
Modified Files: Tag: b1_4 WordHtmlCleaner.java Log Message: CMSC-1337 - Wordfilter does not filter Word styling comments between <!-- --> See also: http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/richtext/src/java/org/mmbase/applications/wordfilter See also: http://www.mmbase.org/jira/browse/CMSC-1337 Index: WordHtmlCleaner.java =================================================================== RCS file: /var/cvs/contributions/CMSContainer/cmsc/richtext/src/java/org/mmbase/applications/wordfilter/WordHtmlCleaner.java,v retrieving revision 1.11.2.3 retrieving revision 1.11.2.4 diff -u -b -r1.11.2.3 -r1.11.2.4 --- WordHtmlCleaner.java 24 Dec 2008 13:04:36 -0000 1.11.2.3 +++ WordHtmlCleaner.java 23 Mar 2009 15:56:59 -0000 1.11.2.4 @@ -129,6 +129,7 @@ xmlStr = fixBadLists(xmlStr); xmlStr = fixNiceLists(xmlStr); xmlStr = removeHtmlIfComments(xmlStr); + xmlStr = removeComments(xmlStr); xmlStr = fixBR(xmlStr); xmlStr = removeEmptyFonts(xmlStr); @@ -203,6 +204,15 @@ return text; } + /** + * CMSC-1337: Remove inline style from e.g. Word + */ + private static String removeComments(String text) { + Pattern pattern = Pattern.compile("<!--.*?-->", Pattern.DOTALL); + Matcher matcher = pattern.matcher(text); + text = matcher.replaceAll(""); + return text; + } /** * remove xml namespace declarations _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs