mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-08 11:05:52 +01:00
StringBlock.getHtml(): fixed order of closing tags.
This commit is contained in:
parent
debbb3b5be
commit
c781281e1c
@ -128,10 +128,11 @@ public class StringBlock {
|
|||||||
return escapeForXml(raw);
|
return escapeForXml(raw);
|
||||||
}
|
}
|
||||||
StringBuilder html = new StringBuilder(raw.length() + 32);
|
StringBuilder html = new StringBuilder(raw.length() + 32);
|
||||||
int offset = 0;
|
int[] opened = new int[style.length / 3];
|
||||||
|
int offset = 0, depth = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
int i = -1;
|
int i = -1, j;
|
||||||
for (int j = 0; j != style.length; j += 3) {
|
for (j = 0; j != style.length; j += 3) {
|
||||||
if (style[j + 1] == -1) {
|
if (style[j + 1] == -1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -140,21 +141,22 @@ public class StringBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
int start = ((i != -1) ? style[i + 1] : raw.length());
|
int start = ((i != -1) ? style[i + 1] : raw.length());
|
||||||
for (int j = 0; j != style.length; j += 3) {
|
for (j = depth - 1; j >= 0; j--) {
|
||||||
int end = style[j + 2];
|
int last = opened[j];
|
||||||
if (end == -1 || end >= start) {
|
int end = style[last + 2];
|
||||||
continue;
|
if (end >= start) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (offset <= end) {
|
if (offset <= end) {
|
||||||
html.append(escapeForXml(raw.substring(offset, end + 1)));
|
html.append(escapeForXml(raw.substring(offset, end + 1)));
|
||||||
offset = end + 1;
|
offset = end + 1;
|
||||||
}
|
}
|
||||||
style[j + 2] = -1;
|
|
||||||
html.append('<');
|
html.append('<');
|
||||||
html.append('/');
|
html.append('/');
|
||||||
html.append(getString(style[j]));
|
html.append(getString(style[last]));
|
||||||
html.append('>');
|
html.append('>');
|
||||||
}
|
}
|
||||||
|
depth = j + 1;
|
||||||
if (offset < start) {
|
if (offset < start) {
|
||||||
html.append(escapeForXml(raw.substring(offset, start)));
|
html.append(escapeForXml(raw.substring(offset, start)));
|
||||||
offset = start;
|
offset = start;
|
||||||
@ -166,6 +168,7 @@ public class StringBlock {
|
|||||||
html.append(getString(style[i]));
|
html.append(getString(style[i]));
|
||||||
html.append('>');
|
html.append('>');
|
||||||
style[i + 1] = -1;
|
style[i + 1] = -1;
|
||||||
|
opened[depth++] = i;
|
||||||
}
|
}
|
||||||
return html.toString();
|
return html.toString();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user