diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2021-11-08 23:29:08 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2021-11-08 23:29:08 +0300 |
commit | abbee959bf5c87a8b2ad0b2d55d9ddb955147892 (patch) | |
tree | d1d9f09c7a650499c282d4642faa06ac171abd29 /src/render.c | |
parent | af5ac2e6df9c3a9c0c7c5bd35125b81a69b68069 (diff) | |
download | revela-abbee959bf5c87a8b2ad0b2d55d9ddb955147892.tar.gz revela-abbee959bf5c87a8b2ad0b2d55d9ddb955147892.zip |
Minor fixes here and there
* Added year variable to album template
* Fixed a minor leak and dangling pointer
* Other small improvements
Diffstat (limited to 'src/render.c')
-rw-r--r-- | src/render.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/render.c b/src/render.c index 7c72cad..acd1de2 100644 --- a/src/render.c +++ b/src/render.c @@ -93,6 +93,8 @@ albums_walk(struct bstnode *node, void *data) hashmap_insert(album->map, "title", album->config->title); hashmap_insert(album->map, "desc", album->config->desc); hashmap_insert(album->map, "link", album->url); + hashmap_insert(album->map, "date", (char *)album->datestr); + hashmap_insert(album->map, "year", album->year); bstree_inorder_walk(album->images->root, images_walk, NULL); @@ -158,7 +160,7 @@ render_make_index(struct render *r, const char *path) bool render_make_album(struct render *r, const char *path, const struct album *album) { - hashmap_insert(r->common_vars, "album", album->map); + if (!r->dry_run) hashmap_insert(r->common_vars, "album", album->map); RENDER_MAKE_START; @@ -201,7 +203,7 @@ render_init(struct render *r, const char *root, struct site_config *conf, r->modtime = tstat.st_mtim; - if (r->dry_run) return true; + if (r->dry_run) goto cleanup; r->env = env_new(tmplpath); if (r->env == NULL) { @@ -221,6 +223,8 @@ render_init(struct render *r, const char *root, struct site_config *conf, bstree_inorder_walk(albums->root, albums_walk, (void *)r); +cleanup: + free(tmplpath); return true; } |