diff options
| author | Raghuram Subramani <raghus2247@gmail.com> | 2025-06-20 19:39:38 +0530 |
|---|---|---|
| committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-06-20 19:39:38 +0530 |
| commit | 9f844fa3a032fc92e69cb5028a9b6e8a5ef0a235 (patch) | |
| tree | 60a8a6542bf2f0534d839a710ede816d7695a5d6 /src/engine.c | |
| parent | e4c5d83e418f1a045758339779fb49b635db2bdb (diff) | |
(lexer): add support for contentfor key
Diffstat (limited to 'src/engine.c')
| -rw-r--r-- | src/engine.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/engine.c b/src/engine.c index 4e4d037..e4d362e 100644 --- a/src/engine.c +++ b/src/engine.c @@ -23,12 +23,18 @@ ingest(char **buffer) if (directive == NULL) break; - if (directive->type == INCLUDE) { + switch (directive->type) { + case INCLUDE: { char *operand = (char *) directive->operands; char *partial_path; asprintf(&partial_path, "%s/%s/%s", DIRECTORY, PARTIALS, operand); FILE *f = fopen(partial_path, "r"); + if (f == NULL) { + printf("Could not open: %s\n", partial_path); + return; + } + unsigned int size = fsize(f); char *partial_content = fcontent(f, size); @@ -44,6 +50,16 @@ ingest(char **buffer) temp_buffer + match->offset + match->length); free(temp_buffer); + break; + } + case CONTENTFOR: { + contentfor_operands_t *operand + = (contentfor_operands_t *) directive->operands; + printf("CONTENTFOR: %s\n", operand->key); + + return; + break; + } } free(directive); |
