darktemple 0.0.2

Compile-time templates in jinja-like style.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

DarkTemple

Born in the darkest place universe full of darkest magic....

It is jinja-like compile-time template engine for D programming language. The key goal for this implementation is to make it reliable, simple and convenient;

Currently, this is dev version of library. Everything will be changed.

Usage

Simple example

assert(render!(`Hello "{{ name }}"!`, name) == `Hello "John"!`);

Example with file template

Let's assume that template file (named template.1.tmpl) has following content:

Test template.

User: {{ user.name }}
{# Show active or blocked state for user, depending on active field #}
User is {% if user.active %}active{% else %}blocked{% endif %}!

Use following code to render this file

struct User {
    string name;
    bool active;
}

User user = User(name: "John", active: true);
auto result = renderFile!("test-templates/template.1.tmpl", user);

And result will be:

Test template.

User: John

User is active!

License

DarkTemple is distributed under MPL-2.0 license.

Authors:
  • Dmytro Katyukha
Dependencies:
none
Versions:
0.0.6 2025-Jun-28
0.0.5 2025-Jun-28
0.0.4 2025-Jun-28
0.0.3 2025-Jun-28
0.0.2 2025-Jun-28
Show all 8 versions
Download Stats:
  • 0 downloads today

  • 29 downloads this week

  • 29 downloads this month

  • 29 downloads total

Score:
1.2
Short URL:
darktemple.dub.pm