rename project to etlua

This commit is contained in:
leaf corcoran
2013-10-26 10:08:13 -07:00
parent 0a683fb35d
commit a5dc45b88b
7 changed files with 47 additions and 17 deletions

View File

@@ -1,18 +1,18 @@
# elua
# etlua
Embedded Lua templating
## Install
```bash
$ luarocks install --server=http://rocks.moonscript.org elua
$ luarocks install --server=http://rocks.moonscript.org etlua
```
## Tutorial
```lua
local elua = require "elua"
local template = elua.compile([[
local etlua = require "etlua"
local template = etlua.compile([[
Hello <%= name %>,
Here are your items:
<% for i, item in pairs(items) do %>
@@ -41,19 +41,19 @@ following newline if there is one, for example: `<%= 'hello' -%>`.
The module can be loaded by doing:
```lua
local elua = require "elua"
local etlua = require "etlua"
```
### Methods
#### `func = elua.compile(template_string)`
#### `func = etlua.compile(template_string)`
Compiles the template into a function, the returned function can be called to
render the template. The function takes one argument: a table to use as the
environment within the template. `_G` is used to look up a variable if it can't
be found in the environment.
#### `result = elua.render(template_string, env)`
#### `result = etlua.render(template_string, env)`
Compiles and renders the template in a single call. If you are concerned about
high performance this should be avoided in favor of `compile` if it's possible