Reduced white space

This commit is contained in:
M66B 2019-03-30 17:48:04 +01:00
parent b4160a73f7
commit a4a2ded09f
1 changed files with 30 additions and 31 deletions

View File

@ -120,37 +120,6 @@ public class HtmlHelper {
for (Element quote : document.select("blockquote")) for (Element quote : document.select("blockquote"))
quote.html("…"); quote.html("…");
// Tables
for (Element col : document.select("th,td")) {
// prevent line breaks
//col.select("br").tagName("span").html(" ");
//col.select("div").tagName("span");
// separate columns by a space
if (col.nextElementSibling() != null)
col.append(" ");
if ("th".equals(col.tagName()))
col.tagName("strong");
else
col.tagName("span");
}
for (Element row : document.select("tr"))
row.tagName("span").appendElement("br");
document.select("caption").tagName("p");
document.select("table").tagName("div");
// Lists
for (Element li : document.select("li")) {
li.tagName("span");
li.prependText("* ");
li.appendElement("br"); // line break after list item
}
document.select("ol").tagName("div");
document.select("ul").tagName("div");
// Short quotes // Short quotes
for (Element q : document.select("q")) { for (Element q : document.select("q")) {
q.prependText("\""); q.prependText("\"");
@ -260,6 +229,36 @@ public class HtmlHelper {
} }
} }
// Tables
for (Element col : document.select("th,td")) {
// separate columns by a space
if (col.nextElementSibling() == null) {
if (col.selectFirst("div") == null)
col.appendElement("br");
} else
col.append(" ");
if ("th".equals(col.tagName()))
col.tagName("strong");
else
col.tagName("span");
}
for (Element row : document.select("tr"))
row.tagName("span");
document.select("caption").tagName("p");
document.select("table").tagName("div");
// Lists
for (Element li : document.select("li")) {
li.tagName("span");
li.prependText("* ");
li.appendElement("br"); // line break after list item
}
document.select("ol").tagName("div");
document.select("ul").tagName("div");
// Autolink // Autolink
NodeTraversor.traverse(new NodeVisitor() { NodeTraversor.traverse(new NodeVisitor() {
@Override @Override