|
|
|
@ -1010,7 +1010,27 @@ public class HtmlHelper {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Autolink
|
|
|
|
|
if (view) {
|
|
|
|
|
if (view)
|
|
|
|
|
autoLink(document);
|
|
|
|
|
|
|
|
|
|
// Selective new lines
|
|
|
|
|
for (Element div : document.select("div"))
|
|
|
|
|
div.tagName("span");
|
|
|
|
|
|
|
|
|
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
|
|
|
|
|
for (Element span : document.select("span"))
|
|
|
|
|
if (!TextUtils.isEmpty(span.attr("color")))
|
|
|
|
|
span.tagName("font");
|
|
|
|
|
|
|
|
|
|
if (document.body() == null) {
|
|
|
|
|
Log.e("Sanitize without body");
|
|
|
|
|
document.normalise();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return document;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void autoLink(Document document) {
|
|
|
|
|
// https://en.wikipedia.org/wiki/List_of_URI_schemes
|
|
|
|
|
// xmpp:[<user>]@<host>[:<port>]/[<resource>][?<query>]
|
|
|
|
|
// geo:<lat>,<lon>[,<alt>][;u=<uncertainty>]
|
|
|
|
@ -1100,23 +1120,6 @@ public class HtmlHelper {
|
|
|
|
|
}, document);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Selective new lines
|
|
|
|
|
for (Element div : document.select("div"))
|
|
|
|
|
div.tagName("span");
|
|
|
|
|
|
|
|
|
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
|
|
|
|
|
for (Element span : document.select("span"))
|
|
|
|
|
if (!TextUtils.isEmpty(span.attr("color")))
|
|
|
|
|
span.tagName("font");
|
|
|
|
|
|
|
|
|
|
if (document.body() == null) {
|
|
|
|
|
Log.e("Sanitize without body");
|
|
|
|
|
document.normalise();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return document;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void normalizeNamespaces(Document parsed, boolean display_hidden) {
|
|
|
|
|
// <html xmlns:v="urn:schemas-microsoft-com:vml"
|
|
|
|
|
// xmlns:o="urn:schemas-microsoft-com:office:office"
|
|
|
|
|