|
|
@ -36,6 +36,7 @@ import org.jsoup.nodes.Element;
|
|
|
|
import org.jsoup.nodes.Node;
|
|
|
|
import org.jsoup.nodes.Node;
|
|
|
|
import org.jsoup.nodes.TextNode;
|
|
|
|
import org.jsoup.nodes.TextNode;
|
|
|
|
import org.jsoup.safety.Whitelist;
|
|
|
|
import org.jsoup.safety.Whitelist;
|
|
|
|
|
|
|
|
import org.jsoup.select.Elements;
|
|
|
|
import org.jsoup.select.NodeTraversor;
|
|
|
|
import org.jsoup.select.NodeTraversor;
|
|
|
|
import org.jsoup.select.NodeVisitor;
|
|
|
|
import org.jsoup.select.NodeVisitor;
|
|
|
|
|
|
|
|
|
|
|
@ -72,11 +73,21 @@ public class HtmlHelper {
|
|
|
|
.addProtocols("img", "src", "data")));
|
|
|
|
.addProtocols("img", "src", "data")));
|
|
|
|
|
|
|
|
|
|
|
|
for (Element td : document.select("th,td")) {
|
|
|
|
for (Element td : document.select("th,td")) {
|
|
|
|
|
|
|
|
Elements br = td.select("br");
|
|
|
|
|
|
|
|
br.after(" ");
|
|
|
|
|
|
|
|
br.remove();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Elements div = td.select("div");
|
|
|
|
|
|
|
|
div.tagName("span");
|
|
|
|
|
|
|
|
|
|
|
|
Element next = td.nextElementSibling();
|
|
|
|
Element next = td.nextElementSibling();
|
|
|
|
if (next != null && ("th".equals(next.tagName()) || "td".equals(next.tagName())))
|
|
|
|
if (next != null && ("th".equals(next.tagName()) || "td".equals(next.tagName())))
|
|
|
|
td.append("<span> </span>");
|
|
|
|
td.append(" ");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
td.append("<br>");
|
|
|
|
td.append("<br>");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("th".equals(td.tagName()))
|
|
|
|
|
|
|
|
td.html("<strong>" + td.html() + "<strong>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (Element ol : document.select("ol,ul"))
|
|
|
|
for (Element ol : document.select("ol,ul"))
|
|
|
|