diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-01 06:02:27 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-01 06:02:27 (EDT) |
commit | ed885e115eb844d3be8bc88081a1af092a13bb06 (patch) | |
tree | f95d576d644d82fbaf696d04ea220e93935a42a9 /src | |
parent | 1ecfb7a5aa35a3ccf91486b8292ac6efb5c0d1d0 (diff) | |
download | marquee-ed885e115eb844d3be8bc88081a1af092a13bb06.zip marquee-ed885e115eb844d3be8bc88081a1af092a13bb06.tar.gz marquee-ed885e115eb844d3be8bc88081a1af092a13bb06.tar.bz2 |
mq_html_h*(): New functions
Declare and define them all with macros.
Diffstat (limited to 'src')
-rw-r--r-- | src/html.c | 39 | ||||
-rw-r--r-- | src/html.h | 18 |
2 files changed, 35 insertions, 22 deletions
@@ -162,23 +162,28 @@ mq_html_document(const gchar *title, ...) return document; } -gchar * -mq_html_p(gchar *text) -{ - return g_strconcat("<p>", text, "</p>", NULL); -} - -gchar * -mq_html_p_free(gchar *text) -{ - gchar *p; - - p = g_strconcat("<p>", text, "</p>", NULL); - - g_free(text); - - return p; -} +#define TEXT_ELEMENT(ELEM) \ + gchar * \ + mq_html_##ELEM(gchar *text) \ + { \ + return g_strconcat("<" #ELEM ">", text, "</" #ELEM ">", NULL); \ + } \ + gchar * \ + mq_html_##ELEM##_free(gchar *text) \ + { \ + gchar *p; \ + p = g_strconcat("<" #ELEM ">", text, "</" #ELEM ">", NULL); \ + g_free(text); \ + return p; \ + } +TEXT_ELEMENT(h1) +TEXT_ELEMENT(h2) +TEXT_ELEMENT(h3) +TEXT_ELEMENT(h4) +TEXT_ELEMENT(h5) +TEXT_ELEMENT(h6) +TEXT_ELEMENT(p) +#undef TEXT_ELEMENT gchar * mq_html_container(const gchar *element, ...) @@ -27,11 +27,19 @@ gchar * mq_html_document(const gchar *title, ...); -gchar * -mq_html_p(gchar *text); - -gchar * -mq_html_p_free(gchar *text); +#define TEXT_ELEMENT(ELEM) \ + gchar * \ + mq_html_##ELEM(gchar *text); \ + gchar * \ + mq_html_##ELEM##_free(gchar *text); +TEXT_ELEMENT(h1) +TEXT_ELEMENT(h2) +TEXT_ELEMENT(h3) +TEXT_ELEMENT(h4) +TEXT_ELEMENT(h5) +TEXT_ELEMENT(h6) +TEXT_ELEMENT(p) +#undef TEXT_ELEMENT gchar * mq_html_container(const gchar *element, ...); |