diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-08-14 22:30:31 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-08-14 22:30:31 +0200 |
| commit | 7dcce8c12fa693471efbae7f2fef8d7b102aacfb (patch) | |
| tree | 3ee1a110e53a57afecb16dc5360877320a666b74 /generators.c | |
| parent | 5a020e6640b2723a57176e6596ea665442d53672 (diff) | |
| download | cataract-7dcce8c12fa693471efbae7f2fef8d7b102aacfb.tar.xz | |
Treat meta tags in a cleaner way
Diffstat (limited to 'generators.c')
| -rw-r--r-- | generators.c | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/generators.c b/generators.c index 0a07eb8..904d407 100644 --- a/generators.c +++ b/generators.c @@ -327,13 +327,26 @@ write_html_album (TGallerySetup *setup, str_replace (&b, "<!-- $(FOOTER) -->", s1, NULL); g_free (s1); } - if (strstr (b, "<!-- $(META_GENERATOR) -->")) { - s1 = g_strdup_printf ("Cataract Gallery Generator v%s", APP_VERSION); - str_replace (&b, "<!-- $(META_GENERATOR) -->", s1, NULL); + if (strstr (b, "<!-- $(CGG_META_TAGS) -->")) { + s1 = g_strdup_printf ("\t<meta name=\"generator\" content=\"Cataract Gallery Generator v%s\" />\n", APP_VERSION); + if (setup->meta_author) { + s2 = g_strdup_printf ("%s\t<meta name=\"author\" content=\"%s\" />\n", s1, setup->meta_author); + g_free (s1); + s1 = s2; + } + if (setup->meta_description) { + s2 = g_strdup_printf ("%s\t<meta name=\"description\" content=\"%s\" />\n", s1, setup->meta_description); + g_free (s1); + s1 = s2; + } + if (setup->meta_keywords) { + s2 = g_strdup_printf ("%s\t<meta name=\"keywords\" content=\"%s\" />\n", s1, setup->meta_keywords); + g_free (s1); + s1 = s2; + } + str_replace (&b, "<!-- $(CGG_META_TAGS) -->", s1, NULL); g_free (s1); } - if (strstr (b, "<!-- $(META_AUTHOR) -->") && setup->meta_author) - str_replace (&b, "<!-- $(META_AUTHOR) -->", setup->meta_author, NULL); if (strstr (b, "<!-- $(TOTAL_ITEMS) -->")) { s1 = g_strdup_printf ("%d", items->items->len); str_replace (&b, "<!-- $(TOTAL_ITEMS) -->", s1, NULL); @@ -762,13 +775,26 @@ write_html_image (TGallerySetup *setup, str_replace (&b, "<!-- $(FOOTER) -->", s1, NULL); g_free (s1); } - if (strstr (b, "<!-- $(META_GENERATOR) -->")) { - s1 = g_strdup_printf ("Cataract Gallery Generator v%s", APP_VERSION); - str_replace (&b, "<!-- $(META_GENERATOR) -->", s1, NULL); + if (strstr (b, "<!-- $(CGG_META_TAGS) -->")) { + s1 = g_strdup_printf ("\t<meta name=\"generator\" content=\"Cataract Gallery Generator v%s\" />\n", APP_VERSION); + if (setup->meta_author) { + s2 = g_strdup_printf ("%s\t\t<meta name=\"author\" content=\"%s\" />\n", s1, setup->meta_author); + g_free (s1); + s1 = s2; + } + if (setup->meta_description) { + s2 = g_strdup_printf ("%s\t<meta name=\"description\" content=\"%s\" />\n", s1, setup->meta_description); + g_free (s1); + s1 = s2; + } + if (setup->meta_keywords) { + s2 = g_strdup_printf ("%s\t<meta name=\"keywords\" content=\"%s\" />\n", s1, setup->meta_keywords); + g_free (s1); + s1 = s2; + } + str_replace (&b, "<!-- $(CGG_META_TAGS) -->", s1, NULL); g_free (s1); } - if (strstr (b, "<!-- $(META_AUTHOR) -->") && setup->meta_author) - str_replace (&b, "<!-- $(META_AUTHOR) -->", setup->meta_author, NULL); if (! fputs (b, fout)) { fprintf (stderr, "write_html_image: error writing to file \"%s\": %s\n", dst, strerror (errno)); |
