in src/org/jetbrains/r/visualization/inlays/table/filters/parser/HtmlHandler.java [27:67]
private String removeHtmlInfo(String inner) {
boolean inTag = false, inQuoteInTag = false;
char quoteChar = '"';
int entityPos = -1;
buffer.delete(0, buffer.length());
for (char c : inner.toCharArray()) {
if (c == '<') {
inTag = true;
entityPos = -1;
} else if (c == '>') {
// not anymore tag, unless is inside a quote
inTag = inTag && inQuoteInTag;
} else if (inTag) {
// special attention to "' characters
if (c == '"' || c == '\'') {
if (inQuoteInTag) {
inQuoteInTag = (quoteChar != c);
} else {
inQuoteInTag = true;
quoteChar = c;
}
}
} else {
if (c == '&') {
entityPos = buffer.length();
} else if (c == ';' && entityPos != -1) {
int len = buffer.length();
if (len > entityPos + 2) {
int entityValue = getEntityValue(entityPos + 1);
if (entityValue > 0 && entityValue < 65536) {
buffer.delete(entityPos, len);
c = (char) entityValue;
}
}
}
buffer.append(c);
}
}
return buffer.toString();
}