mirror of
https://github.com/alexhopeoconnor/DFTE.git
synced 2026-10-03 22:21:59 +10:00
1.4 KiB
1.4 KiB
Template language and lifecycle
Every token has the form %NAME%. DFTE resolves it from a PlaceholderRegistry according to its registered type.
| Registered type | Purpose |
|---|---|
registerProgmemData() |
Static flash-resident text |
registerRamData() |
Getter returning current const char* data |
registerProgmemTemplate() |
Nested PROGMEM template |
registerDynamicTemplate() |
Template fragment supplied at render time |
registerConditional() |
Choose a true, false, or skipped delegate |
registerIterator() |
Stream repeated item templates through an iterator handle |
Context lifecycle
- Populate a registry during setup.
- Attach it to a
TemplateContext. - Initialise the context with the root placeholder.
- Call
renderNextChunk()until complete or error. - Call
reset()before reusing a completed context for another root.
Do not treat isComplete() as a success result by itself; check hasError() as well.
Iterators
An iterator opens a handle, produces IteratorItemView values, then closes the handle. Handles are closed when rendering finishes, resets, stalls, or fails. The open, next, and close callbacks must therefore tolerate early termination.
Use AsyncDashboardDemo for a complete iterator example. Use NestedLayouts for partials and conditions.
Back to documentation · project overview.