Prevent double line breaks

This commit is contained in:
M66B 2020-01-20 18:02:40 +01:00
parent 9ec206f150
commit fec1e8dfcc
1 changed files with 8 additions and 0 deletions

View File

@ -267,6 +267,14 @@ public class HtmlHelper {
// if (br.parent() != null && !hasVisibleContent(br.parent().childNodes())) // if (br.parent() != null && !hasVisibleContent(br.parent().childNodes()))
// br.tagName("span"); // br.tagName("span");
for (Element div : document.select("div"))
if (div.children().select("div").size() == 0 &&
hasVisibleContent(div.childNodes())) {
Node last = div.childNode(div.childNodeSize() - 1);
if (last != null && "br".equals(last.nodeName()))
last.remove();
}
// Paragraphs // Paragraphs
for (Element p : document.select("p")) { for (Element p : document.select("p")) {
p.appendElement("br"); p.appendElement("br");