No description
Find a file
2025-02-25 00:03:15 +01:00
.vscode Initial commit 2024-07-23 22:59:50 +02:00
source/ninox/gotmpl Move sub-template storage also into the common class 2024-08-04 12:21:12 +02:00
test Move sub-template storage also into the common class 2024-08-04 12:21:12 +02:00
.gitignore Initial commit 2024-07-23 22:59:50 +02:00
dub.json Upgrade ninox-d_std to 1.7.5 2024-07-24 00:46:09 +02:00
dub.selections.json Upgrade ninox-d_std to 1.7.5 2024-07-24 00:46:09 +02:00
LICENSE Add the missing LICENSE file 2025-02-25 00:03:15 +01:00
readme.md Initial commit 2024-07-23 22:59:50 +02:00

ninox.d-gotmpl

This package provides a template system like go's text/template.

License

The code in this repository is licensed under AGPL-3.0-or-later; for more details see the LICENSE file in the repository.

Usage

To use the engine, you first need to parse a template. To do this, use one of the parse* variants of Template:

import ninox.gotmpl : Template;

// This parses a template from the string "content", and gives it the name "name".
auto tmpl = Template.parseString("name", "content");

// This method parses a template from a file, and gives it the name "name".
auto tmpl = Template.parseFile("name", "path/to/template");

// It is also possible to parse directly from a libc stream handle (`FILE*`):
import core.stdc.stdio : FILE;
FILE* file = /*...*/;
auto tmpl = Template.parseFile("name", file);

Differences:

  • Unimplemented builtin functions:
    • printf
    • html
    • js
    • urlquery
    • slice