aboutsummaryrefslogtreecommitdiff
path: root/include/render.h
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-03-24 01:09:48 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-03-24 01:09:48 +0300
commit75906fbb296d2ed7cd9ca05e1b7bf0c92f84a30b (patch)
tree863208f0605c1b609cf00d1e0e418c923ed40724 /include/render.h
parent9297781c79dbfe68a817474d0395001fd9746770 (diff)
downloadrevela-75906fbb296d2ed7cd9ca05e1b7bf0c92f84a30b.tar.gz
revela-75906fbb296d2ed7cd9ca05e1b7bf0c92f84a30b.zip
Switch from unja to roscha
Still a WIP, some bugs need to be fixed. Also change the license to GPL from LGPL. It was always meant to be GPL, not sure what brain fart caused this.
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;
};