commit cda6bc9
green
·
2025-05-12 17:08:03 +0000 UTC
parent 20f8972
metadata: quick fix for <p> tags
1 files changed,
+13,
-3
M
html.c
M
html.c
+13,
-3
1@@ -3338,10 +3338,11 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c
2
3 /* content (user bio) */
4 const char *c = xs_dict_get(actor, "summary");
5+ const xs_val *tag = xs_dict_get(actor, "tag");
6
7 if (!xs_is_null(c)) {
8 xs *sc = sanitize(c);
9- sc = replace_shortnames(sc, xs_dict_get(actor, "tag"), 2, proxy);
10+ sc = replace_shortnames(sc, tag, 2, proxy);
11
12 xs_html *snac_content = xs_html_tag("div",
13 xs_html_attr("class", "snac-content"));
14@@ -3371,13 +3372,22 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c
15
16 if (!xs_is_null(type) && !xs_is_null(name) &&
17 !xs_is_null(value) && strcmp(type, "PropertyValue") == 0) {
18+ /* both the name and the value can contain emoji */
19+ xs *nam = sanitize(name);
20+ nam = replace_shortnames(nam, tag, 1, proxy);
21+
22+ /* todo: sometimes the value is transmitted as markdown and not html ._. */
23 xs *val = sanitize(value);
24- val = replace_shortnames(val, xs_dict_get(actor, "tag"), 1, proxy);
25+ val = replace_shortnames(val, tag, 1, proxy);
26+
27+ /* delete <p> tags, because some software sends them */
28+ val = xs_replace_i(val, "<p>", "");
29+ val = xs_replace_i(val, "</p>", "");
30
31 xs_html_add(snac_metadata,
32 xs_html_tag("span",
33 xs_html_attr("class", "snac-property-name"),
34- xs_html_text(name)),
35+ xs_html_raw(nam)),
36 xs_html_text(":"),
37 xs_html_raw(" "),
38 xs_html_tag("span",