diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/html.c | 37 | ||||
-rw-r--r-- | src/html.h | 3 |
2 files changed, 40 insertions, 0 deletions
@@ -228,6 +228,43 @@ mq_html_list(const gchar *type, GDestroyNotify destroy, ...) } gchar * +mq_html_list_v(const gchar *type, gchar **children) +{ + gsize len; + gsize i; + gchar *list; + gchar *ptr; + + /* TODO: Doesn't support specification of <ol> list types. */ + + /* Calculate length. */ + len = strlen("<ul>\n"); + for (i = 0; children && children[i]; ++i) { + len += strlen("<li>\n"); + len += strlen(children[i]); + len += strlen("</li>\n"); + } + len += strlen("</ul>\n"); + ++len; /* NUL byte */ + + /* Build string. */ + list = g_new(gchar, len); + if (type && type[0]) { + ptr = g_stpcpy(list, "<ol>\n"); + } else { + ptr = g_stpcpy(list, "<ul>\n"); + } + for (i = 0; children && children[i]; ++i) { + ptr = g_stpcpy(ptr, "<li>\n"); + ptr = g_stpcpy(ptr, children[i]); + ptr = g_stpcpy(ptr, "</li>\n"); + } + ptr = g_stpcpy(ptr, "</ul>\n"); /* g_stpcpy() adds the NUL. */ + + return list; +} + +gchar * mq_html_container(const gchar *element, ...) { gsize len; @@ -46,6 +46,9 @@ gchar * mq_html_list(const gchar *type, GDestroyNotify destroy, ...); gchar * +mq_html_list_v(const gchar *type, gchar **children); + +gchar * mq_html_notebook(gboolean vertical, const gchar *name, guint current_page, ...); gchar * |