diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/html.c | 34 | ||||
-rw-r--r-- | src/html.h | 6 |
2 files changed, 40 insertions, 0 deletions
@@ -70,6 +70,40 @@ mq_html_document(const gchar *title, ...) } gchar * +mq_html_p(gchar *text) +{ + gsize len; + gchar *p; + gchar *ptr; + + /* Calculate length. */ + len = strlen("<p>"); + len += strlen(text); + len += strlen("</p>\n"); + ++len; /* NUL byte */ + + /* Build string. */ + p = g_new(gchar, len); + ptr = g_stpcpy(p, "<p>"); + ptr = g_stpcpy(ptr, text); + ptr = g_stpcpy(ptr, "</p>\n"); /* g_stpcpy() adds the NUL. */ + + return p; +} + +gchar * +mq_html_p_free(gchar *text) +{ + gchar *p; + + p = mq_html_p(text); + + g_free(text); + + return p; +} + +gchar * mq_html_container(const gchar *element, ...) { gsize len; @@ -28,6 +28,12 @@ gchar * mq_html_document(const gchar *title, ...); gchar * +mq_html_p(gchar *text); + +gchar * +mq_html_p_free(gchar *text); + +gchar * mq_html_container(const gchar *element, ...); gchar * |