-
Notifications
You must be signed in to change notification settings - Fork 0
Home
XTML is a lightweight template engine written in C++ that allows you to generate dynamic HTML using variables, expressions, control flow, and custom functions. This page provides a short introduction on how to install, run, and use XTML.
- Download the latest release from the Releases page.
- Extract the archive.
- Ensure xtml.exe is available in your PATH or in the working directory.
No additional libraries or runtimes are required.
To process an .xtml file and generate HTML:
xtml build input.xtml
XTML writes the output HTML file in the same directory as the input.
Check the installed version: xtml version
<xtml>
var title = "XTML Demo";
var number = 5;
var squared = number * number;
if (squared > 10) {
print("Value is greater than 10");
}
</xtml>
<h1>{{@title}}</h1>
<p>Squared: {{@squared}}</p>
Run xtml build example.xtml
Resulting output:
<h1>XTML Demo</h1>
<p>Squared: 25</p>
XTML supports:
- Variables and expressions
- Functions and user-defined functions
- Loops
while``Forand conditionsif` `else if` `else` - Inline HTML generation
- Side-Effects using the
exprkeyword to buffer the output into an variable - Module system for custom native functions (DLLs)
- Native helper functions (e.g., std::randStr)
You can extend XTML by writing your own modules in C++.
A module inherits from the Module class and registers functions via the FunctionRegistry.
Modules are loaded automatically when you call a function defined inside them.
A detailed module tutorial can be found in the Modules wiki page.
project/
├─ index.xtml
├─ functions.xtml (optional)
└─ modules/ (optional DLL extensions)
- Issues and feature requests can be submitted on GitHub.
- Pull requests are welcome.
- The project is licensed under MIT.