From fb03a1da129a6569a8e19dd5a2f49fe5caef6f3e Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 6 Nov 2020 14:40:43 +0100 Subject: [PATCH] Symmetry --- app/src/main/java/eu/faircode/email/HtmlHelper.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index f4e95ebc38..2d135fddb8 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -746,13 +746,16 @@ public class HtmlHelper { } // Remove trailing br from div - for (Element div : document.select("div")) - if (div.children().select("div").size() == 0 && + for (Element div : document.select("div")) { + boolean inline = Boolean.parseBoolean(div.attr("x-inline")); + if (!inline && + div.children().select("div").size() == 0 && hasVisibleContent(div)) { Element last = div.lastElementSibling(); if (last != null && "br".equals(last.tagName())) last.remove(); } + } // Replace headings if (!text_size) @@ -1013,7 +1016,9 @@ public class HtmlHelper { // Selective new lines for (Element div : document.select("div")) { boolean inline = Boolean.parseBoolean(div.attr("x-inline")); - if (!inline && hasVisibleContent(div)) + if (!inline && + div.children().select("div").size() == 0 && + hasVisibleContent(div)) div.attr("x-line-after", "true"); div.tagName("span"); }