Simplify addresses/links in plain text

pull/175/head
M66B 6 years ago
parent 0abf36ac0c
commit 203854603f

@ -1209,9 +1209,14 @@ public class HtmlHelper {
public void tail(Node node, int depth) { public void tail(Node node, int depth) {
String name = node.nodeName(); String name = node.nodeName();
if ("a".equals(name)) if ("a".equals(name)) {
String addr = node.attr("href").toLowerCase();
if (addr.startsWith("mailto:"))
addr = addr.substring("mailto:".length());
String text = ((Element) node).text().toLowerCase();
if (!text.contains(addr))
append("[" + node.attr("href") + "]"); append("[" + node.attr("href") + "]");
else if ("img".equals(name)) } else if ("img".equals(name))
append("[" + node.attr("src") + "]"); append("[" + node.attr("src") + "]");
else if ("th".equals(name) || "td".equals(name)) { else if ("th".equals(name) || "td".equals(name)) {
Node next = node.nextSibling(); Node next = node.nextSibling();

Loading…
Cancel
Save