From 498e7aaa9e657ef3ff0406964d62166e37e0299f Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sat, 11 Apr 2009 16:39:33 +0200 Subject: Support for interspaces --- sample/src/CIAF_1/index.xml | 6 +++++- sample/src/index.xml | 4 ++++ src/generators.c | 6 ++++++ src/items.c | 10 ++++++++++ src/items.h | 3 ++- templates/styles.css | 23 +++++++++++++++++++++++ templates/template-album.tmpl | 5 +++++ templates/template-index.tmpl | 5 +++++ 8 files changed, 60 insertions(+), 2 deletions(-) diff --git a/sample/src/CIAF_1/index.xml b/sample/src/CIAF_1/index.xml index 8f4abb7..a73861e 100644 --- a/sample/src/CIAF_1/index.xml +++ b/sample/src/CIAF_1/index.xml @@ -47,7 +47,9 @@ can have CDATA entries here!]]> - + + + Photo title This photo doesn't contain link to original image nor the src parameter, EXIF data are extracted from the preview image. @@ -63,6 +65,8 @@ Different quality settings. + Another interspace between items + -- Different preview sizes. Sizes are maximal and aspect ratio is always kept. diff --git a/sample/src/index.xml b/sample/src/index.xml index 07881d5..904e074 100644 --- a/sample/src/index.xml +++ b/sample/src/index.xml @@ -26,12 +26,16 @@ This is a separator + This is an interspace + Going deeper... nesting + This is an interspace + This should not be visible diff --git a/src/generators.c b/src/generators.c index 8dd6a58..0a21b7e 100644 --- a/src/generators.c +++ b/src/generators.c @@ -332,6 +332,7 @@ write_html_album (TGallerySetup *setup, block_parser_register_key (block_parser, "IMG_LIST_LANDSCAPE", NULL); block_parser_register_key (block_parser, "IMG_LIST_PORTRAIT", NULL); block_parser_register_key (block_parser, "LIST_SEPARATOR", NULL); + block_parser_register_key (block_parser, "LIST_INTERSPACE", NULL); block_parser_register_key (block_parser, "GO_UP", "GO_UP"); @@ -392,6 +393,11 @@ write_html_album (TGallerySetup *setup, s1 = block_parser_get_data (block_parser, "LIST_SEPARATOR"); replace_table_add_key (local_replace_table, "LIST_SEPARATOR_TITLE", item->title); break; + + case INDEX_ITEM_TYPE_INTERSPACE: + s1 = block_parser_get_data (block_parser, "LIST_INTERSPACE"); + replace_table_add_key (local_replace_table, "LIST_INTERSPACE_TITLE", item->title); + break; } if (s1) { diff --git a/src/items.c b/src/items.c index 2b9a1ad..27034f2 100644 --- a/src/items.c +++ b/src/items.c @@ -197,6 +197,16 @@ parse_album_xml (const char *filename, TAlbum *index) g_ptr_array_add (index->items, item); } + else + if (strcmp (node_name, "interspace") == 0) { + item->type = INDEX_ITEM_TYPE_INTERSPACE; + + 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); diff --git a/src/items.h b/src/items.h index daaefb0..b7be433 100644 --- a/src/items.h +++ b/src/items.h @@ -29,7 +29,8 @@ typedef enum { typedef enum { INDEX_ITEM_TYPE_PICTURE = 1 << 0, - INDEX_ITEM_TYPE_SEPARATOR = 1 << 1 + INDEX_ITEM_TYPE_SEPARATOR = 1 << 1, + INDEX_ITEM_TYPE_INTERSPACE = 1 << 2 } TIndexItemType; typedef struct { diff --git a/templates/styles.css b/templates/styles.css index 8a303da..d99b77f 100644 --- a/templates/styles.css +++ b/templates/styles.css @@ -256,6 +256,29 @@ div.index_separator { } +/****** ALBUM/INDEX INTERSPACES ******/ +div.interspace { + float: left; + clear: both; + width: 100%; + text-align: left; + color: #D0D0D0; + margin: 0em 3em 0em 0.8em; +} + +div.album_list_interspace { + margin: 0.65em 0 0.75em 0; + font-size: 125%; + line-height: 140%; +} + +div.index_interspace { + margin: 0.6em 0 1.1em 0; + font-size: 110%; + line-height: 140%; +} + + /****** FOOTNOTE ******/ div.footnote { padding: 1em 1.25em 3.2em 1.25em; diff --git a/templates/template-album.tmpl b/templates/template-album.tmpl index 45f6273..4942fa8 100644 --- a/templates/template-album.tmpl +++ b/templates/template-album.tmpl @@ -54,6 +54,11 @@
+ +
+
+
+ diff --git a/templates/template-index.tmpl b/templates/template-index.tmpl index 78baedb..994c550 100644 --- a/templates/template-index.tmpl +++ b/templates/template-index.tmpl @@ -58,6 +58,11 @@
+ +
+
+
+ -- cgit v1.2.3