mirror of https://github.com/M66B/FairEmail.git
Block quote white space improvement
This commit is contained in:
parent
9f0656d2c3
commit
f8fcb9c08b
|
@ -907,34 +907,45 @@ public class MessageHelper {
|
|||
int level = 0;
|
||||
String[] lines = result.split("\\r?\\n");
|
||||
for (String line : lines) {
|
||||
// Opening quotes
|
||||
int tlevel = 0;
|
||||
while (line.trim().startsWith(">")) {
|
||||
while (line.startsWith(">")) {
|
||||
tlevel++;
|
||||
if (tlevel > level)
|
||||
sb.append("<blockquote>");
|
||||
while (line.startsWith(" "))
|
||||
line = line.substring(1);
|
||||
|
||||
line = line.substring(1); // >
|
||||
|
||||
if (line.startsWith(" "))
|
||||
line = line.substring(1);
|
||||
}
|
||||
|
||||
// Closing quotes
|
||||
for (int i = 0; i < level - tlevel; i++)
|
||||
sb.append("</blockquote>");
|
||||
level = tlevel;
|
||||
|
||||
// Show as-is
|
||||
line = Html.escapeHtml(line);
|
||||
|
||||
// Non breaking spaces
|
||||
boolean start = true;
|
||||
int len = line.length();
|
||||
for (int j = 0; j < len; j++) {
|
||||
char kar = line.charAt(j);
|
||||
if (kar == ' ' &&
|
||||
j + 1 < len && line.charAt(j + 1) == ' ')
|
||||
(start || j + 1 < len && line.charAt(j + 1) == ' '))
|
||||
sb.append(" ");
|
||||
else
|
||||
else {
|
||||
start = false;
|
||||
sb.append(kar);
|
||||
}
|
||||
}
|
||||
|
||||
sb.append("<br>");
|
||||
}
|
||||
|
||||
// Closing quotes
|
||||
for (int i = 0; i < level; i++)
|
||||
sb.append("</blockquote>");
|
||||
|
||||
|
|
Loading…
Reference in New Issue