TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 229 subscribers
Post #24259 13
XTML – A C++ Template Engine for HTML

I’ve been working on XTML, a small C++ utility for processing template files and generating dynamic HTML. It’s not a framework or a CMS, just a templating tool with a clear evaluation pipeline: Lexer → Parser → AST → Evaluation.


**Features**

* **Variables & Placeholders:** Define variables and use `{{@varName}}` in templates.
* **Conditional Logic & Loops:** `if`, `else`, `while` for dynamic generation.
* **Expression Evaluation:** Supports math, string operations, and arrays.
* **Function & Module System:** Define functions in templates or extend via C++ DLL modules.
* **HTML Blocks in Expressions:** You can generate HTML directly from evaluated expressions.

**Example**

<xtml>
var title = "XTML Example";
var num1 = 10;
var num2 = 5;
var sum = num1 + num2;
</xtml>

<html>
<head>
<title>{{@title}}</title>
</head>
<body>
<p>Sum: {{@sum}}</p>
</body>
</html>

**Output:**

<html>
<head>
<title>XTML Example</title>
</head>
<body>
<p>Sum: 15</p>
</body>
</html>

XTML is meant as a developer tool: you can include files, define functions, and extend it with your own modules. It uses a proper parsing pipeline so that templates are parsed into an AST, evaluated in a controlled context, and rendered efficiently.

It’s open-source under the MIT License. Feedback or suggestions for improvement are very welcome!


You can find the project here [Andy16823/xtml](https://github.com/Andy16823/xtml/tree/main) within the wiki you can find an short documentation and getting started guide.

https://redd.it/1oyjuov
@r_cpp
GitHub GitHub - Andy16823/xtml Contribute to Andy16823/xtml development by creating an account on GitHub.
More from @r_cpp
  1. Oct 12, 2026[Release] slick-logger v2.2.0 — Lock-free asynchronous C++20 logging with multi-process sh…
  2. Oct 12, 2026Cheap alternative to reboot parameters (nohz, rcu, isolcpus) for stable benchmarks When no…
  3. Oct 12, 2026This C++ drama is crazy - Adobe votes no https://www.youtube.com/watch?v=DEqx_NMMH9Q https…
  4. Oct 12, 2026FastNoise2: noise generation using SIMD and C++17 https://github.com/Auburn/FastNoise2 htt…
  5. Oct 12, 2026New C++ Conference Videos Released This Month - October 2026 (Updated To Include Videos Re…
  6. Oct 12, 2026cxvm: pin a GCC or Clang version per project on Linux (pyenv/nvm, but for C++ compilers) I…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →