ferron

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

commit 682a6b7dc41dcebb5717e0056c861c3aaabb354e
parent 869faef0409c10900483876d8953fc07ad7c8c6d
Author: Hugo Soucy <hsoucy@kronostechnologies.com>
Date:   Tue,  7 Aug 2018 17:28:37 -0400

Add a simple function to list sites in sites repository

Diffstat:
Mferron/site.lua | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/ferron/site.lua b/ferron/site.lua @@ -5,6 +5,21 @@ local fileutils = require "ferron.utilities.file-utils" local site = {} +function site.listsites() + -- Create a simple array with the directory name of the sites + local sites_arr = {} + + for s in path.each(config.paths.sites .. "/*", "f", {delay = true; reverse = true;}) do + if path.isdir(s) then + sites_arr[#sites_arr+1] = s:match("^.+/(.+)$") + end + end + + print(inspect(sites_arr)) + + return sites_arr +end + function site.getsites() local sites_tb = {} local sites_arr = {}