From 7dcce8c12fa693471efbae7f2fef8d7b102aacfb Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Thu, 14 Aug 2008 22:30:31 +0200 Subject: Treat meta tags in a cleaner way --- generators.c | 46 +++++++++++++++++++++++++++++--------- sample/src/setup.xml | 3 +++ setup.c | 4 ++++ setup.h | 2 ++ templates/template-album.tmpl | 4 +--- templates/template-index.tmpl | 4 +--- templates/template-view_photo.tmpl | 4 +--- 7 files changed, 48 insertions(+), 19 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, "", s1, NULL); g_free (s1); } - if (strstr (b, "")) { - s1 = g_strdup_printf ("Cataract Gallery Generator v%s", APP_VERSION); - str_replace (&b, "", s1, NULL); + if (strstr (b, "")) { + s1 = g_strdup_printf ("\t\n", APP_VERSION); + if (setup->meta_author) { + s2 = g_strdup_printf ("%s\t\n", s1, setup->meta_author); + g_free (s1); + s1 = s2; + } + if (setup->meta_description) { + s2 = g_strdup_printf ("%s\t\n", s1, setup->meta_description); + g_free (s1); + s1 = s2; + } + if (setup->meta_keywords) { + s2 = g_strdup_printf ("%s\t\n", s1, setup->meta_keywords); + g_free (s1); + s1 = s2; + } + str_replace (&b, "", s1, NULL); g_free (s1); } - if (strstr (b, "") && setup->meta_author) - str_replace (&b, "", setup->meta_author, NULL); if (strstr (b, "")) { s1 = g_strdup_printf ("%d", items->items->len); str_replace (&b, "", s1, NULL); @@ -762,13 +775,26 @@ write_html_image (TGallerySetup *setup, str_replace (&b, "", s1, NULL); g_free (s1); } - if (strstr (b, "")) { - s1 = g_strdup_printf ("Cataract Gallery Generator v%s", APP_VERSION); - str_replace (&b, "", s1, NULL); + if (strstr (b, "")) { + s1 = g_strdup_printf ("\t\n", APP_VERSION); + if (setup->meta_author) { + s2 = g_strdup_printf ("%s\t\t\n", s1, setup->meta_author); + g_free (s1); + s1 = s2; + } + if (setup->meta_description) { + s2 = g_strdup_printf ("%s\t\n", s1, setup->meta_description); + g_free (s1); + s1 = s2; + } + if (setup->meta_keywords) { + s2 = g_strdup_printf ("%s\t\n", s1, setup->meta_keywords); + g_free (s1); + s1 = s2; + } + str_replace (&b, "", s1, NULL); g_free (s1); } - if (strstr (b, "") && setup->meta_author) - str_replace (&b, "", setup->meta_author, NULL); if (! fputs (b, fout)) { fprintf (stderr, "write_html_image: error writing to file \"%s\": %s\n", dst, strerror (errno)); diff --git a/sample/src/setup.xml b/sample/src/setup.xml index 5cca5d8..f9cb460 100644 --- a/sample/src/setup.xml +++ b/sample/src/setup.xml @@ -31,6 +31,9 @@ John Doe + CGG Sample gallery + + cataract, sample, gallery