diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-12-31 21:25:37 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-12-31 21:25:37 +0100 |
| commit | d928fd7db816c5eb6f57f90ebefb55779aebdcc9 (patch) | |
| tree | 0a4f21444d67aeef6c26637ed29c0b3ef0cf55f7 /generators.c | |
| parent | dc66e451a966e5ab320451c87ad912a741a71d4e (diff) | |
| download | cataract-d928fd7db816c5eb6f57f90ebefb55779aebdcc9.tar.xz | |
Make page titles intelligent
Diffstat (limited to 'generators.c')
| -rw-r--r-- | generators.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/generators.c b/generators.c index 6bcf637..d4b0cf9 100644 --- a/generators.c +++ b/generators.c @@ -342,6 +342,16 @@ write_html_album (TGallerySetup *setup, /* Simple placeholders */ + if (strstr (b, "<!-- $(PAGE_TITLE) -->")) { + if (items->parent_index == NULL || setup->site_title == NULL) + s1 = g_strdup (setup->site_title ? setup->site_title : items->ID); + else + s1 = g_strdup_printf ("%s | %s", items->title, setup->site_title); + s2 = g_markup_escape_text (s1, -1); + str_replace (&b, "<!-- $(PAGE_TITLE) -->", s2, NULL); + g_free (s2); + g_free (s1); + } if (strstr (b, "<!-- $(ID) -->") && items->ID) { s1 = g_strdup (items->ID); fix_entities (&s1); @@ -727,7 +737,23 @@ write_html_image (TGallerySetup *setup, str_replace (&title_desc, "\n", "<br />", NULL); } } - + if (title) title = g_strstrip (title); + if (title_desc) title_desc = g_strstrip (title_desc); + + /* Page title */ + if (strstr (b, "<!-- $(PAGE_TITLE) -->")) { + s1 = (title && strlen (title) > 0) ? g_strdup_printf("%s | ", title) : NULL; + s2 = g_strdup_printf ("%s [%d/%d]", parent_items->title ? parent_items->title : parent_items->ID, real_item_index, real_total_items); + s3 = setup->site_title ? g_strdup_printf(" | %s", setup->site_title) : NULL; + s4 = g_strconcat (s1 ? s1 : "", s2, s3 ? s3 : "", NULL); + if (s1) g_free (s1); + if (s2) g_free (s2); + if (s3) g_free (s3); + s1 = g_markup_escape_text (s4, -1); + str_replace (&b, "<!-- $(PAGE_TITLE) -->", s1, NULL); + g_free (s4); + g_free (s1); + } /* Simple placeholders */ if (strstr (b, "<!-- $(FILE_NAME) -->")) str_replace (&b, "<!-- $(FILE_NAME) -->", imgname, NULL); |
