aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-07-30 20:56:26 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2025-07-30 20:56:26 +0530
commita34f076224a5223ceb4538d9997e3c69204e7c78 (patch)
tree74051343c8830df2c7599db1d73b7f180291c877
parentb7be433cfeb520cc8cd5c0020b8e8d16888bf8ec (diff)
template: use engine->config to fetch template
-rw-r--r--src/template.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/template.c b/src/template.c
index 1ebda4b..838ed43 100644
--- a/src/template.c
+++ b/src/template.c
@@ -137,6 +137,22 @@ template_write(engine_t *engine, FILE *f, void *doc, bool is_markdown)
= list_find_corresponding_value_from_ptr_wrapper(
keys, templates, "base.html");
+ if (engine != NULL && engine->config != NULL) {
+ char *template_name
+ = get_wrapped(list_find_corresponding_value_from_ptr_wrapper(
+ engine->config->keys, engine->config->values, "template"));
+
+ if (template_name != NULL) {
+ template = list_find_corresponding_value_from_ptr_wrapper(
+ keys, templates, template_name);
+
+ if (template == NULL) {
+ printf("Could not find template %s\n", template_name);
+ return;
+ }
+ }
+ }
+
for (size_t i = 0; i < template->components->size; i++) {
directive_t *match = list_get(template->components, i);