Mercurial
view mrjunejune/template_renderer.h @ 271:13d61401c57d
redirect Copilot cache to service state
Set XDG_CACHE_HOME from the configured inference state so the systemd service can extract Copilot outside its protected home directory.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 13:24:05 -0700 |
| parents | 04fee26ecce0 |
| children |
line wrap: on
line source
#ifndef MJJ_TEMPLATE_RENDERER_H #define MJJ_TEMPLATE_RENDERER_H /* * template_renderer.h — site-owned HTML template renderer for mrjunejune. * * Expands {{/path}} include tokens by loading files relative to the * configured document root. Provides overflow-safe output into a * caller-supplied buffer allocated from a Dowa_Arena. */ #include "dowa/dowa.h" /* * Set the document root used for all subsequent renders. * Must be called once before the first render (not thread-safe vs * concurrent renders; fine to call before the server accepts requests). * Defaults to "mrjunejune/src" if never called. */ void Mjj_Template_Renderer_Init(const char *src_root); /* * Render the NUL-terminated template string `tmpl` into `out[0..cap-1]`, * replacing every {{/path}} token with the contents of the file at * g_src_root + path. `out` is always NUL-terminated on return. * * Returns TRUE — all text fit; out contains the fully expanded page. * Returns FALSE — output exceeded cap, or tmpl is NULL. * (out may contain a partial result; treat FALSE as a 500.) * * Missing includes are skipped silently; they never cause FALSE. * arena is used only for temporary include-name copies (not freed here). */ boolean Mjj_Template_Render( char *out, size_t cap, const char *tmpl, Dowa_Arena *arena); /* * Load the file at g_src_root + path, then render its includes. * Returns FALSE if the file cannot be opened or if cap is exceeded. * Equivalent to loading the file and calling Mjj_Template_Render. */ boolean Mjj_Template_Render_File( char *out, size_t cap, const char *path, Dowa_Arena *arena); #endif /* MJJ_TEMPLATE_RENDERER_H */