diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-10-07 19:57:25 -0300 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-10-07 19:57:25 -0300 |
commit | b54d7c65021d7d65c6a2b0088a6c3591e10ccfb3 (patch) | |
tree | d7e0a90501df18458c999cdeace1b963125e9a60 /src/renderer.c | |
parent | 1769387fb663d215871a901356dcd484c9587e58 (diff) | |
download | blogc-b54d7c65021d7d65c6a2b0088a6c3591e10ccfb3.tar.gz blogc-b54d7c65021d7d65c6a2b0088a6c3591e10ccfb3.tar.bz2 blogc-b54d7c65021d7d65c6a2b0088a6c3591e10ccfb3.zip |
renderer: accept empty list of files with -l
Diffstat (limited to 'src/renderer.c')
-rw-r--r-- | src/renderer.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/renderer.c b/src/renderer.c index bf8b8cc..47a5f87 100644 --- a/src/renderer.c +++ b/src/renderer.c @@ -71,7 +71,7 @@ blogc_format_date(const char *date, b_trie_t *global, b_trie_t *local) char* blogc_render(b_slist_t *tmpl, b_slist_t *sources, b_trie_t *config, bool listing) { - if (tmpl == NULL || sources == NULL) + if (tmpl == NULL) return NULL; b_slist_t *current_source = NULL; @@ -136,6 +136,16 @@ blogc_render(b_slist_t *tmpl, b_slist_t *sources, b_trie_t *config, bool listing } } if (0 == strcmp("listing", stmt->value)) { + if (sources == NULL) { + + // we can just skip anything and walk until the next + // 'endblock' + while (stmt->type != BLOGC_TEMPLATE_ENDBLOCK_STMT) { + tmp = tmp->next; + stmt = tmp->data; + } + break; + } if (current_source == NULL) { listing_start = tmp; current_source = sources; |