summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-11-28 18:56:06 +0100
committerGravatar default2023-11-28 18:56:06 +0100
commitd00ee229f7f6df494cc1070be7c31337922cf5c2 (patch)
tree98ff846d934a34ed508c4956d668effc8cc7dd92
parentFixed poll xs_html. (diff)
downloadsnac2-d00ee229f7f6df494cc1070be7c31337922cf5c2.tar.gz
snac2-d00ee229f7f6df494cc1070be7c31337922cf5c2.tar.xz
snac2-d00ee229f7f6df494cc1070be7c31337922cf5c2.zip
More html_entry() tweaks.
-rw-r--r--html.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/html.c b/html.c
index 3461bfa..5556d89 100644
--- a/html.c
+++ b/html.c
@@ -1639,9 +1639,11 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
1639#endif 1639#endif
1640 1640
1641 { 1641 {
1642 const char *content = xs_dict_get(msg, "content"); 1642 /** build the content string **/
1643 1643
1644 xs *c = sanitize(xs_is_null(content) ? "" : content); 1644 char *content = xs_dict_get(msg, "content");
1645
1646 xs *c = sanitize(xs_is_null(content) ? "" : content);
1645 char *p, *v; 1647 char *p, *v;
1646 1648
1647 /* do some tweaks to the content */ 1649 /* do some tweaks to the content */
@@ -1693,6 +1695,9 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
1693 } 1695 }
1694 } 1696 }
1695 1697
1698 /* c contains sanitized HTML */
1699 s = xs_str_cat(s, c);
1700
1696 if (strcmp(type, "Question") == 0) { /** question content **/ 1701 if (strcmp(type, "Question") == 0) { /** question content **/
1697 xs_list *oo = xs_dict_get(msg, "oneOf"); 1702 xs_list *oo = xs_dict_get(msg, "oneOf");
1698 xs_list *ao = xs_dict_get(msg, "anyOf"); 1703 xs_list *ao = xs_dict_get(msg, "anyOf");
@@ -1821,10 +1826,8 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
1821 } 1826 }
1822 1827
1823 xs *s1 = xs_html_render(poll); 1828 xs *s1 = xs_html_render(poll);
1824 c = xs_str_cat(c, s1); 1829 s = xs_str_cat(s, s1);
1825 } 1830 }
1826
1827 s = xs_str_cat(s, c);
1828 } 1831 }
1829 1832
1830 s = xs_str_cat(s, "\n"); 1833 s = xs_str_cat(s, "\n");