motyl

Opinionated blog-aware static site generator written in Ruby
Log | Files | Refs | README | LICENSE

commit 2351fc6993e9893f352eaeaaa0f814fd12801480
parent 0fc6992ac47eabe9e2b3ee3fa3c1be5d4e379446
Author: Frederic Cambus <fred@statdns.com>
Date:   Sat,  5 Mar 2016 18:42:28 +0100

Passing rendered template directly as function parameter

Diffstat:
Mmotyl.lua | 13++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/motyl.lua b/motyl.lua @@ -115,10 +115,8 @@ local function render(directory) end end - output = renderTemplate(templates[directory], data, templates) - lfs.mkdir(data.site.destination .. path) - writeFile(data.site.destination .. path .. "/index.html", output) + writeFile(data.site.destination .. path .. "/index.html", renderTemplate(templates[directory], data, templates)) data.page = {} end @@ -139,8 +137,7 @@ data.page.title = data.site.title data.page.description = data.site.description data.page.keywords = data.site.keywords -output = renderTemplate(templates.archives, data, templates) -writeFile(data.site.destination .. "index.html", output) +writeFile(data.site.destination .. "index.html", renderTemplate(templates.archives, data, templates)) status("Rendering index.html") -- Feed @@ -148,8 +145,7 @@ for loop=1, 20 do data.site.feed[loop] = data.site.posts[loop] end -output = renderTemplate(templates.atom, data, templates) -writeFile(data.site.destination .. "atom.xml", output) +writeFile(data.site.destination .. "atom.xml", renderTemplate(templates.atom, data, templates)) status("Rendering atom.xml") data.page = {} @@ -164,9 +160,8 @@ for category in pairs(data.site.categories) do data.page.title = category data.page.url = "categories/" .. categoryURL data.site.posts = data.site.categories[category] - output = renderTemplate(templates.archives, data, templates) lfs.mkdir(data.site.destination .. "categories/" .. categoryURL) - writeFile(data.site.destination .. "categories/" .. categoryURL .. "index.html", output) + writeFile(data.site.destination .. "categories/" .. categoryURL .. "index.html", renderTemplate(templates.archives, data, templates)) status("Rendering " .. categoryURL) end