diff options
| author | grunfink <grunfink@comam.es> | 2026-08-21 17:14:02 +0200 |
|---|---|---|
| committer | grunfink <grunfink@comam.es> | 2026-08-21 17:14:02 +0200 |
| commit | 99544bf77226f2889bb1969eea440b2c8716b814 (patch) | |
| tree | 940a2e7455d00ae4cef0a6f169333eb579d6aa5c /xs_html.h | |
| parent | 4f27bb07085ab90787870a4422176f29823a798d (diff) | |
New function xs_html_xtag().
Diffstat (limited to 'xs_html.h')
| -rw-r--r-- | xs_html.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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 */ { |