Streaming-based templating library
 
 
 
Go to file
Jef Roosens 7c63b3db1d
chore: copy over project files
2024-03-27 11:16:15 +01:00
example chore: copy over project files 2024-03-27 11:16:15 +01:00
include/ltm chore: copy over project files 2024-03-27 11:16:15 +01:00
src chore: copy over project files 2024-03-27 11:16:15 +01:00
test chore: copy over project files 2024-03-27 11:16:15 +01:00
.editorconfig chore: copy over project files 2024-03-27 11:16:15 +01:00
.gitignore chore: copy over project files 2024-03-27 11:16:15 +01:00
Makefile chore: copy over project files 2024-03-27 11:16:15 +01:00
README.md chore: copy over project files 2024-03-27 11:16:15 +01:00
config.mk chore: copy over project files 2024-03-27 11:16:15 +01:00

README.md

LTM - Lander Template Module

This module provides an interface for generating char streams from a given template.

<body>
    <h1>{{ title }}</h1>
    <ul>
{{ item start }}
        <li><a href="{{ url }}">{{ name }}</a></li>
{{ item end }}
    </ul>
</body>

The above snippet shows everything the templating language currently offers; either singular variables (here: title) or nested templates (here: item). Note the absence of a loop construct. This is because each variable and nested template is implicitely already a loop; a variable or a nested template can be added as many times as needed, and they will appear in the order they were added.

Template strings are compiled into templates. From a template, an instance can be created to which the required data can be added to fill in the template. Instantiating a template does not modify the original template, meaning templates can be safely used concurrently.

Each inserted variable can get its data from a variety of sources, namely char buffers, files or a custom reader function. The resulting char stream is never fully loaded into memory; an instance can stream its content to a provided buffer to prevent unnecessary memory usage.