summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2009-04-11 16:39:33 +0200
committerTomas Bzatek <tbzatek@users.sourceforge.net>2009-04-11 16:39:33 +0200
commit498e7aaa9e657ef3ff0406964d62166e37e0299f (patch)
treee2f429864abe12ee870f7fca50423404d9aa5fb2
parent9c2c964727e4a484acf7f97267a3cf1c8fbacd89 (diff)
downloadcataract-498e7aaa9e657ef3ff0406964d62166e37e0299f.tar.xz
Support for interspaces
-rw-r--r--sample/src/CIAF_1/index.xml6
-rw-r--r--sample/src/index.xml4
-rw-r--r--src/generators.c6
-rw-r--r--src/items.c10
-rw-r--r--src/items.h3
-rw-r--r--templates/styles.css23
-rw-r--r--templates/template-album.tmpl5
-rw-r--r--templates/template-index.tmpl5
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 @@
</item>
<separator><![CDATA[This is a separator inside a single album. We <span style="text-decoration: underline;">can</span> <small>have</small> <strong>CDATA</strong> entries here!]]></separator>
-
+
+ <interspace><![CDATA[This is so-called intespace - simple paragraph or a block with an additional information to the section. This may be used with &lt;separator&gt; but not necessarily, interspace can stand alone between items in the album. Useful for links or few senteces to separated topic.]]></interspace>
+
<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>
@@ -63,6 +65,8 @@
<title_description>Different quality settings.</title_description>
</item>
+ <interspace>Another interspace between items</interspace>
+
<item src="img_6850b.jpg" width="350" height="350">
<title>--</title>
<title_description>Different preview sizes. Sizes are maximal and aspect ratio is always kept.</title_description>
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 @@
<separator>This is a separator</separator>
+ <interspace>This is an interspace</interspace>
+
<item path="subdir">
<title>Going deeper...</title>
<title_description>nesting</title_description>
<thumbnail src="subdir/Tatry/img_7755.jpg" />
</item>
+ <interspace>This is an interspace</interspace>
+
<item path="hidden">
<hidden />
<title>This should not be visible</title>
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 @@
<div class="index_separator"><!-- $(LIST_SEPARATOR_TITLE) --></div>
</div>
<!-- $(END_LIST_SEPARATOR) -->
+ <!-- $(BEGIN_LIST_INTERSPACE) -->
+ <div class="interspace">
+ <div class="index_interspace"><!-- $(LIST_INTERSPACE_TITLE) --></div>
+ </div>
+ <!-- $(END_LIST_INTERSPACE) -->
<!-- $(END_IMG_LIST) -->
</div>
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 @@
<div class="album_list_separator"><!-- $(LIST_SEPARATOR_TITLE) --></div>
</div>
<!-- $(END_LIST_SEPARATOR) -->
+ <!-- $(BEGIN_LIST_INTERSPACE) -->
+ <div class="interspace">
+ <div class="album_list_interspace"><!-- $(LIST_INTERSPACE_TITLE) --></div>
+ </div>
+ <!-- $(END_LIST_INTERSPACE) -->
<!-- $(END_IMG_LIST) -->
</div>