Mercurial
comparison mrjunejune/template_renderer.h @ 264:04fee26ecce0
add authenticated JRPG conversation platform
Add reusable auth/session storage, owned conversation recovery, guest quotas, admin workflows, URL-routed conversation UI, mobile frame support, and parallel browser acceptance.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 07:34:12 -0700 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 263:ee04e4e69fed | 264:04fee26ecce0 |
|---|---|
| 1 #ifndef MJJ_TEMPLATE_RENDERER_H | |
| 2 #define MJJ_TEMPLATE_RENDERER_H | |
| 3 | |
| 4 /* | |
| 5 * template_renderer.h — site-owned HTML template renderer for mrjunejune. | |
| 6 * | |
| 7 * Expands {{/path}} include tokens by loading files relative to the | |
| 8 * configured document root. Provides overflow-safe output into a | |
| 9 * caller-supplied buffer allocated from a Dowa_Arena. | |
| 10 */ | |
| 11 | |
| 12 #include "dowa/dowa.h" | |
| 13 | |
| 14 /* | |
| 15 * Set the document root used for all subsequent renders. | |
| 16 * Must be called once before the first render (not thread-safe vs | |
| 17 * concurrent renders; fine to call before the server accepts requests). | |
| 18 * Defaults to "mrjunejune/src" if never called. | |
| 19 */ | |
| 20 void Mjj_Template_Renderer_Init(const char *src_root); | |
| 21 | |
| 22 /* | |
| 23 * Render the NUL-terminated template string `tmpl` into `out[0..cap-1]`, | |
| 24 * replacing every {{/path}} token with the contents of the file at | |
| 25 * g_src_root + path. `out` is always NUL-terminated on return. | |
| 26 * | |
| 27 * Returns TRUE — all text fit; out contains the fully expanded page. | |
| 28 * Returns FALSE — output exceeded cap, or tmpl is NULL. | |
| 29 * (out may contain a partial result; treat FALSE as a 500.) | |
| 30 * | |
| 31 * Missing includes are skipped silently; they never cause FALSE. | |
| 32 * arena is used only for temporary include-name copies (not freed here). | |
| 33 */ | |
| 34 boolean Mjj_Template_Render( | |
| 35 char *out, size_t cap, const char *tmpl, Dowa_Arena *arena); | |
| 36 | |
| 37 /* | |
| 38 * Load the file at g_src_root + path, then render its includes. | |
| 39 * Returns FALSE if the file cannot be opened or if cap is exceeded. | |
| 40 * Equivalent to loading the file and calling Mjj_Template_Render. | |
| 41 */ | |
| 42 boolean Mjj_Template_Render_File( | |
| 43 char *out, size_t cap, const char *path, Dowa_Arena *arena); | |
| 44 | |
| 45 #endif /* MJJ_TEMPLATE_RENDERER_H */ |