JSON-LD primitives

pull/214/head
M66B 1 year ago
parent 1c4589533a
commit ea6e8ac2a8

@ -63,7 +63,7 @@ public class StructuredEmail {
Iterator<String> keys = jobject.keys(); Iterator<String> keys = jobject.keys();
while (keys.hasNext()) { while (keys.hasNext()) {
String key = keys.next(); String key = keys.next();
if (key == null || key.startsWith("@")) if (key == null)
continue; continue;
Object v = (jobject.isNull(key) ? "" : jobject.get(key)); Object v = (jobject.isNull(key) ? "" : jobject.get(key));
if (v instanceof JSONObject || v instanceof JSONArray) { if (v instanceof JSONObject || v instanceof JSONArray) {
@ -72,18 +72,6 @@ public class StructuredEmail {
.append('\n'); .append('\n');
getHtml(v, indent + 1, sb); getHtml(v, indent + 1, sb);
} else { } else {
if (v instanceof String) {
String s = (String) v;
if (s.startsWith("https://"))
try {
Uri uri = Uri.parse(s);
String p = uri.getPath();
if (!TextUtils.isEmpty(p))
v = split(p.substring(1));
} catch (Throwable ex) {
Log.w(ex);
}
}
sb.append(indent(indent)) sb.append(indent(indent))
.append(split(key)) .append(split(key))
.append(": ") .append(": ")
@ -95,6 +83,10 @@ public class StructuredEmail {
JSONArray jarray = (JSONArray) obj; JSONArray jarray = (JSONArray) obj;
for (int i = 0; i < jarray.length(); i++) for (int i = 0; i < jarray.length(); i++)
getHtml(jarray.get(i), indent + 1, sb); getHtml(jarray.get(i), indent + 1, sb);
} else {
sb.append(indent(indent))
.append(obj == null ? "" : obj.toString())
.append('\n');
} }
} }

Loading…
Cancel
Save