diff options
| author | 2025-05-12 19:08:03 +0200 | |
|---|---|---|
| committer | 2025-11-14 17:21:43 +0100 | |
| commit | cda6bc96a57b0829425af96bba28368f70c184e4 (patch) | |
| tree | 264a6419f00399e089ca1031efb39ced63496a5a /html.c | |
| parent | metadata for remote users in people page (diff) | |
| download | snac2-cda6bc96a57b0829425af96bba28368f70c184e4.tar.gz snac2-cda6bc96a57b0829425af96bba28368f70c184e4.tar.xz snac2-cda6bc96a57b0829425af96bba28368f70c184e4.zip | |
metadata: quick fix for <p> tags
Diffstat (limited to '')
| -rw-r--r-- | html.c | 16 |
1 files changed, 13 insertions, 3 deletions
| @@ -3338,10 +3338,11 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c | |||
| 3338 | 3338 | ||
| 3339 | /* content (user bio) */ | 3339 | /* content (user bio) */ |
| 3340 | const char *c = xs_dict_get(actor, "summary"); | 3340 | const char *c = xs_dict_get(actor, "summary"); |
| 3341 | const xs_val *tag = xs_dict_get(actor, "tag"); | ||
| 3341 | 3342 | ||
| 3342 | if (!xs_is_null(c)) { | 3343 | if (!xs_is_null(c)) { |
| 3343 | xs *sc = sanitize(c); | 3344 | xs *sc = sanitize(c); |
| 3344 | sc = replace_shortnames(sc, xs_dict_get(actor, "tag"), 2, proxy); | 3345 | sc = replace_shortnames(sc, tag, 2, proxy); |
| 3345 | 3346 | ||
| 3346 | xs_html *snac_content = xs_html_tag("div", | 3347 | xs_html *snac_content = xs_html_tag("div", |
| 3347 | xs_html_attr("class", "snac-content")); | 3348 | xs_html_attr("class", "snac-content")); |
| @@ -3371,13 +3372,22 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c | |||
| 3371 | 3372 | ||
| 3372 | if (!xs_is_null(type) && !xs_is_null(name) && | 3373 | if (!xs_is_null(type) && !xs_is_null(name) && |
| 3373 | !xs_is_null(value) && strcmp(type, "PropertyValue") == 0) { | 3374 | !xs_is_null(value) && strcmp(type, "PropertyValue") == 0) { |
| 3375 | /* both the name and the value can contain emoji */ | ||
| 3376 | xs *nam = sanitize(name); | ||
| 3377 | nam = replace_shortnames(nam, tag, 1, proxy); | ||
| 3378 | |||
| 3379 | /* todo: sometimes the value is transmitted as markdown and not html ._. */ | ||
| 3374 | xs *val = sanitize(value); | 3380 | xs *val = sanitize(value); |
| 3375 | val = replace_shortnames(val, xs_dict_get(actor, "tag"), 1, proxy); | 3381 | val = replace_shortnames(val, tag, 1, proxy); |
| 3382 | |||
| 3383 | /* delete <p> tags, because some software sends them */ | ||
| 3384 | val = xs_replace_i(val, "<p>", ""); | ||
| 3385 | val = xs_replace_i(val, "</p>", ""); | ||
| 3376 | 3386 | ||
| 3377 | xs_html_add(snac_metadata, | 3387 | xs_html_add(snac_metadata, |
| 3378 | xs_html_tag("span", | 3388 | xs_html_tag("span", |
| 3379 | xs_html_attr("class", "snac-property-name"), | 3389 | xs_html_attr("class", "snac-property-name"), |
| 3380 | xs_html_text(name)), | 3390 | xs_html_raw(nam)), |
| 3381 | xs_html_text(":"), | 3391 | xs_html_text(":"), |
| 3382 | xs_html_raw(" "), | 3392 | xs_html_raw(" "), |
| 3383 | xs_html_tag("span", | 3393 | xs_html_tag("span", |