1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-04 06:20:26 +00:00

Paragraph fixes

This commit is contained in:
M66B 2020-11-07 18:14:15 +01:00
parent 255aa78913
commit 77c41d5ad0

View file

@ -754,7 +754,8 @@ public class HtmlHelper {
// Paragraphs // Paragraphs
for (Element p : document.select("p")) { for (Element p : document.select("p")) {
p.attr("x-paragraph", "true"); if (p.childNodeSize() != 0)
p.attr("x-paragraph", "true");
p.tagName("div"); p.tagName("div");
} }
@ -2045,7 +2046,7 @@ public class HtmlHelper {
text = block.get(i).getWholeText(); text = block.get(i).getWholeText();
for (int j = 0; j < text.length(); j++) { for (int j = 0; j < text.length(); j++) {
char kar = text.charAt(j); char kar = text.charAt(j);
if (WHITESPACE.indexOf(kar) < 0 && kar != '\u00a0' /* nbsp */) { if (WHITESPACE.indexOf(kar) < 0) {
blank = false; blank = false;
break; break;
} }
@ -2093,7 +2094,8 @@ public class HtmlHelper {
if (ssb.length() > 1 && ssb.charAt(ssb.length() - 1) != '\n') if (ssb.length() > 1 && ssb.charAt(ssb.length() - 1) != '\n')
ssb.append('\n'); ssb.append('\n');
if ("true".equals(element.attr("x-paragraph"))) if ("true".equals(element.attr("x-paragraph")) &&
!"false".equals(element.attr("x-line-before")))
if (ssb.length() > 2 && if (ssb.length() > 2 &&
(ssb.charAt(ssb.length() - 2) != '\n' || (ssb.charAt(ssb.length() - 2) != '\n' ||
ssb.charAt(ssb.length() - 1) != '\n')) ssb.charAt(ssb.length() - 1) != '\n'))
@ -2356,7 +2358,8 @@ public class HtmlHelper {
if (ssb.length() > 1 && ssb.charAt(ssb.length() - 1) != '\n') if (ssb.length() > 1 && ssb.charAt(ssb.length() - 1) != '\n')
ssb.append('\n'); ssb.append('\n');
if ("true".equals(element.attr("x-paragraph"))) if ("true".equals(element.attr("x-paragraph")) &&
!"false".equals(element.attr("x-line-after")))
if (ssb.length() > 2 && if (ssb.length() > 2 &&
(ssb.charAt(ssb.length() - 2) != '\n' || (ssb.charAt(ssb.length() - 2) != '\n' ||
ssb.charAt(ssb.length() - 1) != '\n')) ssb.charAt(ssb.length() - 1) != '\n'))