1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

Better HTMLization of plain text emails using <pre>: spaces / identation are now properly displayed

This commit is contained in:
Bao-Long Nguyen-Trong 2009-05-20 04:44:45 +00:00
parent d8724784dd
commit bae5fba355

View File

@ -1469,9 +1469,6 @@ public class LocalStore extends Store implements Serializable {
break; break;
case '\r': case '\r':
break; break;
case '\n':
buff.append("<br/>");
break;
default: default:
buff.append((char)c); buff.append((char)c);
}//switch }//switch
@ -1484,7 +1481,7 @@ public class LocalStore extends Store implements Serializable {
Matcher m = Regex.WEB_URL_PATTERN.matcher(text); Matcher m = Regex.WEB_URL_PATTERN.matcher(text);
StringBuffer sb = new StringBuffer(text.length() + 512); StringBuffer sb = new StringBuffer(text.length() + 512);
sb.append("<html><body>"); sb.append("<html><body><pre style=\"white-space: pre-wrap;\">");
while (m.find()) { while (m.find()) {
int start = m.start(); int start = m.start();
if (start == 0 || (start != 0 && text.charAt(start - 1) != '@')) { if (start == 0 || (start != 0 && text.charAt(start - 1) != '@')) {
@ -1494,7 +1491,7 @@ public class LocalStore extends Store implements Serializable {
} }
} }
m.appendTail(sb); m.appendTail(sb);
sb.append("</body></html>"); sb.append("</pre></body></html>");
text = sb.toString(); text = sb.toString();
return text; return text;