ferron

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

commit cedab4d585c40c0aba5241ce0e2f6826a6827bce
parent 1010c0d2ddc7d468e440519cf987a1941e0287cf
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Mon, 17 Dec 2018 21:48:17 -0500

Change path.copy with shell cp

Diffstat:
Mferron.lua | 3++-
Mferron/list.lua | 2+-
Mferron/static.lua | 13+++++++++++++
Msites/ferron-ssg.tld/templates/partials/head.mustache | 1+
4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/ferron.lua b/ferron.lua @@ -34,7 +34,8 @@ Ferron.build = { list.init, link.makeshorts, link.makerewritemap, - static.move + static.move, + static.init, } if arg[1] == "--set" and arg[2] == "content" then diff --git a/ferron/list.lua b/ferron/list.lua @@ -78,7 +78,7 @@ function list.render(listsource) end -- Move static files in the public HTML folder - static.dispatch(list) + -- static.dispatch(list) print("==========") diff --git a/ferron/static.lua b/ferron/static.lua @@ -39,6 +39,13 @@ function static.dispatch(file) ) end +function static.moveNonTextualToRoot(file) + local htmlfolder = Ferron.site.path .. Ferron.site.config.paths.html + + os.execute("cp -pv " .. file .. " " .. htmlfolder) + --print(file) +end + function static.move() -- Copy the entire `siteconfig.paths.static` folder in `siteconfig.paths.html` path.copy( @@ -50,4 +57,10 @@ function static.move() print("¤¤ Your site is ready at `" .. Ferron.site.path .. Ferron.site.config.paths.html .. "` ¤¤") end +function static.init() + local contentpath = assert(fileutils.isDirectory(Ferron.site.path .. Ferron.site.config.paths.content)) + + tableutils.each(static.moveNonTextualToRoot, tableutils.filter(fileutils.isNonTextual, tableutils.settable(fileutils.getdirtree(contentpath)))) +end + return static diff --git a/sites/ferron-ssg.tld/templates/partials/head.mustache b/sites/ferron-ssg.tld/templates/partials/head.mustache @@ -5,6 +5,7 @@ <title>{{ title }} &mdash; {{ site.domainname }}</title> + <base href="{{{ site.baseurl }}}"/> <link rel="stylesheet" href="{{{ site.baseurl }}}/css/styles.css" /> <link href="{{{ site.baseurl }}}/feed.atom.xml" rel="alternate" title="Feed de tous les contenus" type="application/atom+xml" /> <link href="{{ permalink }}" hreflang="{{ site.language }}" rel="canonical" />