Encode remaining newlines at the end of the text.

This commit is contained in:
hns 2003-04-08 12:44:53 +00:00
parent f8123e7934
commit 2fea02fb46

View file

@ -452,7 +452,7 @@ public final class HtmlEncoder {
if (!insidePreTag && linebreaks > swallowLinebreaks) {
linebreaks -= swallowLinebreaks;
for (int k=0; k<linebreaks; k++)
ret.append ("\n<br />");
ret.append ("<br />\n");
}
if (!insideTag)
swallowLinebreaks = 0;
@ -573,6 +573,12 @@ public final class HtmlEncoder {
ret.append (">");
}
}
// add remaining newlines we may have collected
if (linebreaks > 0 && linebreaks > swallowLinebreaks) {
linebreaks -= swallowLinebreaks;
for (int i=0; i<linebreaks; i++)
ret.append ("<br />\n");
}
}