mirror of
https://github.com/octoleo/plantuml-server.git
synced 2025-01-03 13:07:23 +00:00
Code formatting
This commit is contained in:
parent
494dfba063
commit
b995dcdb61
@ -78,40 +78,40 @@ public class PlantUmlServlet extends HttpServlet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String stringToHTMLString(String string) {
|
public static String stringToHTMLString(String string) {
|
||||||
final StringBuffer sb = new StringBuffer(string.length());
|
final StringBuffer sb = new StringBuffer(string.length());
|
||||||
// true if last char was blank
|
// true if last char was blank
|
||||||
final int length = string.length();
|
final int length = string.length();
|
||||||
for (int offset = 0; offset < length; ) {
|
for (int offset = 0; offset < length; ) {
|
||||||
final int c = string.codePointAt(offset);
|
final int c = string.codePointAt(offset);
|
||||||
if (c == ' ')
|
if (c == ' ') {
|
||||||
sb.append(' ');
|
sb.append(' ');
|
||||||
else if (c == '"')
|
} else if (c == '"') {
|
||||||
sb.append(""");
|
sb.append(""");
|
||||||
else if (c == '&')
|
} else if (c == '&') {
|
||||||
sb.append("&");
|
sb.append("&");
|
||||||
else if (c == '<')
|
} else if (c == '<') {
|
||||||
sb.append("<");
|
sb.append("<");
|
||||||
else if (c == '>')
|
} else if (c == '>') {
|
||||||
sb.append(">");
|
sb.append(">");
|
||||||
else if (c == '\r')
|
} else if (c == '\r') {
|
||||||
sb.append("\r");
|
sb.append("\r");
|
||||||
else if (c == '\n')
|
} else if (c == '\n') {
|
||||||
sb.append("\n");
|
sb.append("\n");
|
||||||
else {
|
} else {
|
||||||
int ci = 0xffffff & c;
|
int ci = 0xffffff & c;
|
||||||
if (ci < 160)
|
if (ci < 160) {
|
||||||
// nothing special only 7 Bit
|
// nothing special only 7 Bit
|
||||||
sb.append((char)c);
|
sb.append((char)c);
|
||||||
else {
|
} else {
|
||||||
// Not 7 Bit use the unicode system
|
// Not 7 Bit use the unicode system
|
||||||
sb.append("&#");
|
sb.append("&#");
|
||||||
sb.append(ci);
|
sb.append(ci);
|
||||||
sb.append(';');
|
sb.append(';');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
offset += Character.charCount(c);
|
|
||||||
}
|
}
|
||||||
|
offset += Character.charCount(c);
|
||||||
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user