|
|
@ -907,34 +907,45 @@ public class MessageHelper {
|
|
|
|
int level = 0;
|
|
|
|
int level = 0;
|
|
|
|
String[] lines = result.split("\\r?\\n");
|
|
|
|
String[] lines = result.split("\\r?\\n");
|
|
|
|
for (String line : lines) {
|
|
|
|
for (String line : lines) {
|
|
|
|
|
|
|
|
// Opening quotes
|
|
|
|
int tlevel = 0;
|
|
|
|
int tlevel = 0;
|
|
|
|
while (line.trim().startsWith(">")) {
|
|
|
|
while (line.startsWith(">")) {
|
|
|
|
tlevel++;
|
|
|
|
tlevel++;
|
|
|
|
if (tlevel > level)
|
|
|
|
if (tlevel > level)
|
|
|
|
sb.append("<blockquote>");
|
|
|
|
sb.append("<blockquote>");
|
|
|
|
while (line.startsWith(" "))
|
|
|
|
|
|
|
|
|
|
|
|
line = line.substring(1); // >
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (line.startsWith(" "))
|
|
|
|
line = line.substring(1);
|
|
|
|
line = line.substring(1);
|
|
|
|
line = line.substring(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Closing quotes
|
|
|
|
for (int i = 0; i < level - tlevel; i++)
|
|
|
|
for (int i = 0; i < level - tlevel; i++)
|
|
|
|
sb.append("</blockquote>");
|
|
|
|
sb.append("</blockquote>");
|
|
|
|
level = tlevel;
|
|
|
|
level = tlevel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Show as-is
|
|
|
|
line = Html.escapeHtml(line);
|
|
|
|
line = Html.escapeHtml(line);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Non breaking spaces
|
|
|
|
|
|
|
|
boolean start = true;
|
|
|
|
int len = line.length();
|
|
|
|
int len = line.length();
|
|
|
|
for (int j = 0; j < len; j++) {
|
|
|
|
for (int j = 0; j < len; j++) {
|
|
|
|
char kar = line.charAt(j);
|
|
|
|
char kar = line.charAt(j);
|
|
|
|
if (kar == ' ' &&
|
|
|
|
if (kar == ' ' &&
|
|
|
|
j + 1 < len && line.charAt(j + 1) == ' ')
|
|
|
|
(start || j + 1 < len && line.charAt(j + 1) == ' '))
|
|
|
|
sb.append(" ");
|
|
|
|
sb.append(" ");
|
|
|
|
else
|
|
|
|
else {
|
|
|
|
|
|
|
|
start = false;
|
|
|
|
sb.append(kar);
|
|
|
|
sb.append(kar);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sb.append("<br>");
|
|
|
|
sb.append("<br>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Closing quotes
|
|
|
|
for (int i = 0; i < level; i++)
|
|
|
|
for (int i = 0; i < level; i++)
|
|
|
|
sb.append("</blockquote>");
|
|
|
|
sb.append("</blockquote>");
|
|
|
|
|
|
|
|
|
|
|
|