mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-04 10:39:25 +00:00
Wrap images in paragraphs, cleanup
This commit is contained in:
parent
6c5dd6fb1e
commit
e9f1d31c34
1 changed files with 6 additions and 4 deletions
|
@ -55,10 +55,6 @@ public class HtmlHelper {
|
|||
private static final List<String> heads = Arrays.asList("p", "h1", "h2", "h3", "h4", "h5", "tr");
|
||||
private static final List<String> tails = Arrays.asList("br", "dd", "dt", "p", "h1", "h2", "h3", "h4", "h5");
|
||||
|
||||
static String getBody(String html) {
|
||||
return Jsoup.parse(html).body().html();
|
||||
}
|
||||
|
||||
static String sanitize(String html, boolean quotes) {
|
||||
Document document = Jsoup.parse(Jsoup.clean(html, Whitelist
|
||||
.relaxed()
|
||||
|
@ -86,6 +82,12 @@ public class HtmlHelper {
|
|||
}
|
||||
}
|
||||
|
||||
for (Element img : document.select("img")) {
|
||||
Element p = document.createElement("p");
|
||||
img.replaceWith(p);
|
||||
p.appendChild(img);
|
||||
}
|
||||
|
||||
if (!quotes)
|
||||
for (Element quote : document.select("blockquote"))
|
||||
quote.text("…");
|
||||
|
|
Loading…
Add table
Reference in a new issue