Backport from xs.

This commit is contained in:
default 2023-11-22 13:07:19 +01:00
parent 4e8beaab8f
commit 258850feac
3 changed files with 8 additions and 8 deletions

2
html.c
View file

@ -2270,7 +2270,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
xs_html_text(content)))); xs_html_text(content))));
} }
*body = _xs_html_render(rss, xs_dup("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")); *body = xs_html_render_s(rss, xs_dup("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"));
*b_size = strlen(*body); *b_size = strlen(*body);
*ctype = "application/rss+xml; charset=utf-8"; *ctype = "application/rss+xml; charset=utf-8";
status = 200; status = 200;

View file

@ -21,8 +21,8 @@ xs_html *_xs_html_tag(char *tag, xs_html *var[]);
xs_html *_xs_html_sctag(char *tag, xs_html *var[]); xs_html *_xs_html_sctag(char *tag, xs_html *var[]);
#define xs_html_sctag(tag, ...) _xs_html_sctag(tag, (xs_html *[]) { __VA_ARGS__, NULL }) #define xs_html_sctag(tag, ...) _xs_html_sctag(tag, (xs_html *[]) { __VA_ARGS__, NULL })
xs_str *_xs_html_render(xs_html *h, xs_str *s); xs_str *xs_html_render_s(xs_html *h, xs_str *s);
#define xs_html_render(h) _xs_html_render(h, xs_str_new(NULL)) #define xs_html_render(h) xs_html_render_s(h, xs_str_new(NULL))
#ifdef XS_IMPLEMENTATION #ifdef XS_IMPLEMENTATION
@ -187,8 +187,8 @@ xs_html *_xs_html_sctag(char *tag, xs_html *var[])
} }
xs_str *_xs_html_render(xs_html *h, xs_str *s) xs_str *xs_html_render_s(xs_html *h, xs_str *s)
/* renders the tag and its subtags */ /* renders the tag and its subtags into s */
{ {
xs_html *st; xs_html *st;
@ -201,7 +201,7 @@ xs_str *_xs_html_render(xs_html *h, xs_str *s)
st = h->f_attr; st = h->f_attr;
while (st) { while (st) {
xs_html *nst = st->next; xs_html *nst = st->next;
s = _xs_html_render(st, s); s = xs_html_render_s(st, s);
st = nst; st = nst;
} }
@ -216,7 +216,7 @@ xs_str *_xs_html_render(xs_html *h, xs_str *s)
st = h->f_tag; st = h->f_tag;
while (st) { while (st) {
xs_html *nst = st->next; xs_html *nst = st->next;
s = _xs_html_render(st, s); s = xs_html_render_s(st, s);
st = nst; st = nst;
} }

View file

@ -1 +1 @@
/* d9404322f5bad91811bc0ad13d63360b586919cc 2023-11-20T20:13:34+01:00 */ /* 2adde1fad4fabb223639e4002a7ff3ec8c1982d7 2023-11-22T13:05:51+01:00 */