diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-01 16:34:12 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-01 16:34:12 (EDT) |
commit | e359f93c06bb9258ceea1c420d033289e2e56a78 (patch) | |
tree | a28ace9a5098d164dd9166af90201672c285cf96 /src | |
parent | 1928d91553265b9735ee16310de5ea8de051b119 (diff) | |
download | marquee-e359f93c06bb9258ceea1c420d033289e2e56a78.zip marquee-e359f93c06bb9258ceea1c420d033289e2e56a78.tar.gz marquee-e359f93c06bb9258ceea1c420d033289e2e56a78.tar.bz2 |
mq_html_list_v(): New function
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 * |