From a5dc45b88b9ff770153f654db7692786d3346e86 Mon Sep 17 00:00:00 2001 From: leaf corcoran Date: Sat, 26 Oct 2013 10:08:13 -0700 Subject: [PATCH] rename project to etlua --- Makefile | 4 +-- README.md | 14 +++++----- etlua-1.0.0-1.rockspec | 30 +++++++++++++++++++++ elua-dev-1.rockspec => etlua-dev-1.rockspec | 8 +++--- elua.lua => etlua.lua | 2 +- elua.moon => etlua.moon | 2 +- spec/{elua_spec.moon => etlua_spec.moon} | 4 +-- 7 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 etlua-1.0.0-1.rockspec rename elua-dev-1.rockspec => etlua-dev-1.rockspec (75%) rename elua.lua => etlua.lua (99%) rename elua.moon => etlua.moon (99%) rename spec/{elua_spec.moon => etlua_spec.moon} (96%) diff --git a/Makefile b/Makefile index df01c11..1084301 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ test: busted build:: - moonc elua.moon + moonc etlua.moon local: build - luarocks make --local elua-dev-1.rockspec + luarocks make --local etlua-dev-1.rockspec diff --git a/README.md b/README.md index 82e92cb..3fb706f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/etlua-1.0.0-1.rockspec b/etlua-1.0.0-1.rockspec new file mode 100644 index 0000000..3bd61d0 --- /dev/null +++ b/etlua-1.0.0-1.rockspec @@ -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 ", + license = "MIT" +} + +dependencies = { + "lua >= 5.1", +} + +build = { + type = "builtin", + modules = { + ["etlua"] = "etlua.lua", + }, +} + diff --git a/elua-dev-1.rockspec b/etlua-dev-1.rockspec similarity index 75% rename from elua-dev-1.rockspec rename to etlua-dev-1.rockspec index 9ea309a..4719aa7 100644 --- a/elua-dev-1.rockspec +++ b/etlua-dev-1.rockspec @@ -1,8 +1,8 @@ -package = "elua" +package = "etlua" version = "dev-1" source = { - url = "git://github.com/leafo/elua.git" + url = "git://github.com/leafo/etlua.git" } description = { @@ -11,7 +11,7 @@ description = { 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/elua", + homepage = "https://github.com/leafo/etlua", maintainer = "Leaf Corcoran ", license = "MIT" } @@ -23,7 +23,7 @@ dependencies = { build = { type = "builtin", modules = { - ["elua"] = "elua.lua", + ["etlua"] = "etlua.lua", }, } diff --git a/elua.lua b/etlua.lua similarity index 99% rename from elua.lua rename to etlua.lua index 2ad37b2..adf5a0a 100644 --- a/elua.lua +++ b/etlua.lua @@ -201,7 +201,7 @@ do end, load = function(self, code, name) if name == nil then - name = "elua" + name = "etlua" end local code_fn = coroutine.wrap(function() return coroutine.yield(code) diff --git a/elua.moon b/etlua.moon similarity index 99% rename from elua.moon rename to etlua.moon index 8ec3de6..d3855c5 100644 --- a/elua.moon +++ b/etlua.moon @@ -161,7 +161,7 @@ class Parser source_line = get_line @str, source_line_no "#{err_msg} [#{source_line_no}]: #{source_line}" - load: (code, name="elua") => + load: (code, name="etlua") => code_fn = coroutine.wrap -> coroutine.yield code diff --git a/spec/elua_spec.moon b/spec/etlua_spec.moon similarity index 96% rename from spec/elua_spec.moon rename to spec/etlua_spec.moon index 91b3831..e1de119 100644 --- a/spec/elua_spec.moon +++ b/spec/etlua_spec.moon @@ -1,7 +1,7 @@ -import compile, render, Parser from require "elua" +import compile, render, Parser from require "etlua" -describe "elua", -> +describe "etlua", -> describe "Parser", -> cases = { {