summaryrefslogtreecommitdiffstats
path: root/src/utils/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/html.c')
-rw-r--r--src/utils/html.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/utils/html.c b/src/utils/html.c
index 5ee7313..936ba05 100644
--- a/src/utils/html.c
+++ b/src/utils/html.c
@@ -194,7 +194,8 @@ static const gchar *global_styles =
;
gchar *
-mq_html_document(const gchar *title, const gchar *styles, ...)
+mq_html_document(const gchar *title, const gchar *styles,
+ const gchar *head_tags, ...)
{
gsize len;
va_list ap;
@@ -210,8 +211,12 @@ mq_html_document(const gchar *title, const gchar *styles, ...)
len += strlen("</title>\n<style>\n");
len += strlen(global_styles);
len += strlen(styles);
- len += strlen("</style>\n</head>\n<body>\n");
- va_start(ap, styles);
+ len += strlen("</style>\n");
+ if (head_tags) {
+ len += strlen(head_tags);
+ }
+ len += strlen("</head>\n<body>\n");
+ va_start(ap, head_tags);
while ((child = va_arg(ap, gchar *))) {
len += strlen(child);
}
@@ -229,8 +234,12 @@ mq_html_document(const gchar *title, const gchar *styles, ...)
ptr = g_stpcpy(ptr, "</title>\n<style>\n");
ptr = g_stpcpy(ptr, global_styles);
ptr = g_stpcpy(ptr, styles);
- ptr = g_stpcpy(ptr, "</style>\n</head>\n<body>\n");
- va_start(ap, styles);
+ ptr = g_stpcpy(ptr, "</style>\n");
+ if (head_tags) {
+ ptr = g_stpcpy(ptr, head_tags);
+ }
+ ptr = g_stpcpy(ptr, "</head>\n<body>\n");
+ va_start(ap, head_tags);
while ((child = va_arg(ap, gchar *))) {
ptr = g_stpcpy(ptr, child);
g_free(child);
@@ -242,7 +251,8 @@ mq_html_document(const gchar *title, const gchar *styles, ...)
}
gchar *
-mq_html_document_v(const gchar *title, const gchar *styles, gchar **children)
+mq_html_document_v(const gchar *title, const gchar *styles,
+ const gchar *head_tags, gchar **children)
{
gsize len;
gsize i;
@@ -257,7 +267,11 @@ mq_html_document_v(const gchar *title, const gchar *styles, gchar **children)
len += strlen("</title>\n<style>\n");
len += strlen(global_styles);
len += strlen(styles);
- len += strlen("</style>\n</head>\n<body>\n");
+ len += strlen("</style>\n");
+ if (head_tags) {
+ len += strlen(head_tags);
+ }
+ len += strlen("</head>\n<body>\n");
for (i = 0; children && children[i]; ++i) {
len += strlen(children[i]);
}
@@ -274,7 +288,11 @@ mq_html_document_v(const gchar *title, const gchar *styles, gchar **children)
ptr = g_stpcpy(ptr, "</title>\n<style>\n");
ptr = g_stpcpy(ptr, global_styles);
ptr = g_stpcpy(ptr, styles);
- ptr = g_stpcpy(ptr, "</style>\n</head>\n<body>\n");
+ ptr = g_stpcpy(ptr, "</style>\n");
+ if (head_tags) {
+ ptr = g_stpcpy(ptr, head_tags);
+ }
+ ptr = g_stpcpy(ptr, "</head>\n<body>\n");
for (i = 0; children && children[i]; ++i) {
ptr = g_stpcpy(ptr, children[i]);
}