ferron

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

commit 00e0570e0abe423ba00e426457514a1009e7eb1a
parent 7949c2b4ae09c1330251be605083f1948118273c
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Sat, 25 Apr 2020 22:34:04 -0400

Check if lastbuild file is there

Diffstat:
M.gitignore | 2+-
Mferron/page.lua | 17+++++++++++------
2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1 +1 @@ -./lastbuild +lastbuild diff --git a/ferron/page.lua b/ferron/page.lua @@ -155,13 +155,18 @@ function page.makepages(sitedata) -- Render single pages tb.each( function(p) - local lastbuild = lfs.attributes(lfs.currentdir() .. '/lastbuild').modification - local pagemod = lfs.attributes(p).modification - local pageconfmod = (lfs.attributes(fl.removeextension(p) .. '.json') - or lfs.attributes(fl.removeextension(p) .. '.lua')).modification + local lastbuild = lfs.currentdir() .. '/lastbuild' - if pagemod > lastbuild or pageconfmod > lastbuild then - print(p) + if fl.isFile(lastbuild) then + local lastbuildmod = lfs.attributes(lfs.currentdir() .. '/lastbuild').modification + local pagemod = lfs.attributes(p).modification + local pageconfmod = (lfs.attributes(fl.removeextension(p) .. '.json') + or lfs.attributes(fl.removeextension(p) .. '.lua')).modification + + if pagemod > lastbuildmod or pageconfmod > lastbuildmod then + page.render(p, sitedata) + end + else page.render(p, sitedata) end end, singlepages