mirror of https://github.com/M66B/FairEmail.git
Preserve plain text spaces
This commit is contained in:
parent
d03969d23f
commit
d11684c5aa
|
@ -145,9 +145,14 @@ public class HtmlHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre formatted text
|
// Pre formatted text
|
||||||
for (Element code : document.select("pre")) {
|
for (Element pre : document.select("pre")) {
|
||||||
code.html(code.html().replaceAll("\\r?\\n", "<br>"));
|
String[] lines = pre.html().split("\\r?\\n");
|
||||||
code.tagName("div");
|
for (int i = 0; i < lines.length; i++) {
|
||||||
|
if (!"-- ".equals(lines[i]))
|
||||||
|
lines[i] = lines[i].replace(" ", " ");
|
||||||
|
}
|
||||||
|
pre.html(TextUtils.join("<br>", lines));
|
||||||
|
pre.tagName("div");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Code
|
// Code
|
||||||
|
|
|
@ -862,11 +862,8 @@ public class MessageHelper {
|
||||||
// Prevent Jsoup throwing an exception
|
// Prevent Jsoup throwing an exception
|
||||||
result = result.replace("\0", "");
|
result = result.replace("\0", "");
|
||||||
|
|
||||||
if (part.isMimeType("text/plain")) {
|
if (part.isMimeType("text/plain"))
|
||||||
result = TextUtils.htmlEncode(result);
|
result = "<pre>" + TextUtils.htmlEncode(result) + "</pre>";
|
||||||
result = result.replaceAll("\\r?\\n", "<br>");
|
|
||||||
result = "<span>" + result + "</span>";
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue