mirror of
https://github.com/revanced/Apktool.git
synced 2025-02-01 14:47:56 +01:00
Handle strings with style index at end of string
This commit is contained in:
parent
e1f7ac355e
commit
390ecae6c5
@ -139,6 +139,7 @@ public class StringBlock {
|
|||||||
StringBuilder html = new StringBuilder(raw.length() + 32);
|
StringBuilder html = new StringBuilder(raw.length() + 32);
|
||||||
int[] opened = new int[style.length / 3];
|
int[] opened = new int[style.length / 3];
|
||||||
int offset = 0, depth = 0;
|
int offset = 0, depth = 0;
|
||||||
|
boolean closeTagOnEnd = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
int i = -1, j;
|
int i = -1, j;
|
||||||
for (j = 0; j != style.length; j += 3) {
|
for (j = 0; j != style.length; j += 3) {
|
||||||
@ -154,6 +155,9 @@ public class StringBlock {
|
|||||||
int last = opened[j];
|
int last = opened[j];
|
||||||
int end = style[last + 2];
|
int end = style[last + 2];
|
||||||
if (end >= start) {
|
if (end >= start) {
|
||||||
|
if (style[last + 1] == -1 && end != -1) {
|
||||||
|
closeTagOnEnd = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (offset <= end) {
|
if (offset <= end) {
|
||||||
@ -165,6 +169,11 @@ public class StringBlock {
|
|||||||
depth = j + 1;
|
depth = j + 1;
|
||||||
if (offset < start) {
|
if (offset < start) {
|
||||||
html.append(ResXmlEncoders.escapeXmlChars(raw.substring(offset, start)));
|
html.append(ResXmlEncoders.escapeXmlChars(raw.substring(offset, start)));
|
||||||
|
if (closeTagOnEnd) {
|
||||||
|
if (j > 0) {
|
||||||
|
outputStyleTag(getString(style[opened[j]]), html, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
offset = start;
|
offset = start;
|
||||||
}
|
}
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
|
@ -31,4 +31,14 @@ bar"</string>
|
|||||||
<string name="test_string29" formatted="false">category=temp%temp%foo</string>
|
<string name="test_string29" formatted="false">category=temp%temp%foo</string>
|
||||||
<string name="test_string30">res/foo/</string>
|
<string name="test_string30">res/foo/</string>
|
||||||
<string name="test_string31">res/foo</string>
|
<string name="test_string31">res/foo</string>
|
||||||
|
<string name="test_string32">[<font size="17">TEST STRING</font>]</string>
|
||||||
|
<string name="test_string33"><font size="17">[TEST STRING]</font></string>
|
||||||
|
<string name="test_string34">[<font size="17">TEST STRING]</font></string>
|
||||||
|
<string name="test_string35"><font size="17">[TEST STRING</font>]</string>
|
||||||
|
<string name="test_string36"><font size="17">TEST STRING</font></string>
|
||||||
|
<string name="test_string37">[<font size="17">Ţåþ ţö ţýþé þåššŵöŕð one two three]</font></string>
|
||||||
|
<string name="test_string38">[<font size="17">Ţåþ ţö ţýþé þåššŵöŕð one two three</font>]</string>
|
||||||
|
<string name="test_string39"><font size="17">[Ţåþ ţö ţýþé þåššŵöŕð one two three</font>]</string>
|
||||||
|
<string name="test_string40">[<font size="17">]Ţåþ ţö ţýþé þåššŵöŕð one two three</font></string>
|
||||||
|
<string name="test_string41"><font size="17">[Ţåþ ţö ţýþé þåššŵöŕð one two three]</font></string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user