diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2026-09-02 19:50:00 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2026-09-02 19:50:00 +0200 |
| commit | a676bd58a875383b072293976e521ba7af8f34e8 (patch) | |
| tree | 43920e9b611bb1a4ade8f5f783b88435440792ba /xs_html.h | |
| parent | 15d4dfc538dce7bfce4b0926b77f7f200cca99ff (diff) | |
| parent | 32ce0553e373cb03c690a854e1b629aa10f3ade9 (diff) | |
Merge branch 'master' of https://codeberg.org/grunfink/snac2
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 */ { |