diff options
| -rw-r--r-- | html.c | 26 |
1 files changed, 26 insertions, 0 deletions
| @@ -481,6 +481,32 @@ xs_str *html_user_header(snac *snac, xs_str *s, int local) | |||
| 481 | xs *s1 = xs_fmt("<div class=\"p-note snac-top-user-bio\">%s</div>\n", bio2); | 481 | xs *s1 = xs_fmt("<div class=\"p-note snac-top-user-bio\">%s</div>\n", bio2); |
| 482 | 482 | ||
| 483 | s = xs_str_cat(s, s1); | 483 | s = xs_str_cat(s, s1); |
| 484 | |||
| 485 | xs_dict *metadata = xs_dict_get(snac->config, "metadata"); | ||
| 486 | if (xs_type(metadata) == XSTYPE_DICT) { | ||
| 487 | xs_str *k; | ||
| 488 | xs_str *v; | ||
| 489 | |||
| 490 | s = xs_str_cat(s, "<br><div class=\"snac-metadata\">\n"); | ||
| 491 | |||
| 492 | while (xs_dict_iter(&metadata, &k, &v)) { | ||
| 493 | xs *k2 = encode_html(k); | ||
| 494 | xs *v2 = encode_html(v); | ||
| 495 | xs *v3 = NULL; | ||
| 496 | |||
| 497 | if (xs_startswith(v, "https:/" "/")) | ||
| 498 | v3 = xs_fmt("<a href=\"%s\">%s</a>", v2, v2); | ||
| 499 | else | ||
| 500 | v3 = xs_dup(v2); | ||
| 501 | |||
| 502 | xs *s1 = xs_fmt("<span class=\"snac-property-name\">%s</span>:<br>" | ||
| 503 | "<span class=\"snac-property-value\">%s</span><br>\n", k2, v3); | ||
| 504 | |||
| 505 | s = xs_str_cat(s, s1); | ||
| 506 | } | ||
| 507 | |||
| 508 | s = xs_str_cat(s, "</div>\n"); | ||
| 509 | } | ||
| 484 | } | 510 | } |
| 485 | 511 | ||
| 486 | s = xs_str_cat(s, "</div>\n"); | 512 | s = xs_str_cat(s, "</div>\n"); |