ferron

Ferron is a fast and simple static website generator made with Lua.
Log | Files | Refs | Submodules | README | LICENSE

commit ff9a9e238ad45a60d63f7d765d8859cfddec3d1f
parent c4cf0bcbb202b7d9ac678a67676135a135e22722
Author: Hugo Soucy <hsoucy@kronostechnologies.com>
Date:   Fri,  5 Oct 2018 12:32:28 -0400

Remove returns

Diffstat:
Mferron/link.lua | 8++------
Mferron/list.lua | 1-
Mferron/static.lua | 64++++++++++++++++++++++++++++++++--------------------------------
3 files changed, 34 insertions(+), 39 deletions(-)

diff --git a/ferron/link.lua b/ferron/link.lua @@ -25,7 +25,7 @@ function link.makeshorts() links[v.rellink] = fileutils.shorturlencode(counter) - return fileutils.pushfilecontent(links_db, json.encode(links, {indent = true, keyorder = links_keyorder})) + fileutils.pushfilecontent(links_db, json.encode(links, {indent = true, keyorder = links_keyorder})) end end else @@ -37,12 +37,10 @@ function link.makeshorts() links[v.rellink] = fileutils.shorturlencode(tableutils.length(links) + 1) - return fileutils.pushfilecontent(links_db, json.encode(links, {indent = true, keyorder = links_keyorder})) + fileutils.pushfilecontent(links_db, json.encode(links, {indent = true, keyorder = links_keyorder})) end end end - - return end function link.makerewritemap() @@ -65,8 +63,6 @@ function link.makerewritemap() -- Close it when it's done map:close() end - - return end return link diff --git a/ferron/list.lua b/ferron/list.lua @@ -103,7 +103,6 @@ function list.makelist() json.encode(list_conf, {indent = true, keyorder = Ferron.site.siteconfig.metaskeyorder}) ) - -- Build and push the HTML page fileutils.pushfilecontent( list_htmlpath .. "/" .. fileutils.getplainname(list) .. ".html", diff --git a/ferron/static.lua b/ferron/static.lua @@ -1,5 +1,5 @@ --[[ - Static Module + Static Module ]]-- -- Required Packages @@ -14,40 +14,40 @@ local tableutils = require "ferron.utilities.table-utils" local static = {} function static.dispatch(file) - path.each( - path.dirname(file) .. "/*", "f", - function(f) - if fileutils.isNonTextual(f) then - local listindex_dirname = path.dirname(file) - local img = f - local htmlfolder = Ferron.site.path .. Ferron.site.siteconfig.paths.html - - if not posix.readlink(img) then - -- Copy content's images in the `public_html/` directory - path.copy(img, htmlfolder .. fileutils.getrelpath(img)) - - -- Then with those copies create symlinks from those - -- non-textuals for list index pages - if path.isfile(htmlfolder .. fileutils.getrelpath(img)) then - lfs.link("." .. img:sub((listindex_dirname):len() + 1), - htmlfolder .. fileutils.getrelpath(path.dirname(file)) .. "/" .. path.basename(img), true) - end - end - end - end, - {recurse = true} - ) + path.each( + path.dirname(file) .. "/*", "f", + function(f) + if fileutils.isNonTextual(f) then + local listindex_dirname = path.dirname(file) + local img = f + local htmlfolder = Ferron.site.path .. Ferron.site.siteconfig.paths.html + + if not posix.readlink(img) then + -- Copy content's images in the `public_html/` directory + path.copy(img, htmlfolder .. fileutils.getrelpath(img)) + + -- Then with those copies create symlinks from those + -- non-textuals for list index pages + if path.isfile(htmlfolder .. fileutils.getrelpath(img)) then + lfs.link("." .. img:sub((listindex_dirname):len() + 1), + htmlfolder .. fileutils.getrelpath(path.dirname(file)) .. "/" .. path.basename(img), true) + end + end + end + end, + {recurse = true} + ) end function static.move() - -- Copy the entire `siteconfig.paths.static` folder in `siteconfig.paths.html` - path.copy( - Ferron.site.path .. Ferron.site.siteconfig.paths.static .. "/*", - Ferron.site.path .. Ferron.site.siteconfig.paths.html, - {recurse = true} - ) - - print("¤¤ Your site is ready at `" .. Ferron.site.path .. Ferron.site.siteconfig.paths.html .. "` ¤¤") + -- Copy the entire `siteconfig.paths.static` folder in `siteconfig.paths.html` + path.copy( + Ferron.site.path .. Ferron.site.siteconfig.paths.static .. "/*", + Ferron.site.path .. Ferron.site.siteconfig.paths.html, + {recurse = true} + ) + + print("¤¤ Your site is ready at `" .. Ferron.site.path .. Ferron.site.siteconfig.paths.html .. "` ¤¤") end return static