From 75906fbb296d2ed7cd9ca05e1b7bf0c92f84a30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Thu, 24 Mar 2022 01:09:48 +0300 Subject: 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. --- include/render.h | 74 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 11 deletions(-) (limited to 'include/render.h') 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 - #include "bstree.h" #include "config.h" -#include "template.h" #include "components.h" +#include "roscha.h" + +#include + +/* 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; }; -- cgit v1.2.3