HxDTL - Haxe implementation of Django Template Language
Haxe Other
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
demo
doc
resource
src
test
.gitignore
.gitmodules
.mlib
.munit
.travis.yml
LICENSE.txt
README.md
Run.bat
build.hxml
hxdtl.hxproj
hxdtl.sublime-project
install.hxml
test.hxml

README.md

HxDTL

HxDTL is a Haxe implementation of Django Template Language.

Status Build Status

Current release: HxDtl 0.1.1. Be aware of the changes to the API - it's not stable and will be modified in future releases.

You can also explore Roadmap to see the upcoming release details.

Installation

Haxelib release

$ haxelib install hxdtl

Latest development version

$ git clone https://github.com/ajukraine/hxdtl.git
$ cd hxdtl
$ git submodule update --init
$ haxelib install mlib
$ haxe install.hxml

Usage

Create template from string and render it:

import hxdtl.Template;

var tpl = new Template("
{% if Year > 2012 %}
    We have survived!
{% else %}
    Hey, {{ friend }}, are we dead?
{% endif %}
");
var data = { Year: 2013, friend: "Billy" };

trace(tpl.render(data));

Get template from file system and render it:

import hxdtl.Template;
import hxdtl.Environment;

var env = new Environment({
    path: "path/to/templates",
    useCache: true
});
var tpl = env.getTemplate("some_template.dtl");

trace(tpl.render({ Year: 2013, friend: "Billy" }));