summaryrefslogtreecommitdiff
path: root/src/generators.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/generators.c')
-rw-r--r--src/generators.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/generators.c b/src/generators.c
index a6e0ba0..e2f9d7f 100644
--- a/src/generators.c
+++ b/src/generators.c
@@ -34,6 +34,7 @@
#define DEFAULT_DATA_DIR_MODE S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH
+#define GET_EXT(s) strrchr (s, '.')
/*
* generate_image: auxiliary function for write_html_album
@@ -304,7 +305,7 @@ write_html_album (TGallerySetup *setup,
/* Go Up string */
s3 = make_string ("../", level);
s2 = setup->use_inpage_links ? g_strdup_printf ("#i%d", old_parent_item_index) : g_strdup ("");
- replace_table_add_key_printf (global_replace_table, "GO_UP_LINK", "%sindex.html%s", s3, s2);
+ replace_table_add_key_printf (global_replace_table, "GO_UP_LINK", "%s%s%s", s3, setup->index_file_name, s2);
g_free (s2);
free (s3);
@@ -312,7 +313,7 @@ write_html_album (TGallerySetup *setup,
s3 = make_string ("../", level);
s4 = g_strdup (parent->ID);
s5 = setup->use_inpage_links ? g_strdup_printf ("#i%d", old_parent_item_index) : g_strdup ("");
- s2 = g_strdup_printf ("<a href=\"%sindex.html%s\">%s</a> &gt; %s", s3, s5, s4, s1);
+ s2 = g_strdup_printf ("<a href=\"%s%s%s\">%s</a> &gt; %s", s3, setup->index_file_name, s5, s4, s1);
free (s3);
g_free (s1);
g_free (s4);
@@ -478,8 +479,8 @@ write_html_album (TGallerySetup *setup,
else
s1 = strdup (buf_img_list_portrait);
- replace_table_add_key_printf (local_replace_table, "ALBUM_SUBPATH", "%s/index.html", item->path);
- replace_table_add_key_printf (local_replace_table, "IMG_SUBPAGE", "%s.html", img_src);
+ replace_table_add_key_printf (local_replace_table, "ALBUM_SUBPATH", "%s/%s", item->path, setup->index_file_name);
+ replace_table_add_key_printf (local_replace_table, "IMG_SUBPAGE", "%s%s", img_src, GET_EXT (setup->index_file_name));
replace_table_add_key (local_replace_table, "IMG_TITLE", item->title);
replace_table_add_key (local_replace_table, "IMG_DESCRIPTION", item->title_description);
replace_table_add_key_printf (local_replace_table, "IMG_LIST_ID", "i%d", i + 1);
@@ -742,7 +743,7 @@ write_html_image (TGallerySetup *setup,
s3 = make_string ("../", level);
s4 = g_strdup (parent->ID);
s5 = setup->use_inpage_links ? g_strdup_printf ("#i%d", parent == parent_items ? item_index : old_parent_item_index) : g_strdup ("");
- s2 = g_strdup_printf ("<a href=\"%sindex.html%s\">%s</a> &gt; %s", s3, s5, s4, s1);
+ s2 = g_strdup_printf ("<a href=\"%s%s%s\">%s</a> &gt; %s", s3, setup->index_file_name, s5, s4, s1);
free (s3);
g_free (s1);
g_free (s4);
@@ -790,18 +791,18 @@ write_html_image (TGallerySetup *setup,
/* Next/Previous links */
if (next_item) {
s2 = g_path_get_basename ((next_item->path == NULL && next_item->preview) ? next_item->preview : next_item->path);
- replace_table_add_key_printf (replace_table, "LINK_NEXT", "%s.html", s2);
+ replace_table_add_key_printf (replace_table, "LINK_NEXT", "%s%s", s2, GET_EXT (setup->index_file_name));
g_free (s2);
}
else
- replace_table_add_key (replace_table, "LINK_NEXT", "index.html");
+ replace_table_add_key (replace_table, "LINK_NEXT", setup->index_file_name);
if (previous_item) {
s2 = g_path_get_basename ((previous_item->path == NULL && previous_item->preview) ? previous_item->preview : previous_item->path);
- replace_table_add_key_printf (replace_table, "LINK_PREV", "%s.html", s2);
+ replace_table_add_key_printf (replace_table, "LINK_PREV", "%s%s", s2, GET_EXT (setup->index_file_name));
g_free (s2);
}
else
- replace_table_add_key (replace_table, "LINK_PREV", "index.html");
+ replace_table_add_key (replace_table, "LINK_PREV", setup->index_file_name);
/* META tags */
override_title_meta = setup->use_title_as_meta && title && (strlen (title) > 0);
@@ -1084,9 +1085,9 @@ build_tree (TGallerySetup *setup,
/* default to album */
template = g_strconcat ("/", setup->template_album, NULL);
- if (setup->verbose) printf ("Writing 'index.html' ...\n");
+ if (setup->verbose) printf ("Writing '%s' ...\n", setup->index_file_name);
s1 = g_strconcat (setup->real_templates_dir, template, NULL);
- s2 = g_strconcat (dst_dir, "/index.html", NULL);
+ s2 = g_strconcat (dst_dir, "/", setup->index_file_name, NULL);
res = write_html_album (setup, s1, s2, items);
g_free (s1);
g_free (s2);
@@ -1132,10 +1133,10 @@ build_tree (TGallerySetup *setup,
}
if (item->type == INDEX_ITEM_TYPE_PICTURE) {
imgname = g_path_get_basename ((item->path == NULL && item->preview) ? item->preview : item->path);
- if (setup->verbose) printf ("Writing '%s.html' ...", imgname);
+ if (setup->verbose) printf ("Writing '%s%s' ...", imgname, GET_EXT (setup->index_file_name));
s1 = g_strconcat (setup->real_templates_dir, "/", setup->template_photo, NULL);
s2 = g_strconcat (items->base_dir, "/", (item->path == NULL && item->preview) ? item->preview : item->path, NULL);
- s3 = g_strconcat (dst_dir, "/", imgname, ".html", NULL);
+ s3 = g_strconcat (dst_dir, "/", imgname, GET_EXT (setup->index_file_name), NULL);
res = write_html_image (setup, s1, s2, s3, item, items);
g_free (s1);
g_free (s2);