Giter VIP home page Giter VIP logo

herml's Introduction

Welcome to herml, the Haml-like templating language!

Building:
1) Install leex 0.3 or greater. (Putting it in your $ERLANG_HOME/lib is best)
2) Clone the herml repo from Github.
3) Run make
4) Put the herml/ebin directory somewhere on your code path:
  4a) Symlink the top-level herml directory into your $ERLANG_HOME/lib directory
                                -or-
  4b) Use the -pz or -pa switches on erl to place herml/ebin onto your code path

Using in Sinan:
1) Clone the herml repo from Github
2) Run `make special` in the herml directory
3) Make sure your sinan project can find the herml repo
   3a) Clone inside your projects lib directory
                  -or-
   3b) Symlink the herml directory to your projects lib directory

4) Keep it up to date:
  a) Pull down latest changes
  b) `make clean`
  c) `make special`

Running tests:
1) Run make clean tests


Using herml:
The interface for herml is a work-in-progress currently. Eventually herml will
sport a slick n' simple interface but, for now, its' a two step process:

1) 'Compile' your herml template using herml_parser:

1> CompiledTemplate = herml_parser:file("/path/to/template/file.herml").

Note: You can cache the compiled template and use it over and over.

2) 'Execute' the compiled template using herml_htmlizer:

2> Result = herml_htmlizer:render(CompiledTemplate, Env).

Note: Env is a proplist containing the execution environment for the
template. herml expects all variable names to be Erlang strings. For
example, here's a valid environment proplists: [{"UserName", "herml"}].

The UserName variable would be referenced from herml as @UserName.

Another note: herml_htmlizer returns iolists when it executes templates.
This is for efficiency reasons. If you want to view the template output
as a standard string, you can use the io module to flatten the iolist: 

3> io:format("~s", [Result]). 

herml's People

Contributors

asceth avatar averyj avatar seancribbs avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.