summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/html.c37
-rw-r--r--src/html.h3
2 files changed, 40 insertions, 0 deletions
diff --git a/src/html.c b/src/html.c
index 7ef43d0..96d3999 100644
--- a/src/html.c
+++ b/src/html.c
@@ -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;
diff --git a/src/html.h b/src/html.h
index 82affa8..cfbbbb9 100644
--- a/src/html.h
+++ b/src/html.h
@@ -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 *