mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
comment some htmlifciation regexes
This commit is contained in:
parent
8a907f9be7
commit
cfd1ad7cdb
@ -204,8 +204,14 @@ public class HtmlConverter {
|
|||||||
Log.e(K9.LOG_TAG, "Could not read string to convert text to HTML:", e);
|
Log.e(K9.LOG_TAG, "Could not read string to convert text to HTML:", e);
|
||||||
}
|
}
|
||||||
text = buff.toString();
|
text = buff.toString();
|
||||||
|
|
||||||
|
// Replace lines of -,= or _ with horizontal rules
|
||||||
text = text.replaceAll("\\s*([-=_]{30,}+)\\s*", "<hr />");
|
text = text.replaceAll("\\s*([-=_]{30,}+)\\s*", "<hr />");
|
||||||
|
|
||||||
|
// TODO: reverse engineer (or troll history) and document
|
||||||
text = text.replaceAll("(?m)^([^\r\n]{4,}[\\s\\w,:;+/])(?:\r\n|\n|\r)(?=[a-z]\\S{0,10}[\\s\\n\\r])", "$1 ");
|
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,}", "\n\n");
|
text = text.replaceAll("(?m)(\r\n|\n|\r){4,}", "\n\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);
|
||||||
|
Loading…
Reference in New Issue
Block a user