htpl

Htpl -- Template engine
https://github.com/ericfillipe1/htpl.git

To install, run:

haxelib install htpl 0.0.1 

See using Haxelib in Haxelib documentation for more information.

README.md

hscript + twig(tpl) = HTPL

HTPL is a template engine written in Haxe , inspired in twig and hscript

Here a small example of a HTPL:

	var	htpl = new HtplEnvironment([
			"" => "templates/",
			"ui" => "templates/ui"
		]);
	tpl.render("test.html")

in file templates/test.html

<% var  name = "HTPL"%>
<% var  v =  true %>
<% if v %>
    <%=name%>
<% endif  %>

Include File

<% var  file = "test2"%>
<% if file=="test2" %>
      <% include file+".html" ::upperCase%>
<% endif  %>

Apply Function

htpl.render("test2.html",{},[
	"MD5" => function (s:String){
		 return Md5.encode(s);
	}]
));

in file templates/test2.html

 <%= "12345" ::MD5%>

output

 827ccb0eea8a706c4c34a16891f84e7b

switch

<% var c=3 %>
<% switch (c)%>
	<% case 1 %>
	op1
	<% case 2 %>
	op2
	<% case 3 %>
	op3
<% endswitch %>
Contributors
ericfillipe
Version
0.0.1
Published
3 years ago
License
MIT

All libraries are free

Every month, more than thousand developers use haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on Github!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on Github