Update of
/var/cvs/contributions/CMSContainer/cmsc/richtext/src/java/org/mmbase/applications/wordfilter
In directory
james.mmbase.org:/tmp/cvs-serv461/cmsc/richtext/src/java/org/mmbase/applications/wordfilter
Modified Files:
Tag: b1_4
WordHtmlCleaner.java
Log Message:
CMSC-421 Wordfilter whitespaces
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-421
Index: WordHtmlCleaner.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer/cmsc/richtext/src/java/org/mmbase/applications/wordfilter/WordHtmlCleaner.java,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -b -r1.11 -r1.11.2.1
--- WordHtmlCleaner.java 14 Jan 2008 22:42:21 -0000 1.11
+++ WordHtmlCleaner.java 5 May 2008 15:33:47 -0000 1.11.2.1
@@ -202,21 +202,23 @@
}
+ /**
+ * Replace <p> tags with <rr /> tags. This removes issues with <p> tags in
<p> tags
+ * 1 We do not know if these fields are used in a template with
surrounding <p> tags
+ * 2 HTML-editors do not enforce <p> tags around the contents. To make
everything
+ * look the same and xhtml just replace them.
+ * 3 Nested <p> tags have issues in several browsers.
+ */
private static String replaceParagraph(String text) {
+ // see CMSC-421 when you are going to change this code
+
// remove <p></p> (empty paragraphs)
- // CMSC-421: FP: Commented this out, because this is eating whitespace!
- // text =
- // text.replaceAll("<\\s{0,1}[pP]{1}\\s{0,1}></\\s{0,1}[pP]{1}\\s{0,1}>",
- // "");
+ text = text.replaceAll("<[pP]{1}>\\s*</[pP]{1}>", "");
- // remove all remaining <p>
+ // remove all remaining <p> start tags
text = text.replaceAll("<\\s*[pP]{1}\\s*.*?>", "");
-
- // replace all remaining </p> with a <br><br>
- // CMSC-421: FP: Changed this to two newlines, because it was eating
- // whitespace
+ // replace all remaining </p> closing tags with a <br><br>
text = text.replaceAll("<\\s*/[pP]{1}\\s*.*?>", "<br/><br/>");
-
// remove all <br> at the end
text = text.replaceAll("(<\\s*[bB][rR]\\s*/?>|\\s| )+\\z", "");
return text;
@@ -227,7 +229,7 @@
// remove the starting header tags ( <h1> till <h7>)
text = text.replaceAll("<\\s*[hH]{1}[1-7]{1}\\s*.*?>", "<strong>");
// replace all remaining ending header tags ( </h1> till </h7>)
- text = text.replaceAll("<\\s*/[hH]{1}[1-7]{1}\\s*.*?>", "</strong>>");
+ text = text.replaceAll("<\\s*/[hH]{1}[1-7]{1}\\s*.*?>", "</strong><br
/>");
// remove all <br> at the end
text = text.replaceAll("(<\\s*[bB][rR]\\s*/?>|\\s| )+\\z", "");
return text;
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs