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

@@ -3,7 +3,7 @@ test:
busted busted
build:: build::
moonc elua.moon moonc etlua.moon
local: build local: build
luarocks make --local elua-dev-1.rockspec luarocks make --local etlua-dev-1.rockspec

View File

@@ -1,18 +1,18 @@
# elua # etlua
Embedded Lua templating Embedded Lua templating
## Install ## Install
```bash ```bash
$ luarocks install --server=http://rocks.moonscript.org elua $ luarocks install --server=http://rocks.moonscript.org etlua
``` ```
## Tutorial ## Tutorial
```lua ```lua
local elua = require "elua" local etlua = require "etlua"
local template = elua.compile([[ local template = etlua.compile([[
Hello <%= name %>, Hello <%= name %>,
Here are your items: Here are your items:
<% for i, item in pairs(items) do %> <% 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: The module can be loaded by doing:
```lua ```lua
local elua = require "elua" local etlua = require "etlua"
``` ```
### Methods ### Methods
#### `func = elua.compile(template_string)` #### `func = etlua.compile(template_string)`
Compiles the template into a function, the returned function can be called to 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 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 environment within the template. `_G` is used to look up a variable if it can't
be found in the environment. 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 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 high performance this should be avoided in favor of `compile` if it's possible

30
etlua-1.0.0-1.rockspec Normal file
View File

@@ -0,0 +1,30 @@
package = "etlua"
version = "1.0.0-1"
source = {
url = "git://github.com/leafo/etlua.git",
branch = "v1.0.0"
}
description = {
summary = "Embedded templates for Lua",
detailed = [[
Allows you to render ERB style templates but with Lua. Supports <% %>, <%=
%> and <%- %> tags (with optional newline slurping) for embedding code.
]],
homepage = "https://github.com/leafo/etlua",
maintainer = "Leaf Corcoran <leafot@gmail.com>",
license = "MIT"
}
dependencies = {
"lua >= 5.1",
}
build = {
type = "builtin",
modules = {
["etlua"] = "etlua.lua",
},
}

View File

@@ -1,8 +1,8 @@
package = "elua" package = "etlua"
version = "dev-1" version = "dev-1"
source = { source = {
url = "git://github.com/leafo/elua.git" url = "git://github.com/leafo/etlua.git"
} }
description = { description = {
@@ -11,7 +11,7 @@ description = {
Allows you to render ERB style templates but with Lua. Supports <% %>, <%= Allows you to render ERB style templates but with Lua. Supports <% %>, <%=
%> and <%- %> tags (with optional newline slurping) for embedding code. %> and <%- %> tags (with optional newline slurping) for embedding code.
]], ]],
homepage = "https://github.com/leafo/elua", homepage = "https://github.com/leafo/etlua",
maintainer = "Leaf Corcoran <leafot@gmail.com>", maintainer = "Leaf Corcoran <leafot@gmail.com>",
license = "MIT" license = "MIT"
} }
@@ -23,7 +23,7 @@ dependencies = {
build = { build = {
type = "builtin", type = "builtin",
modules = { modules = {
["elua"] = "elua.lua", ["etlua"] = "etlua.lua",
}, },
} }

View File

@@ -201,7 +201,7 @@ do
end, end,
load = function(self, code, name) load = function(self, code, name)
if name == nil then if name == nil then
name = "elua" name = "etlua"
end end
local code_fn = coroutine.wrap(function() local code_fn = coroutine.wrap(function()
return coroutine.yield(code) return coroutine.yield(code)

View File

@@ -161,7 +161,7 @@ class Parser
source_line = get_line @str, source_line_no source_line = get_line @str, source_line_no
"#{err_msg} [#{source_line_no}]: #{source_line}" "#{err_msg} [#{source_line_no}]: #{source_line}"
load: (code, name="elua") => load: (code, name="etlua") =>
code_fn = coroutine.wrap -> code_fn = coroutine.wrap ->
coroutine.yield code coroutine.yield code

View File

@@ -1,7 +1,7 @@
import compile, render, Parser from require "elua" import compile, render, Parser from require "etlua"
describe "elua", -> describe "etlua", ->
describe "Parser", -> describe "Parser", ->
cases = { cases = {
{ {