satelito

Static [web] site (or page) generator (ssg) made with Lua script.
git clone git://soucy.cc/satelito.git
Log | Files | Refs | README

commit be089e5e0efc4a6ce9fad8bc35ca67a1500ad779
parent dcc725580059099a184d3c0447943f0ee524e388
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Fri,  9 Apr 2021 14:37:05 -0400

Refactor the file module

Diffstat:
Msatelito/file.lua | 21+++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/satelito/file.lua b/satelito/file.lua @@ -80,10 +80,12 @@ end -- Get the modified file from a list of paths function file.get_lastmodified(filelist) - return math.max(table.unpack(lume.map(filelist, - function(fl) - return lfs.attributes(fl).modification - end + return math.max( + table.unpack( + lume.map(filelist, + function(fl) + return lfs.attributes(fl).modification + end ))) end @@ -128,4 +130,15 @@ function file.mkdir(filepath) end end -- + +--- Export a file to a specific location +-- @name file.export +-- @param filepath the location path of the file +-- @param filecontent a string that is a code block +-- @return execute a file.write function +function file.export(filepath, filecontent) + file.mkdir(file.get_dirname(filepath)) + return file.write(filepath, filecontent) +end + return file