|
cwist
Modern C web framework with libttak runtime
|
Minimal template renderer supporting variable substitution and simple control flow. More...
#include "cwist/core/template/template.h"#include <cwist/core/mem/alloc.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include <stdbool.h>
Go to the source code of this file.
Macros | |
| #define | CWIST_TEMPLATE_MAX_DEPTH 32 |
| Maximum nesting depth for includes/control structures. | |
Functions | |
| cwist_sstring * | cwist_template_render (const char *template_str, const cJSON *context) |
| Render an in-memory template string against a JSON context object. | |
| cwist_sstring * | cwist_template_render_file (const char *file_path, const cJSON *context) |
| Load a template file from disk and render it against a JSON context. | |
Minimal template renderer supporting variable substitution and simple control flow.
Definition in file template.c.
| #define CWIST_TEMPLATE_MAX_DEPTH 32 |
Maximum nesting depth for includes/control structures.
Definition at line 18 of file template.c.
| cwist_sstring * cwist_template_render | ( | const char * | template_str, |
| const cJSON * | context | ||
| ) |
Render an in-memory template string against a JSON context object.
Renders a template string with the given cJSON context.
| template_str | Template source to render. |
| context | JSON object supplying values for substitutions and control flow. |
Definition at line 431 of file template.c.
References cap.
Referenced by cwist_template_render_file().
| cwist_sstring * cwist_template_render_file | ( | const char * | file_path, |
| const cJSON * | context | ||
| ) |
Load a template file from disk and render it against a JSON context.
Renders a template from a file with the given cJSON context.
| file_path | Path to the template file to open. |
| context | JSON object supplying values for substitutions and control flow. |
Definition at line 442 of file template.c.
References cap, cwist_alloc(), CWIST_DEFER_FREE, and cwist_template_render().