aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-05-28 05:01:18 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-05-28 05:01:18 +0200
commitf2f4bb7e63d91a59b8252db64b553d9aaa6ba8a7 (patch)
treef4afba9e8dbcc4b2c24fe52c0113d84af3a497f4
parent7f5ccf8cd227e14683ef6c3bef5afb58f6857918 (diff)
downloadblogc-f2f4bb7e63d91a59b8252db64b553d9aaa6ba8a7.tar.gz
blogc-f2f4bb7e63d91a59b8252db64b553d9aaa6ba8a7.tar.bz2
blogc-f2f4bb7e63d91a59b8252db64b553d9aaa6ba8a7.zip
blogc: avoid parsing template when called with -p
-rw-r--r--src/blogc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/blogc.c b/src/blogc.c
index 2338c9e..329f4b1 100644
--- a/src/blogc.c
+++ b/src/blogc.c
@@ -219,13 +219,6 @@ main(int argc, char **argv)
goto cleanup2;
}
- sb_slist_t* l = blogc_template_parse_from_file(template, &err);
- if (err != NULL) {
- blogc_error_print(err);
- rv = 2;
- goto cleanup3;
- }
-
if (print != NULL) {
const char *val = sb_trie_lookup(config, print);
if (val == NULL) {
@@ -246,6 +239,13 @@ main(int argc, char **argv)
goto cleanup3;
}
+ sb_slist_t* l = blogc_template_parse_from_file(template, &err);
+ if (err != NULL) {
+ blogc_error_print(err);
+ rv = 2;
+ goto cleanup3;
+ }
+
char *out = blogc_render(l, s, config, listing);
bool write_to_stdout = (output == NULL || (0 == strcmp(output, "-")));