summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generators.c207
-rw-r--r--items.c102
-rw-r--r--items.h6
-rw-r--r--sample/src/CIAF_1/index.xml8
-rw-r--r--sample/src/index.xml2
-rw-r--r--templates/styles.css27
-rw-r--r--templates/template-album.tmpl5
-rw-r--r--templates/template-index.tmpl5
-rw-r--r--xml-parser.c31
-rw-r--r--xml-parser.h5
10 files changed, 287 insertions, 111 deletions
diff --git a/generators.c b/generators.c
index 904d407..0a1585c 100644
--- a/generators.c
+++ b/generators.c
@@ -193,21 +193,25 @@ write_html_album (TGallerySetup *setup,
char *buffer;
char *buf_img_list_landscape;
char *buf_img_list_portrait;
+ char *buf_img_separator;
char *buf_go_up_string;
gboolean in_img_list;
gboolean in_img_list_landscape;
gboolean in_img_list_portrait;
+ gboolean in_img_separator;
gboolean in_go_up_string;
char *b;
char *s1, *s2, *s3, *s4;
TAlbum *parent;
TIndexItem *item;
+ TIndexItem *tmp_item;
int level;
gboolean res;
int i;
unsigned long img_w, img_h;
char *img_src;
char *thumb;
+ unsigned int real_total_items;
fin = fopen (template_src, "r");
@@ -225,13 +229,23 @@ write_html_album (TGallerySetup *setup,
buffer = malloc (BUFFER_SIZE);
buf_img_list_landscape = malloc (BUFFER_SIZE);
buf_img_list_portrait = malloc (BUFFER_SIZE);
+ buf_img_separator = malloc (BUFFER_SIZE);
buf_go_up_string = malloc (BUFFER_SIZE);
in_img_list = FALSE;
in_img_list_landscape = FALSE;
in_img_list_portrait = FALSE;
+ in_img_separator = FALSE;
in_go_up_string = FALSE;
res = TRUE;
+ /* Get number of real pictures in the list */
+ real_total_items = 0;
+ for (i = 0; i < items->items->len; i++) {
+ tmp_item = g_ptr_array_index (items->items, i);
+ if (tmp_item->type == INDEX_ITEM_TYPE_PICTURE)
+ real_total_items++;
+ }
+
/* Read through the template and replace placeholders with real data */
while (! feof (fin))
{
@@ -264,6 +278,16 @@ write_html_album (TGallerySetup *setup,
free (b);
continue;
}
+ if (in_img_list && (strstr (buffer, "<!-- $(BEGIN_LIST_SEPARATOR) -->"))) {
+ in_img_separator = TRUE;
+ free (b);
+ continue;
+ }
+ if (in_img_list && (strstr (buffer, "<!-- $(END_LIST_SEPARATOR) -->"))) {
+ in_img_separator = FALSE;
+ free (b);
+ continue;
+ }
if (in_img_list && in_img_list_landscape) {
buf_img_list_landscape = strncat (buf_img_list_landscape, b, BUFFER_SIZE - strlen (buf_img_list_landscape) - 2);
free (b);
@@ -274,6 +298,11 @@ write_html_album (TGallerySetup *setup,
free (b);
continue;
}
+ if (in_img_list && in_img_separator) {
+ buf_img_separator = strncat (buf_img_separator, b, BUFFER_SIZE - strlen (buf_img_separator) - 2);
+ free (b);
+ continue;
+ }
if (strstr (buffer, "<!-- $(BEGIN_GO_UP) -->")) {
memset (buf_go_up_string, 0, BUFFER_SIZE);
@@ -348,7 +377,7 @@ write_html_album (TGallerySetup *setup,
g_free (s1);
}
if (strstr (b, "<!-- $(TOTAL_ITEMS) -->")) {
- s1 = g_strdup_printf ("%d", items->items->len);
+ s1 = g_strdup_printf ("%d", real_total_items);
str_replace (&b, "<!-- $(TOTAL_ITEMS) -->", s1, NULL);
g_free (s1);
}
@@ -377,9 +406,11 @@ write_html_album (TGallerySetup *setup,
if (strstr (buffer, "<!-- $(BEGIN_IMG_LIST) -->")) {
memset (buf_img_list_landscape, 0, BUFFER_SIZE);
memset (buf_img_list_portrait, 0, BUFFER_SIZE);
+ memset (buf_img_separator, 0, BUFFER_SIZE);
in_img_list = TRUE;
in_img_list_landscape = FALSE;
in_img_list_portrait = FALSE;
+ in_img_separator = FALSE;
free (b);
continue;
}
@@ -404,51 +435,64 @@ write_html_album (TGallerySetup *setup,
img_h = 0;
img_src = NULL;
thumb = NULL;
- generate_image (setup, items, item, dst, &img_w, &img_h, &img_src, &thumb);
- /* Process HTML box code */
- if ((img_w / img_h) >= 1)
- s1 = strdup (buf_img_list_landscape);
- else
- s1 = strdup (buf_img_list_portrait);
-
- if (strstr (s1, "<!-- $(ALBUM_SUBPATH) -->")) {
- s2 = g_strconcat (item->path, "/index.html", NULL);
- str_replace (&s1, "<!-- $(ALBUM_SUBPATH) -->", s2, NULL);
- g_free (s2);
- }
- if (strstr (s1, "<!-- $(IMG_SUBPAGE) -->")) {
- s2 = g_strconcat (img_src, ".html", NULL);
- str_replace (&s1, "<!-- $(IMG_SUBPAGE) -->", s2, NULL);
- g_free (s2);
- }
- if (strstr (s1, "<!-- $(IMG_TITLE) -->") && item->title) {
- s2 = g_strdup (item->title);
- fix_entities (&s2);
- str_replace (&s1, "<!-- $(IMG_TITLE) -->", s2, NULL);
- g_free (s2);
- }
- if (strstr (s1, "<!-- $(IMG_DESCRIPTION) -->") && item->title_description) {
- s2 = g_strdup (item->title_description);
- fix_entities (&s2);
- str_replace (&s1, "<!-- $(IMG_DESCRIPTION) -->", s2, NULL);
- g_free (s2);
- }
- if (strstr(s1, "<!-- $(ALBUM_NUM_ITEMS) -->")) {
- s3 = g_strconcat (items->base_dir, "/", item->path, "/index.xml", NULL);
- s2 = g_strdup_printf ("%d", get_album_objects_count(s3));
- str_replace (&s1, "<!-- $(ALBUM_NUM_ITEMS) -->", s2, NULL);
- g_free (s2);
- g_free (s3);
- }
- if (strstr (s1, "<!-- $(IMG_THUMBNAIL) -->")) {
- s2 = g_strconcat (THUMBNAIL_DIR, "/", thumb, NULL);
- str_replace (&s1, "<!-- $(IMG_THUMBNAIL) -->", s2, NULL);
- g_free (s2);
+ switch (item->type) {
+ case INDEX_ITEM_TYPE_PICTURE:
+ generate_image (setup, items, item, dst, &img_w, &img_h, &img_src, &thumb);
+ /* Process HTML box code */
+ if ((img_w / img_h) >= 1)
+ s1 = strdup (buf_img_list_landscape);
+ else
+ s1 = strdup (buf_img_list_portrait);
+
+ if (strstr (s1, "<!-- $(ALBUM_SUBPATH) -->")) {
+ s2 = g_strconcat (item->path, "/index.html", NULL);
+ str_replace (&s1, "<!-- $(ALBUM_SUBPATH) -->", s2, NULL);
+ g_free (s2);
+ }
+ if (strstr (s1, "<!-- $(IMG_SUBPAGE) -->")) {
+ s2 = g_strconcat (img_src, ".html", NULL);
+ str_replace (&s1, "<!-- $(IMG_SUBPAGE) -->", s2, NULL);
+ g_free (s2);
+ }
+ if (strstr (s1, "<!-- $(IMG_TITLE) -->") && item->title) {
+ s2 = g_strdup (item->title);
+ fix_entities (&s2);
+ str_replace (&s1, "<!-- $(IMG_TITLE) -->", s2, NULL);
+ g_free (s2);
+ }
+ if (strstr (s1, "<!-- $(IMG_DESCRIPTION) -->") && item->title_description) {
+ s2 = g_strdup (item->title_description);
+ fix_entities (&s2);
+ str_replace (&s1, "<!-- $(IMG_DESCRIPTION) -->", s2, NULL);
+ g_free (s2);
+ }
+ if (strstr(s1, "<!-- $(ALBUM_NUM_ITEMS) -->")) {
+ s3 = g_strconcat (items->base_dir, "/", item->path, "/index.xml", NULL);
+ s2 = g_strdup_printf ("%d", get_album_objects_count(s3));
+ str_replace (&s1, "<!-- $(ALBUM_NUM_ITEMS) -->", s2, NULL);
+ g_free (s2);
+ g_free (s3);
+ }
+ if (strstr (s1, "<!-- $(IMG_THUMBNAIL) -->")) {
+ s2 = g_strconcat (THUMBNAIL_DIR, "/", thumb, NULL);
+ str_replace (&s1, "<!-- $(IMG_THUMBNAIL) -->", s2, NULL);
+ g_free (s2);
+ }
+ if (strstr (s1, "<!-- $(IMG_FILENAME) -->"))
+ str_replace (&s1, "<!-- $(IMG_FILENAME) -->", img_src, NULL);
+ break;
+
+ case INDEX_ITEM_TYPE_SEPARATOR:
+ s1 = strdup (buf_img_separator);
+ if (strstr (s1, "<!-- $(LIST_SEPARATOR_TITLE) -->") && item->title) {
+ s2 = g_strdup (item->title);
+ fix_entities (&s2);
+ str_replace (&s1, "<!-- $(LIST_SEPARATOR_TITLE) -->", s2, NULL);
+ g_free (s2);
+ }
+ break;
}
- if (strstr (s1, "<!-- $(IMG_FILENAME) -->"))
- str_replace (&s1, "<!-- $(IMG_FILENAME) -->", img_src, NULL);
-
#ifdef __DEBUG_ALL__
printf("***** %s ******\n", s1);
@@ -485,6 +529,7 @@ write_html_album (TGallerySetup *setup,
free (buffer);
free (buf_img_list_landscape);
free (buf_img_list_portrait);
+ free (buf_img_separator);
free (buf_go_up_string);
return res;
}
@@ -518,9 +563,10 @@ write_html_image (TGallerySetup *setup,
gboolean in_img_fullsize_link;
TExifData *exif;
unsigned long img_big_w, img_big_h, img_orig_w, img_orig_h;
- unsigned int item_index;
+ unsigned int item_index, real_item_index, real_total_items;
TIndexItem *previous_item;
TIndexItem *next_item;
+ TIndexItem *tmp_item;
TAlbum *parent;
int i;
char *s1, *s2, *s3, *s4;
@@ -565,19 +611,30 @@ write_html_image (TGallerySetup *setup,
/* Get our index in the album */
item_index = 0;
- for (i = 0; i < parent_items->items->len; i++)
- if (g_ptr_array_index (parent_items->items, i) == item) {
- item_index = i + 1;
- break;
+ real_item_index = 0;
+ real_total_items = 0;
+ for (i = 0; i < parent_items->items->len; i++) {
+ tmp_item = g_ptr_array_index (parent_items->items, i);
+ if (tmp_item->type == INDEX_ITEM_TYPE_PICTURE) {
+ if (! item_index) real_item_index++;
+ real_total_items++;
}
+ if (tmp_item == item)
+ item_index = i + 1;
+ }
/* Get previous and next items */
previous_item = NULL;
next_item = NULL;
- if (item_index > 1)
- previous_item = g_ptr_array_index (parent_items->items, item_index - 2);
- if (item_index < parent_items->items->len)
- next_item = g_ptr_array_index (parent_items->items, item_index);
+
+ for (i = item_index - 2; i >= 0 && (previous_item == NULL || previous_item->type != INDEX_ITEM_TYPE_PICTURE); i--)
+ previous_item = g_ptr_array_index (parent_items->items, i);
+ if (previous_item && previous_item->type != INDEX_ITEM_TYPE_PICTURE)
+ previous_item = NULL;
+ for (i = item_index; item_index < parent_items->items->len && (next_item == NULL || next_item->type != INDEX_ITEM_TYPE_PICTURE); i++)
+ next_item = g_ptr_array_index (parent_items->items, i);
+ if (next_item && next_item->type != INDEX_ITEM_TYPE_PICTURE)
+ next_item = NULL;
/* Read through the template and replace placeholders with real data */
@@ -624,12 +681,12 @@ write_html_image (TGallerySetup *setup,
g_free (s1);
}
if (strstr (b, "<!-- $(TOTAL_ITEMS) -->")) {
- s1 = g_strdup_printf ("%d", parent_items->items->len);
+ s1 = g_strdup_printf ("%d", real_total_items);
str_replace (&b, "<!-- $(TOTAL_ITEMS) -->", s1, NULL);
g_free (s1);
}
if (strstr (b, "<!-- $(FILE_NO) -->")) {
- s1 = g_strdup_printf ("%d", item_index);
+ s1 = g_strdup_printf ("%d", real_item_index);
str_replace(&b, "<!-- $(FILE_NO) -->", s1, NULL);
g_free (s1);
}
@@ -912,7 +969,7 @@ build_tree (TGallerySetup *setup,
/* Prepare target preview and orig directories */
if (items->type == GALLERY_TYPE_ALBUM)
{
- res = TRUE;
+ res = TRUE;
img_big_dir = g_strconcat (dst_dir, "/", IMG_BIG_DIR, NULL);
img_orig_dir = g_strconcat (dst_dir, "/", IMG_ORIG_DIR, NULL);
if (access (img_big_dir, R_OK | W_OK | X_OK))
@@ -966,11 +1023,13 @@ build_tree (TGallerySetup *setup,
fprintf (stderr, "build_tree: error getting item %d\n", i);
continue;
}
- s1 = g_strconcat (src_tree, "/", item->path, "/", NULL);
- s2 = g_strconcat (dst_dir, "/", item->path, "/", NULL);
- build_tree (setup, s1, s2, items);
- g_free (s1);
- g_free (s2);
+ if (item->type == INDEX_ITEM_TYPE_PICTURE) {
+ s1 = g_strconcat (src_tree, "/", item->path, "/", NULL);
+ s2 = g_strconcat (dst_dir, "/", item->path, "/", NULL);
+ build_tree (setup, s1, s2, items);
+ g_free (s1);
+ g_free (s2);
+ }
}
}
}
@@ -985,18 +1044,20 @@ build_tree (TGallerySetup *setup,
fprintf (stderr, "build_tree: error getting item %d\n", i);
continue;
}
- imgname = (item->path == NULL && item->preview) ? g_path_get_basename (item->preview) : g_strdup (item->path);
- if (setup->verbose) printf ("Writing '%s.html' ...", imgname);
- 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);
- res = write_html_image (setup, s1, s2, s3, item, items);
- g_free (s1);
- g_free (s2);
- g_free (s3);
- g_free (imgname);
- if (! res ) continue;
- if (setup->verbose) printf (" done.\n");
+ if (item->type == INDEX_ITEM_TYPE_PICTURE) {
+ imgname = (item->path == NULL && item->preview) ? g_path_get_basename (item->preview) : g_strdup (item->path);
+ if (setup->verbose) printf ("Writing '%s.html' ...", imgname);
+ 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);
+ res = write_html_image (setup, s1, s2, s3, item, items);
+ g_free (s1);
+ g_free (s2);
+ g_free (s3);
+ g_free (imgname);
+ if (! res ) continue;
+ if (setup->verbose) printf (" done.\n");
+ }
}
}
}
diff --git a/items.c b/items.c
index 527a5c4..2af0692 100644
--- a/items.c
+++ b/items.c
@@ -40,6 +40,7 @@ parse_album_xml (const char *filename, TAlbum *index)
int count;
int i;
char *s;
+ char *node_name;
TIndexItem *item;
xml = xml_parser_load (filename);
@@ -84,7 +85,10 @@ parse_album_xml (const char *filename, TAlbum *index)
index->border_style = xml_file_get_node_attribute (xml, "/gallery/general/border", "style");
/* Section Items */
- count = xml_file_node_get_children_count (xml, "/gallery/items/item");
+ count = xml_file_node_get_children_count (xml, "/gallery/items/*");
+ #ifdef __DEBUG_ALL__
+ printf("parse_album_xml: items count = %d\n", count);
+ #endif
index->items = g_ptr_array_new();
for (i = 0; i < count; i++)
@@ -92,47 +96,71 @@ parse_album_xml (const char *filename, TAlbum *index)
item = malloc (sizeof (TIndexItem));
memset (item, 0, sizeof (TIndexItem));
- s = g_strdup_printf ("/gallery/items/item[%d]", i + 1);
- if (index->type == GALLERY_TYPE_INDEX)
- item->path = xml_file_get_node_attribute (xml, s, "path");
- else
- item->path = xml_file_get_node_attribute (xml, s, "src");
- item->preview = xml_file_get_node_attribute (xml, s, "preview");
- item->quality = xml_file_get_node_attribute_long (xml, s, "quality", -1);
- item->width = xml_file_get_node_attribute_long (xml, s, "width", 0);
- item->height = xml_file_get_node_attribute_long (xml, s, "height", 0);
- item->border_style = xml_file_get_node_attribute (xml, s, "border");
- if (index->type == GALLERY_TYPE_ALBUM)
- item->thumbnail = xml_file_get_node_attribute (xml, s, "thumbnail");
- g_free (s);
-
- s = g_strdup_printf ("/gallery/items/item[%d]/title/text()", i + 1);
- item->title = xml_file_get_node_value (xml, s);
- g_free (s);
-
- s = g_strdup_printf ("/gallery/items/item[%d]/title_description/text()", i + 1);
- item->title_description = xml_file_get_node_value (xml, s);
- g_free (s);
-
- if (index->type == GALLERY_TYPE_INDEX) {
- s = g_strdup_printf ("/gallery/items/item[%d]/thumbnail", i + 1);
- item->thumbnail = xml_file_get_node_attribute (xml, s, "src");
+ s = g_strdup_printf ("/gallery/items/*[%d]", i + 1);
+ node_name = xml_file_get_node_name (xml, s);
+ if (! node_name) continue;
+ #ifdef __DEBUG_ALL__
+ printf("parse_album_xml: item[%d] = '%s'\n", i + 1, node_name);
+ #endif
+
+ if (strcmp (node_name, "item") == 0) {
+ item->type = INDEX_ITEM_TYPE_PICTURE;
+ if (index->type == GALLERY_TYPE_INDEX)
+ item->path = xml_file_get_node_attribute (xml, s, "path");
+ else
+ item->path = xml_file_get_node_attribute (xml, s, "src");
+ item->preview = xml_file_get_node_attribute (xml, s, "preview");
+ item->quality = xml_file_get_node_attribute_long (xml, s, "quality", -1);
+ item->width = xml_file_get_node_attribute_long (xml, s, "width", 0);
+ item->height = xml_file_get_node_attribute_long (xml, s, "height", 0);
+ item->border_style = xml_file_get_node_attribute (xml, s, "border");
+ if (index->type == GALLERY_TYPE_ALBUM)
+ item->thumbnail = xml_file_get_node_attribute (xml, s, "thumbnail");
g_free (s);
- }
- s = g_strdup_printf ("/gallery/items/item[%d]/nofullsize", i + 1);
- item->nofullsize = (xml_file_get_node_present (xml, s) || item->path == NULL);
- g_free (s);
+ s = g_strdup_printf ("/gallery/items/*[%d]/title/text()", i + 1);
+ item->title = xml_file_get_node_value (xml, s);
+ g_free (s);
+
+ s = g_strdup_printf ("/gallery/items/*[%d]/title_description/text()", i + 1);
+ item->title_description = xml_file_get_node_value (xml, s);
+ g_free (s);
- if (item->path || item->preview)
- {
- g_ptr_array_add (index->items, item);
+ if (index->type == GALLERY_TYPE_INDEX) {
+ s = g_strdup_printf ("/gallery/items/*[%d]/thumbnail", i + 1);
+ item->thumbnail = xml_file_get_node_attribute (xml, s, "src");
+ g_free (s);
}
+
+ s = g_strdup_printf ("/gallery/items/*[%d]/nofullsize", i + 1);
+ item->nofullsize = (xml_file_get_node_present (xml, s) || item->path == NULL);
+ g_free (s);
+
+ if (item->path || item->preview)
+ {
+ g_ptr_array_add (index->items, item);
+ }
+ else
+ {
+ fprintf (stderr, "%s: No image src specified, skipping!\n", filename);
+ free (item);
+ }
+ }
else
- {
- fprintf (stderr, "%s: No image src specified, skipping!\n", filename);
- free (item);
- }
+ if (strcmp (node_name, "separator") == 0) {
+ item->type = INDEX_ITEM_TYPE_SEPARATOR;
+
+ s = g_strdup_printf ("/gallery/items/*[%d]/text()", i + 1);
+ item->title = xml_file_get_node_value (xml, s);
+ g_free (s);
+
+ g_ptr_array_add (index->items, item);
+ }
+ else {
+ /* Free the item if nobody cares */
+ free (item);
+ }
+ free (node_name);
}
xml_parser_close (xml);
diff --git a/items.h b/items.h
index b3ebf39..1c8e989 100644
--- a/items.h
+++ b/items.h
@@ -27,6 +27,11 @@ typedef enum {
GALLERY_TYPE_ALBUM = 1 << 1
} TGalleryType;
+typedef enum {
+ INDEX_ITEM_TYPE_PICTURE = 1 << 0,
+ INDEX_ITEM_TYPE_SEPARATOR = 1 << 1
+} TIndexItemType;
+
typedef struct {
TGalleryType type;
char *ID;
@@ -55,6 +60,7 @@ typedef struct {
unsigned long height;
gboolean nofullsize;
char *border_style;
+ TIndexItemType type;
} TIndexItem;
diff --git a/sample/src/CIAF_1/index.xml b/sample/src/CIAF_1/index.xml
index 9fc7d6e..3440c74 100644
--- a/sample/src/CIAF_1/index.xml
+++ b/sample/src/CIAF_1/index.xml
@@ -10,7 +10,7 @@
This album sets border style "border_none" for preview images.
]]></description>
<footnote> <![CDATA[
- This is footnote in album view.
+ This is a footnote in album view.
]]>
</footnote>
@@ -37,6 +37,8 @@
<title_description>This photo doesn't contain link to original image, but src parameter is specified.</title_description>
</item>
+ <separator><![CDATA[This is a separator inside a single album. We <u>can</u> <small>have</small> <strong>CDATA</strong> entries here!]]></separator>
+
<item preview="preview/img_6802d.jpg">
<title>Photo title</title>
<title_description>This photo doesn't contain link to original image nor the src parameter, EXIF data are extracted from the preview image.</title_description>
@@ -62,6 +64,8 @@
<title_description><![CDATA[Can contain <a href="http://cgg.bzatek.net/" title="Cataract Gallery Generator" class="footermail">links</a> etc...]]></title_description>
</item>
+ <separator>Border styles demo</separator>
+
<item src="img_6802e.jpg" border="frame_white">
<title>White frame</title>
<title_description>This particular image overrides both global and album border styles.</title_description>
@@ -72,6 +76,8 @@
<title_description>This particular image overrides both global and album border styles.</title_description>
</item>
+ <separator>Misc.</separator>
+
<item preview="preview/img_6802g.jpg" thumbnail="thumbnails/gallery_thumbnails.gif">
<title>Custom thumbnail</title>
<title_description>This item uses supplied thumbnail</title_description>
diff --git a/sample/src/index.xml b/sample/src/index.xml
index 0e143d2..e7368ed 100644
--- a/sample/src/index.xml
+++ b/sample/src/index.xml
@@ -24,6 +24,8 @@
<thumbnail src="CIAF_1/img_6802.jpg" />
</item>
+ <separator>This is a separator</separator>
+
<item path="subdir">
<title>Going deeper...</title>
<title_description>nesting</title_description>
diff --git a/templates/styles.css b/templates/styles.css
index dfaf476..8154968 100644
--- a/templates/styles.css
+++ b/templates/styles.css
@@ -388,3 +388,30 @@ img#frame_white {
border: 20px solid white;
}
+
+
+div.separators {
+ position: relative;
+ display: block;
+ float: left;
+ width: 100%;
+ text-align: left;
+ font-variant: small-caps;
+ font-family: "Trebuchet MS", "DejaVu Sans", "Bitstream Vera Sans", sans-serif;
+ color: #C0C0C0;
+}
+
+div.album_list_separator {
+ margin: 70px 0px 30px 0px;
+ font-size: 35px;
+ letter-spacing: 2px;
+ border-bottom: 1px solid #606060;
+}
+
+div.index_separator {
+ margin: 50px 0px 20px 0px;
+ font-size: 28px;
+ letter-spacing: 1px;
+ border-bottom: 1px solid #606060;
+}
+
diff --git a/templates/template-album.tmpl b/templates/template-album.tmpl
index ead7eaa..03bca5e 100644
--- a/templates/template-album.tmpl
+++ b/templates/template-album.tmpl
@@ -49,6 +49,11 @@
</a>
</div>
<!-- $(END_IMG_LIST_PORTRAIT) -->
+ <!-- $(BEGIN_LIST_SEPARATOR) -->
+ <div class="separators">
+ <div class="index_separator"><!-- $(LIST_SEPARATOR_TITLE) --></div>
+ </div>
+ <!-- $(END_LIST_SEPARATOR) -->
<!-- $(END_IMG_LIST) -->
</div>
diff --git a/templates/template-index.tmpl b/templates/template-index.tmpl
index 1feecf6..44fb508 100644
--- a/templates/template-index.tmpl
+++ b/templates/template-index.tmpl
@@ -53,6 +53,11 @@
</a>
</div>
<!-- $(END_IMG_LIST_PORTRAIT) -->
+ <!-- $(BEGIN_LIST_SEPARATOR) -->
+ <div class="separators">
+ <div class="album_list_separator"><!-- $(LIST_SEPARATOR_TITLE) --></div>
+ </div>
+ <!-- $(END_LIST_SEPARATOR) -->
<!-- $(END_IMG_LIST) -->
</div>
diff --git a/xml-parser.c b/xml-parser.c
index 2b3005a..eb6c86f 100644
--- a/xml-parser.c
+++ b/xml-parser.c
@@ -79,6 +79,37 @@ xml_parser_close (TXMLFile *file)
}
}
+/*
+ * xml_file_get_node_name: retrieve name of the XPath node
+ */
+char *
+xml_file_get_node_name (TXMLFile *file, const char *x_path)
+{
+ xmlXPathObjectPtr xpathObj;
+ xmlNodePtr cur;
+ char *attrv;
+
+ if ((! file) || (! x_path))
+ return NULL;
+
+ /* Evaluate xpath expression */
+ xpathObj = xmlXPathEvalExpression ((const xmlChar *) x_path, file->xpathCtx);
+ if (xpathObj == NULL) {
+ fprintf (stderr, "Error: unable to evaluate xpath expression \"%s\"\n", x_path);
+ return NULL;
+ }
+
+ attrv = NULL;
+ if ((xpathObj->nodesetval) && (xpathObj->nodesetval->nodeNr > 0)) {
+ cur = xpathObj->nodesetval->nodeTab[0];
+ if (cur->name)
+ attrv = strdup ((const char *) cur->name);
+ }
+
+ xmlXPathFreeObject (xpathObj);
+ return attrv;
+}
+
/*
* xml_file_get_node_value: retrieve string value from XPath node
diff --git a/xml-parser.h b/xml-parser.h
index 031bf6b..02be628 100644
--- a/xml-parser.h
+++ b/xml-parser.h
@@ -39,6 +39,11 @@ TXMLFile * xml_parser_load (const char *filename);
void xml_parser_close (TXMLFile *file);
/*
+ * xml_file_get_node_name: retrieve name of the XPath node
+ */
+char * xml_file_get_node_name (TXMLFile *file, const char *x_path);
+
+/*
* xml_file_get_node_value: retrieve string value from XPath node
* - multiple matched nodes will be concatenated into one string
* - otherwise please use [0], [1] etc. quantificators