aboutsummaryrefslogtreecommitdiff
path: root/include/render.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/render.h')
-rw-r--r--include/render.h74
1 files changed, 63 insertions, 11 deletions
diff --git a/include/render.h b/include/render.h
index ff83bab..9b5e9e2 100644
--- a/include/render.h
+++ b/include/render.h
@@ -1,25 +1,77 @@
#ifndef REVELA_RENDER_H
#define REVELA_RENDER_H
-#include <sys/stat.h>
-
#include "bstree.h"
#include "config.h"
-#include "template.h"
#include "components.h"
+#include "roscha.h"
+
+#include <sys/stat.h>
+
+/* Variables that are common to all templates */
+struct base_template {
+ /* Title of the gallery */
+ struct roscha_object *title;
+ /* The base url or index url of the gallery */
+ struct roscha_object *index;
+};
+
+/* Variables of the index template */
+struct index_template {
+ /* vector of all albums */
+ struct roscha_object *albums;
+ /* hmap with the year "name" and a vector of albums (see album template) */
+ struct roscha_object *years;
+};
+
+/*
+ * Variables for the album template and album elements in the albums vector of
+ * the index template.
+ */
+struct album_template {
+ /* The title of the album as stored in album.ini */
+ struct roscha_object *title;
+ /* The description of the album as stored in album.ini */
+ struct roscha_object *desc;
+ /* The url to the album */
+ struct roscha_object *link;
+ /* The date of the oldest photo in the album */
+ struct roscha_object *date;
+ /* The year of the oldest photo in the album */
+ struct roscha_object *year;
+ /* vector of n first thumbs; deprecated */
+ struct roscha_object *previews;
+ /* vector of all thumbs hmaps */
+ struct roscha_object *thumbs;
+};
+
+/* Variables for the image template and thumb hashmap */
+struct image_template {
+ /* The date the image was taken/created */
+ struct roscha_object *date;
+ /* The url to the image file */
+ struct roscha_object *source;
+ /* The url to the previous image page */
+ struct roscha_object *prev;
+ /* The url to the next image page */
+ struct roscha_object *next;
+};
+
struct render {
- /* Unja environment */
- struct env *env;
- /* List of years with albums in each year */
- struct vector *years;
- /* List of albums */
- struct vector *albums;
- /* Hashmap used for all templates */
- struct hashmap *common_vars;
+ /* Roscha environment */
+ struct roscha_env *env;
+ struct base_template base;
+ struct index_template index;
/* Modification time for the templates dir */
struct timespec modtime;
+ /* Refcounted vector of years with album hmaps */
+ struct roscha_object *years;
+ /* Refcounted vector album hmaps */
+ struct roscha_object *albums;
+ /* Count of the albums that were updated */
size_t albums_updated;
+ /* Whether we should simulate rendering or actually render templates */
bool dry_run;
};