From f1c535f86cf7a172ad505dee242634922dd3907e Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 11 Sep 2019 22:52:15 +0200 Subject: [PATCH] Selective line breaking --- app/src/main/java/eu/faircode/email/HtmlHelper.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index 16b502ff0a..f74f07ef40 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -210,7 +210,7 @@ public class HtmlHelper { for (Element col : document.select("th,td")) { boolean content = false; for (Node node : col.childNodes()) - if (node instanceof TextNode) { + if (node instanceof TextNode && !((TextNode) node).isBlank()) { content = true; break; } else if (node instanceof Element) { @@ -237,7 +237,7 @@ public class HtmlHelper { for (Element row : document.select("tr")) row.tagName("span"); - document.select("caption").tagName("p"); + document.select("caption").tagName("div"); for (Element table : document.select("table")) if (table.parent() != null && "a".equals(table.parent().tagName())) @@ -363,13 +363,13 @@ public class HtmlHelper { if (e.isBlock() && !hasContent(e)) e.remove(); - // Prevent too many line breaks - for (Element div : document.select("div")) { + // Selective line breaking + for (Element div : document.select("div,p")) { div.tagName("span"); boolean content = false; for (Node child : div.childNodes()) - if (child instanceof TextNode || + if ((child instanceof TextNode && !((TextNode) child).isBlank()) || (child instanceof Element && "img".equals(child.nodeName()))) { content = true; break;