Fixed removing trailing block white space

This commit is contained in:
M66B 2021-07-04 14:07:23 +02:00
parent 774c246e33
commit 5b2b41c166
1 changed files with 14 additions and 4 deletions

View File

@ -2244,10 +2244,6 @@ public class HtmlHelper {
(i == 0 || endsWithSpace(block.get(i - 1).text())))
text = text.substring(1);
// Conditionally remove trailing whitespace
if (i == block.size() - 1 && endsWithSpace(text))
text = text.substring(0, text.length() - 1);
tnode.text(text);
if (TextUtils.isEmpty(text))
@ -2256,6 +2252,20 @@ public class HtmlHelper {
i++;
}
// Remove trailing whitespace
while (block.size() > 0) {
tnode = block.get(block.size() - 1);
text = tnode.getWholeText();
if (endsWithSpace(text)) {
text = text.substring(0, text.length() - 1);
tnode.text(text);
}
if (TextUtils.isEmpty(text))
block.remove(block.size() - 1);
else
break;
}
// Remove all blank blocks
boolean blank = true;
for (int i = 0; i < block.size(); i++) {