From 99544bf77226f2889bb1969eea440b2c8716b814 Mon Sep 17 00:00:00 2001 From: grunfink Date: Fri, 21 Aug 2026 17:14:02 +0200 Subject: New function xs_html_xtag(). --- xs_html.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'xs_html.h') diff --git a/xs_html.h b/xs_html.h index ab77499..b3c7224 100644 --- a/xs_html.h +++ b/xs_html.h @@ -24,6 +24,9 @@ xs_html *_xs_html_sctag(const char *tag, xs_html *var[]); xs_html *_xs_html_container(xs_html *var[]); #define xs_html_container(...) _xs_html_container((xs_html *[]) { __VA_ARGS__, NULL }) +xs_html *_xs_html_xtag(const char *tag, xs_html *var[]); +#define xs_html_xtag(tag, ...) _xs_html_xtag(tag, (xs_html *[]) { __VA_ARGS__, NULL }) + void xs_html_render_f(xs_html *h, FILE *f); xs_str *xs_html_render_s(xs_html *tag, const char *prefix); #define xs_html_render(tag) xs_html_render_s(tag, NULL) @@ -187,6 +190,20 @@ xs_html *_xs_html_container(xs_html *var[]) } +xs_html *_xs_html_xtag(const char *tag, xs_html *var[]) +{ + if (xs_is_null(tag)) + return _xs_html_container(var); + else + if (xs_endswith(tag, "/")) { + xs *tag2 = xs_crop_i(xs_dup(tag), 0, -1); + return _xs_html_sctag(tag2, var); + } + + return _xs_html_tag(tag, var); +} + + void xs_html_render_f(xs_html *h, FILE *f) /* renders the tag and its subtags into a file */ { -- cgit