aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-make/ctx.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2019-04-03 00:39:56 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2019-04-03 00:40:03 +0200
commit3afa72febc3d6ed7003d10f3a5c4211bf761d746 (patch)
treeb102b9fa81ce90c99a251156635aee74dfd012e9 /src/blogc-make/ctx.c
parentadc3e6d77117d095e485ec64a93f1b64ffbf2cea (diff)
downloadblogc-3afa72febc3d6ed7003d10f3a5c4211bf761d746.tar.gz
blogc-3afa72febc3d6ed7003d10f3a5c4211bf761d746.tar.bz2
blogc-3afa72febc3d6ed7003d10f3a5c4211bf761d746.zip
make: added support for `blogc -e`
must still add tests
Diffstat (limited to 'src/blogc-make/ctx.c')
-rw-r--r--src/blogc-make/ctx.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/blogc-make/ctx.c b/src/blogc-make/ctx.c
index 334a11d..b8b7bb6 100644
--- a/src/blogc-make/ctx.c
+++ b/src/blogc-make/ctx.c
@@ -256,6 +256,14 @@ bm_ctx_new(bm_ctx_t *base, const char *settings_file, const char *argv0,
const char *content_dir = bm_ctx_settings_lookup(rv, "content_dir");
const char *post_prefix = bm_ctx_settings_lookup(rv, "post_prefix");
const char *source_ext = bm_ctx_settings_lookup(rv, "source_ext");
+ const char *listing_entry = bm_ctx_settings_lookup(rv, "listing_entry");
+
+ rv->listing_entry_fctx = NULL;
+ if (listing_entry != NULL) {
+ char *f = bm_generate_filename(content_dir, NULL, listing_entry, source_ext);
+ rv->listing_entry_fctx = bm_filectx_new(rv, f, listing_entry, NULL);
+ free(f);
+ }
rv->posts_fctx = NULL;
if (settings->posts != NULL) {
@@ -317,6 +325,7 @@ bm_ctx_reload(bm_ctx_t **ctx)
bm_filectx_reload((*ctx)->main_template_fctx);
bm_filectx_reload((*ctx)->atom_template_fctx);
+ bm_filectx_reload((*ctx)->listing_entry_fctx);
for (bc_slist_t *tmp = (*ctx)->posts_fctx; tmp != NULL; tmp = tmp->next)
bm_filectx_reload((bm_filectx_t*) tmp->data);
@@ -357,6 +366,8 @@ bm_ctx_free_internal(bm_ctx_t *ctx)
ctx->atom_template_fctx = NULL;
bm_filectx_free(ctx->settings_fctx);
ctx->settings_fctx = NULL;
+ bm_filectx_free(ctx->listing_entry_fctx);
+ ctx->listing_entry_fctx = NULL;
bc_slist_free_full(ctx->posts_fctx, (bc_free_func_t) bm_filectx_free);
ctx->posts_fctx = NULL;