1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 05:02:26 -05:00

Eliminate non-working text replacements

All \r and \n codes have been replaced with <br />, so the patterns in
these replacements don't match anything.

This problem has existed for some time -- since commits 1ea27d7 and
e12dd32.

No attempt is made here to reimplement the replacements because users are
now used to the current behavior without much apparent complaint, and such
replacements are never perfect and can occasionally fail to work as
desired without additional tweaking for special cases.
This commit is contained in:
Joe Steele 2014-02-24 17:23:18 -05:00
parent 1f5e1660a8
commit 1091e7af99

View File

@ -282,17 +282,6 @@ public class HtmlConverter {
// Replace lines of -,= or _ with horizontal rules // Replace lines of -,= or _ with horizontal rules
text = text.replaceAll("\\s*([-=_]{30,}+)\\s*", "<hr />"); text = text.replaceAll("\\s*([-=_]{30,}+)\\s*", "<hr />");
/*
* Unwrap multi-line paragraphs into single line paragraphs that are
* wrapped when displayed. But try to avoid unwrapping consecutive lines
* of text that are not paragraphs, such as lists of system log entries
* or long URLs that are on their own line.
*/
text = text.replaceAll("(?m)^([^\r\n]{4,}[\\s\\w,:;+/])(?:\r\n|\n|\r)(?=[a-z]\\S{0,10}[\\s\\n\\r])", "$1 ");
// Compress four or more newlines down to two newlines
text = text.replaceAll("(?m)(\r\n|\n|\r){4,}", "\r\n\r\n");
StringBuffer sb = new StringBuffer(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); StringBuffer sb = new StringBuffer(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH);
sb.append(htmlifyMessageHeader()); sb.append(htmlifyMessageHeader());