diff options
| -rw-r--r-- | html.c | 34 |
1 files changed, 21 insertions, 13 deletions
| @@ -1692,7 +1692,8 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head | |||
| 1692 | xs *s = xs_str_new(NULL); | 1692 | xs *s = xs_str_new(NULL); |
| 1693 | xs *es1 = encode_html(header); | 1693 | xs *es1 = encode_html(header); |
| 1694 | xs *h = xs_fmt("<h2 class=\"snac-header\">%s</h2>\n", es1); | 1694 | xs *h = xs_fmt("<h2 class=\"snac-header\">%s</h2>\n", es1); |
| 1695 | char *p, *actor_id; | 1695 | xs_list *p; |
| 1696 | char *actor_id; | ||
| 1696 | 1697 | ||
| 1697 | s = xs_str_cat(s, h); | 1698 | s = xs_str_cat(s, h); |
| 1698 | 1699 | ||
| @@ -1704,31 +1705,38 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head | |||
| 1704 | xs *actor = NULL; | 1705 | xs *actor = NULL; |
| 1705 | 1706 | ||
| 1706 | if (valid_status(actor_get(actor_id, &actor))) { | 1707 | if (valid_status(actor_get(actor_id, &actor))) { |
| 1707 | s = xs_str_cat(s, "<div class=\"snac-post\">\n<div class=\"snac-post-header\">\n"); | 1708 | s = xs_str_cat(s, "<div class=\"snac-post\">\n"); |
| 1709 | |||
| 1710 | xs_html *snac_post_header = xs_html_tag("div", | ||
| 1711 | xs_html_attr("class", "snac-post-header"), | ||
| 1712 | html_actor_icon(actor, xs_dict_get(actor, "published"), NULL, NULL, 0)); | ||
| 1708 | 1713 | ||
| 1709 | { | 1714 | { |
| 1710 | xs_html *actor_icon = html_actor_icon(actor, | 1715 | xs *s1 = xs_html_render(snac_post_header); |
| 1711 | xs_dict_get(actor, "published"), NULL, NULL, 0); | 1716 | s = xs_str_cat(s, s1); |
| 1712 | xs *s1 = xs_html_render(actor_icon); | ||
| 1713 | s = xs_str_cat(s, s1, "</div>\n"); | ||
| 1714 | } | 1717 | } |
| 1715 | 1718 | ||
| 1716 | /* content (user bio) */ | 1719 | /* content (user bio) */ |
| 1717 | char *c = xs_dict_get(actor, "summary"); | 1720 | char *c = xs_dict_get(actor, "summary"); |
| 1718 | 1721 | ||
| 1719 | if (!xs_is_null(c)) { | 1722 | if (!xs_is_null(c)) { |
| 1720 | s = xs_str_cat(s, "<div class=\"snac-content\">\n"); | ||
| 1721 | |||
| 1722 | xs *sc = sanitize(c); | 1723 | xs *sc = sanitize(c); |
| 1723 | 1724 | ||
| 1725 | xs_html *snac_content = xs_html_tag("div", | ||
| 1726 | xs_html_attr("class", "snac-content")); | ||
| 1727 | |||
| 1724 | if (xs_startswith(sc, "<p>")) | 1728 | if (xs_startswith(sc, "<p>")) |
| 1725 | s = xs_str_cat(s, sc); | 1729 | xs_html_add(snac_content, |
| 1726 | else { | 1730 | xs_html_raw(sc)); /* already sanitized */ |
| 1727 | xs *s1 = xs_fmt("<p>%s</p>", sc); | 1731 | else |
| 1732 | xs_html_add(snac_content, | ||
| 1733 | xs_html_tag("p", | ||
| 1734 | xs_html_raw(sc))); /* already sanitized */ | ||
| 1735 | |||
| 1736 | { | ||
| 1737 | xs *s1 = xs_html_render(snac_content); | ||
| 1728 | s = xs_str_cat(s, s1); | 1738 | s = xs_str_cat(s, s1); |
| 1729 | } | 1739 | } |
| 1730 | |||
| 1731 | s = xs_str_cat(s, "</div>\n"); | ||
| 1732 | } | 1740 | } |
| 1733 | 1741 | ||
| 1734 | 1742 | ||