mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-02 06:54:25 +02:00
StringBlock.getHTML(): added support for style tags with args.
This commit is contained in:
parent
2ef8d48d96
commit
29fd92b2c4
@ -153,10 +153,7 @@ public class StringBlock {
|
|||||||
raw.substring(offset, end + 1)));
|
raw.substring(offset, end + 1)));
|
||||||
offset = end + 1;
|
offset = end + 1;
|
||||||
}
|
}
|
||||||
html.append('<');
|
outputStyleTag(getString(style[last]), html, true);
|
||||||
html.append('/');
|
|
||||||
html.append(getString(style[last]));
|
|
||||||
html.append('>');
|
|
||||||
}
|
}
|
||||||
depth = j + 1;
|
depth = j + 1;
|
||||||
if (offset < start) {
|
if (offset < start) {
|
||||||
@ -167,15 +164,48 @@ public class StringBlock {
|
|||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
html.append('<');
|
outputStyleTag(getString(style[i]), html, false);
|
||||||
html.append(getString(style[i]));
|
|
||||||
html.append('>');
|
|
||||||
style[i + 1] = -1;
|
style[i + 1] = -1;
|
||||||
opened[depth++] = i;
|
opened[depth++] = i;
|
||||||
}
|
}
|
||||||
return AndrolibResources.escapeTextForResXml(html.toString(), false);
|
return AndrolibResources.escapeTextForResXml(html.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void outputStyleTag(String tag, StringBuilder builder,
|
||||||
|
boolean close) {
|
||||||
|
builder.append('<');
|
||||||
|
if (close) {
|
||||||
|
builder.append('/');
|
||||||
|
}
|
||||||
|
|
||||||
|
int pos = tag.indexOf(';');
|
||||||
|
if (pos == -1) {
|
||||||
|
builder.append(tag);
|
||||||
|
} else {
|
||||||
|
builder.append(tag.substring(0, pos));
|
||||||
|
if (! close) {
|
||||||
|
boolean loop = true;
|
||||||
|
while (loop) {
|
||||||
|
int pos2 = tag.indexOf('=', pos + 1);
|
||||||
|
builder.append(' ').append(tag.substring(pos + 1, pos2))
|
||||||
|
.append("=\"");
|
||||||
|
pos = tag.indexOf(';', pos2 + 1);
|
||||||
|
|
||||||
|
String val;
|
||||||
|
if (pos != -1) {
|
||||||
|
val = tag.substring(pos2 + 1, pos);
|
||||||
|
} else {
|
||||||
|
loop = false;
|
||||||
|
val = tag.substring(pos2 + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.append(val).append('"');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
builder.append('>');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds index of the string.
|
* Finds index of the string.
|
||||||
* Returns -1 if the string was not found.
|
* Returns -1 if the string was not found.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user