diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-08-13 23:11:19 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-08-13 23:11:19 +0200 |
| commit | 5a020e6640b2723a57176e6596ea665442d53672 (patch) | |
| tree | 818b324754678a526085a8cdac76ec4793955db5 | |
| parent | 3fadc8b6863a267884e242b9e6303cfd117fce4e (diff) | |
| download | cataract-5a020e6640b2723a57176e6596ea665442d53672.tar.xz | |
Fix up meta tags, add support for author tag
| -rw-r--r-- | cgg.c | 3 | ||||
| -rw-r--r-- | config.h | 4 | ||||
| -rw-r--r-- | generators.c | 16 | ||||
| -rw-r--r-- | sample/src/setup.xml | 5 | ||||
| -rw-r--r-- | setup.c | 4 | ||||
| -rw-r--r-- | setup.h | 1 | ||||
| -rw-r--r-- | templates/template-album.tmpl | 8 | ||||
| -rw-r--r-- | templates/template-index.tmpl | 10 | ||||
| -rw-r--r-- | templates/template-view_photo.tmpl | 8 |
9 files changed, 36 insertions, 23 deletions
@@ -32,9 +32,6 @@ -#define APP_VERSION "0.99.0" -#define APP_BUILD_DATE "2008-07-27" - /* @@ -24,3 +24,7 @@ #define IMG_ORIG_DIR "_orig" #define SETUP_XML "setup.xml" + +#define APP_VERSION "0.99.0" +#define APP_BUILD_DATE "2008-07-27" + diff --git a/generators.c b/generators.c index 654e01a..0a07eb8 100644 --- a/generators.c +++ b/generators.c @@ -327,6 +327,13 @@ 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); + 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); @@ -749,12 +756,19 @@ write_html_image (TGallerySetup *setup, str_replace (&b, "<!-- $(LINK_PREV) -->", "index.html", NULL); } - if (strstr (b, "<!-- $(FOOTER) -->")) { + if (strstr (b, "<!-- $(FOOTER) -->") && setup->footer) { s1 = g_strdup (setup->footer); fix_entities (&s1); 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); + 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)); diff --git a/sample/src/setup.xml b/sample/src/setup.xml index 8f4b632..5cca5d8 100644 --- a/sample/src/setup.xml +++ b/sample/src/setup.xml @@ -28,6 +28,11 @@ <border style="border_single" /> </images> + <!-- META tags in html head section --> + <meta> + <author>John Doe</author> + </meta> + <footer><![CDATA[ <div class="footer">So this is footer, suitable place for copyright, W3C validation links and advertisement! | Generated with <a href="http://cgg.bzatek.net/" title="Cataract Gallery Generator" class="footermail">Cataract Gallery Generator</a>. @@ -109,6 +109,7 @@ parse_setup_xml (const char *filename, TGallerySetup *setup) setup->preview_quality = xml_file_get_node_attribute_long (xml, "/gallery_setup/images/preview", "quality", -1); setup->footer = xml_file_get_node_value (xml, "/gallery_setup/footer/text()"); setup->border_style = xml_file_get_node_attribute (xml, "/gallery_setup/images/border", "style"); + setup->meta_author = xml_file_get_node_value (xml, "/gallery_setup/meta/author/text()"); xml_parser_close (xml); @@ -131,6 +132,7 @@ parse_setup_xml (const char *filename, TGallerySetup *setup) printf("setup: preview_portrait_height = %ld\n", setup->preview_portrait_height); printf("setup: footer = '%s'\n", setup->footer); printf("setup: border_style = '%s'\n", setup->border_style); + printf("setup: meta_author = '%s'\n", setup->meta_author); #endif return TRUE; @@ -221,6 +223,8 @@ free_setup_data (TGallerySetup *setup) free (setup->scripts); if (setup->footer) free (setup->footer); + if (setup->meta_author) + free (setup->meta_author); if (setup->border_style) free (setup->border_style); free (setup); @@ -36,6 +36,7 @@ typedef struct { char *scripts; char *footer; + char *meta_author; int thumbnail_quality; unsigned long thumbnail_landscape_width; diff --git a/templates/template-album.tmpl b/templates/template-album.tmpl index 217c7b7..33a0af5 100644 --- a/templates/template-album.tmpl +++ b/templates/template-album.tmpl @@ -4,13 +4,9 @@ <head> <title>Browsing album "<!-- $(ID) -->"</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <meta name="generator" content="Bluefish 1.0.6" /> - <meta name="date" content="2007-01-06T22:48:18+0100" /> + <meta name="generator" content="<!-- $(META_GENERATOR) -->" /> <meta name="description" content="Photo album: <!-- $(ID) -->" /> - <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" /> - <meta http-equiv="content-style-type" content="text/css "/> - <link href="support/folder-saved-search.png" type="image/png" rel="icon" /> - <!-- link rel="shortcut icon" href="http://primates.ximian.com/%7Ejimmac/photos/favicon.ico" type="image/x-icon" / --> + <meta name="author" content="<!-- $(META_AUTHOR) -->" /> <link href="styles.css" type="text/css" rel="stylesheet" media="screen, print" /> <script type="text/javascript" src="scripts-general.js"> </script> </head> diff --git a/templates/template-index.tmpl b/templates/template-index.tmpl index 63fb2b5..e6268c5 100644 --- a/templates/template-index.tmpl +++ b/templates/template-index.tmpl @@ -2,15 +2,11 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> - <title><!-- $(ID) --></title> + <title>Photo index: <!-- $(ID) --></title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <meta name="generator" content="Bluefish 1.0.6" /> - <meta name="date" content="2007-01-06T22:48:18+0100" /> + <meta name="generator" content="<!-- $(META_GENERATOR) -->" /> <meta name="description" content="Photo index: <!-- $(ID) -->" /> - <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" /> - <meta http-equiv="content-style-type" content="text/css "/> - <link href="support/folder-saved-search.png" type="image/png" rel="icon" /> - <!-- link rel="shortcut icon" href="http://primates.ximian.com/%7Ejimmac/photos/favicon.ico" type="image/x-icon" / --> + <meta name="author" content="<!-- $(META_AUTHOR) -->" /> <link href="styles.css" type="text/css" rel="stylesheet" media="screen, print" /> <script type="text/javascript" src="scripts-general.js"> </script> </head> diff --git a/templates/template-view_photo.tmpl b/templates/template-view_photo.tmpl index 3ece715..2a1875f 100644 --- a/templates/template-view_photo.tmpl +++ b/templates/template-view_photo.tmpl @@ -4,13 +4,9 @@ <head> <title>Viewing photo "<!-- $(FILE_NAME) -->" [<!-- $(FILE_NO) -->/<!-- $(TOTAL_ITEMS) -->]</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <meta name="generator" content="Bluefish 1.0.7"/> - <meta name="date" content="2007-08-27T23:06:28+0200"/> + <meta name="generator" content="<!-- $(META_GENERATOR) -->" /> <meta name="description" content="Viewing photo '<!-- $(FILE_NAME) -->'" /> - <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" /> - <meta http-equiv="content-style-type" content="text/css "/> - <link href="support/image-x-generic.png" type="image/png" rel="icon" /> - <!-- link rel="shortcut icon" href="http://primates.ximian.com/%7Ejimmac/photos/favicon.ico" type="image/x-icon" / --> + <meta name="author" content="<!-- $(META_AUTHOR) -->" /> <link href="styles.css" type="text/css" rel="stylesheet" media="screen, print" /> <script type="text/javascript" src="scripts-general.js"> </script> </head> |
