|
|
|
@ -120,37 +120,6 @@ public class HtmlHelper {
|
|
|
|
|
for (Element quote : document.select("blockquote"))
|
|
|
|
|
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
|
|
|
|
|
for (Element q : document.select("q")) {
|
|
|
|
|
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
|
|
|
|
|
NodeTraversor.traverse(new NodeVisitor() {
|
|
|
|
|
@Override
|
|
|
|
|