summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/html.c34
-rw-r--r--src/html.h6
2 files changed, 40 insertions, 0 deletions
diff --git a/src/html.c b/src/html.c
index 0a0bd40..0425dfe 100644
--- a/src/html.c
+++ b/src/html.c
@@ -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;
diff --git a/src/html.h b/src/html.h
index d0bd8db..0aeefc0 100644
--- a/src/html.h
+++ b/src/html.h
@@ -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 *