htpl 0.0.1

Htpl -- Template engine

Released 2015-04-05.

To install, run:

haxelib install htpl 0.0.1

See using Haxelib in Haxelib documentation for more information.

Maintainerericfillipe
Websitehttps://github.com/ericfillipe1/htpl.git
Current version0.0.1
StatisticsInstalled 7 times
LicenseMIT
Tags htpl

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 %>