erazor

A haXe implementation of the MVC 3 Razor template engine
http://github.com/ufront/erazor

To install, run:

haxelib install erazor 1.0.2 

See using Haxelib in Haxelib documentation for more information.

README.md

Erazor Templating Engine

Build Status

More details coming soon. Feel free to send a pull request adding some examples and instructions to this readme!

Installation

haxelib install erazor

Basic Usage

Simple variables

var s = new Template("Hello, @name!").execute({name:"World"});
// "Hello, World!"

Function call

var s = new Template("Hello, @getName()!").execute({getName:function() return "World"});
// "Hello, World!"

Condition

var s = new Template("@if(success){done!}else{fail!}").execute({success:true});
// "done!"

For loop

var s = new Template("@for(name in names){Hello, @name! }").execute({names:["Peter","Clare","Sandra"]});
// "Hello, Peter! Hello, Clare! Hello, Sandra! "

Code blocks

Use @{ } to wrap some hscript codes. Don't forget the semicolon (;) at the end. With this you can declare some variables for later use.

var s = new Template("@{var p = "Hello, World!";}@p").execute();
// "Hello, World!"

... can somebody send a pull request with some more examples? Thanks!

License

BSD.

Contributing

Many Haxe developers have used erazor, but it has not been clear which fork on Github is the "official" version, with different forks having different fixes and patches applied.

This repository has been created so that there is a central place to contribute, so pull requests, bug reports, and documentation are all welcome!

If you would like direct commit access, send at least one good pull request and we'll let you in! (If you are one of the major contributors already, just ask me: jason@ufront.net)

Contributors
jason
waneck
andyli
fponticelli
ciscoheat
Version
1.0.2
Published
1 year ago
License
BSD

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