Experiment: application/ld+json

pull/214/head
M66B 8 months ago
parent cd6f7f2624
commit 654dfd1291

@ -146,6 +146,7 @@ import androidx.webkit.WebViewFeature;
import com.google.android.material.snackbar.Snackbar;
import org.json.JSONObject;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
@ -3164,6 +3165,20 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
args.putBoolean("has_amp", has_amp);
// Check for structured email
// https://structured.email/content/introduction/getting_started.html
if (BuildConfig.DEBUG)
for (Element struct : document.select("script[type=application/ld+json]"))
try {
JSONObject jstruct = new JSONObject(struct.html());
document.body()
.appendElement("pre")
.attr("style", "font-size: smaller !important;")
.text(jstruct.toString(2));
} catch (Throwable ex) {
Log.w(ex);
}
// Format message
if (show_full) {
if (HtmlHelper.truncate(document, HtmlHelper.MAX_FULL_TEXT_SIZE)) {

Loading…
Cancel
Save