ferron

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

commit 07467037f7fcd969e9e5e006c46f0efe45a6d3f3
parent e9089ee425ffc47603fc40a595cada9686bc3354
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date:   Wed, 31 Jan 2018 14:22:01 -0500

Add ferronutils + add a var.

Diffstat:
Mfunctions/dispatch-nontextuals.lua | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/functions/dispatch-nontextuals.lua b/functions/dispatch-nontextuals.lua @@ -2,28 +2,30 @@ local lfs = require("lfs") local mimetypes = require('mimetypes') local path = require("path") +local ferronutils = require("functions.ferron-utils") local tableutils = require("functions.table-utils") local function dispatchnontextuals(file) local mimestable = Ferron.site.config.SITE.MIMETYPES + local prefetchedtable = Ferron.site.config.SITE.PREFETCHLIST path.each( path.dirname(file) .. "/*", "f", function(f) if tableutils.hasvalue(mimestable, mimetypes.guess(f)) then - local file_dirname = path.dirname(file) + local listindex_dirname = path.dirname(file) local img = f local img_name = img:match("^.+/(.+)$") - local img_relpath = img:sub((Ferron.site.path .. Ferron.site.config.SITE.PATHS.CONTENT):len() + 1) + local img_relpath = ferronutils.getrelpath(img) local htmlfolder = Ferron.site.path .. Ferron.site.config.SITE.PATHS.HTML -- Then symlinks from those non-textuals for list index pages - lfs.link("." .. img:sub((file_dirname):len() + 1), file_dirname .. "/" .. img_name, true) + lfs.link("." .. img:sub((listindex_dirname):len() + 1), listindex_dirname .. "/" .. img_name, true) -- Copy all non-textual contents (jpg, pdf, png, svg, etc.) to `public_html/` path.copy(img, htmlfolder .. img_relpath) - Ferron.site.config.SITE.PREFETCHLIST[#Ferron.site.config.SITE.PREFETCHLIST + 1] = img_relpath + prefetchedtable[#prefetchedtable + 1] = img_relpath end end, {recurse = true}