summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2011-06-04 19:04:08 +0200
committerTomas Bzatek <tbzatek@users.sourceforge.net>2011-06-04 19:04:08 +0200
commit0c2ec4f8a357b8add78bce44a298225c00c4e16e (patch)
treef5a09896d32db4979e992dcb848e3aa8710a3110
parentb960b2a4579bf5cd25124191ff37c5ad30a529ff (diff)
downloadcataract-0c2ec4f8a357b8add78bce44a298225c00c4e16e.tar.xz
Port Go Up link to the new defines system
-rw-r--r--sample/src/setup.xml4
-rw-r--r--src/generators.c13
-rw-r--r--src/setup.c1
-rw-r--r--src/setup.h1
-rw-r--r--templates/default.xml6
-rw-r--r--templates/template_album.html4
-rw-r--r--templates/template_index.html4
7 files changed, 12 insertions, 21 deletions
diff --git a/sample/src/setup.xml b/sample/src/setup.xml
index 6ebb46c..d042630 100644
--- a/sample/src/setup.xml
+++ b/sample/src/setup.xml
@@ -75,10 +75,6 @@ And the second line.</add_copyright>
<!-- enabled: jump to the parent item when going up in the structure -->
<!-- disabled: links will always go to the top of the parent page -->
<use_inpage_links value="yes" />
-
- <!-- enabled: show "Go Up..." links if not top-level (default) -->
- <!-- disabled: never show that link -->
- <show_go_up value="yes" />
</navigation>
<feed enable="yes">
diff --git a/src/generators.c b/src/generators.c
index 168c5b0..dbf6667 100644
--- a/src/generators.c
+++ b/src/generators.c
@@ -345,6 +345,8 @@ write_html_album (TGallerySetup *setup,
g_free (s2);
g_free (s3);
}
+ if (! parent)
+ g_hash_table_replace (defines, g_strdup ("IS_ROOT"), g_strdup (""));
while (parent) {
s3 = make_string ("../", level);
@@ -433,7 +435,6 @@ write_html_album (TGallerySetup *setup,
block_parser_register_key (block_parser, "IMG_LIST_SQUARED", 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");
/* Read through the template and replace placeholders with real data */
@@ -442,16 +443,6 @@ write_html_album (TGallerySetup *setup,
if (line == NULL)
break;
- /* Blocks */
- if (block_parser_has_unused_data (block_parser, "GO_UP")) {
- block = block_parser_get_data (block_parser, "GO_UP");
- if (block) {
- replace_table_process (&block, global_replace_table);
- replace_table_add_key (global_replace_table, "GO_UP", items->parent_index && setup->show_go_up ? block : "");
- }
- g_free (block);
- }
-
if (block_parser_has_unused_data (block_parser, "IMG_LIST")) {
block = g_strdup ("");
diff --git a/src/setup.c b/src/setup.c
index 48e03c5..e88a292 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -116,7 +116,6 @@ parse_setup_xml (const gchar *filename)
/* navigation section */
setup->use_inpage_links = xml_file_get_node_attribute_boolean (xml, "/gallery_setup/navigation/use_inpage_links", "value", TRUE);
- setup->show_go_up = xml_file_get_node_attribute_boolean (xml, "/gallery_setup/navigation/show_go_up", "value", TRUE);
/* feed section */
setup->feed_enabled = xml_file_get_node_attribute_boolean (xml, "/gallery_setup/feed", "enable", FALSE);
diff --git a/src/setup.h b/src/setup.h
index 7b98634..56f7e84 100644
--- a/src/setup.h
+++ b/src/setup.h
@@ -72,7 +72,6 @@ typedef struct {
/* navigation section */
gboolean use_inpage_links;
- gboolean show_go_up;
/* feed section */
gboolean feed_enabled;
diff --git a/templates/default.xml b/templates/default.xml
index 826133a..c6cbd70 100644
--- a/templates/default.xml
+++ b/templates/default.xml
@@ -101,6 +101,12 @@
<define name="BORDER_STYLE" value="border_single" />
<!-- show EXIF table in single photo view (comment out to hide it) -->
<define name="SHOW_EXIF_TABLE" />
+ <!-- show "Go Up..." links if not top-level -->
+ <define name="SHOW_GO_UP" />
+
+ <!-- Other defines set by the generator:
+ IS_ROOT - indicates whether the index/album page is a main (root) page
+ -->
</theme>
<!-- Here you can define another theme, with different templates etc.
diff --git a/templates/template_album.html b/templates/template_album.html
index 9f31fb3..3d0af4f 100644
--- a/templates/template_album.html
+++ b/templates/template_album.html
@@ -24,9 +24,9 @@
<div class="master_content">
<!-- ## Description -->
<div class="description">
- <!-- $(BEGIN_GO_UP) -->
+ <!-- $(ifdef(SHOW_GO_UP)) --><!-- $(ifndef(IS_ROOT)) -->
<div class="desc_go_up">:. <a href="$(GO_UP_LINK)">Go Up</a></div>
- <!-- $(END_GO_UP) -->
+ <!-- $(endif(IS_ROOT)) --><!-- $(endif(SHOW_GO_UP)) -->
<div class="desc_title"><!-- $(TITLE) --></div>
<div class="desc_text"><!-- $(DESCRIPTION) --></div>
</div>
diff --git a/templates/template_index.html b/templates/template_index.html
index 01de113..1565a4a 100644
--- a/templates/template_index.html
+++ b/templates/template_index.html
@@ -24,9 +24,9 @@
<div class="master_content">
<!-- ## Description -->
<div class="description">
- <!-- $(BEGIN_GO_UP) -->
+ <!-- $(ifdef(SHOW_GO_UP)) --><!-- $(ifndef(IS_ROOT)) -->
<div class="desc_go_up">:. <a href="$(GO_UP_LINK)">Go Up</a></div>
- <!-- $(END_GO_UP) -->
+ <!-- $(endif(IS_ROOT)) --><!-- $(endif(SHOW_GO_UP)) -->
<div class="desc_title"><!-- $(TITLE) --></div>
<div class="desc_text"><!-- $(DESCRIPTION) --></div>
</div>