|
cwist
Modern C web framework with libttak runtime
|
Simple template engine. More...


Go to the source code of this file.
Functions | |
| cwist_sstring * | cwist_template_render (const char *template_str, const cJSON *context) |
| Renders a template string with the given cJSON context. | |
| cwist_sstring * | cwist_template_render_file (const char *file_path, const cJSON *context) |
| Renders a template from a file with the given cJSON context. | |
Simple template engine.
Definition in file template.h.
| cwist_sstring * cwist_template_render | ( | const char * | template_str, |
| const cJSON * | context | ||
| ) |
Renders a template string with the given cJSON context.
This function parses a template string and replaces placeholders with values from the provided cJSON context.
It supports:
| template_str | The template string to render. |
| context | The cJSON object containing the data for the template. |
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 | ||
| ) |
Renders a template from a file with the given cJSON context.
Reads a template from the specified file path and renders it using the provided cJSON context.
| file_path | The path to the template file. |
| context | The cJSON object containing the data for the template. |
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().