ferron

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

commit 55cf1d6ad097d0f2e9c61f1e0ff1aa53d0bbb69b
parent 321c696393599e09cb64352e6957b90ac98bdc7b
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date:   Fri,  2 Feb 2018 17:15:36 -0500

Rename sites_list in sites_arr

Diffstat:
Mferron/site.lua | 14++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/ferron/site.lua b/ferron/site.lua @@ -4,9 +4,8 @@ local tableutils = require "ferron.utilities.table-utils" local fileutils = require "ferron.utilities.file-utils" local site = {} - local sites_tb = {} -local sites_list = {} +local sites_arr = {} function site.getsites() -- Create a table with the content of `config.paths.sites` @@ -23,11 +22,11 @@ function site.getsites() } -- Create a simple array with the name of the sites - sites_list[#sites_list+1] = s:match("^.+/(.+)$") + sites_arr[#sites_arr+1] = s:match("^.+/(.+)$") end end - return sites_tb, sites_list + return sites_tb, sites_arr end function site.setsite() @@ -37,7 +36,7 @@ function site.setsite() repeat io.write("Welcome to Ferron! Which site do you want to build? \n") - for k, v in ipairs(sites_list) do + for k, v in ipairs(sites_arr) do io.write(k .. ") " .. v .. "\n") end @@ -45,13 +44,12 @@ function site.setsite() io.flush() whichsite=io.read() - until (tableutils.haskey(sites_list, tonumber(whichsite))) == true + until (tableutils.haskey(sites_arr, tonumber(whichsite))) == true - Ferron.site = sites_tb[sites_list[tonumber(whichsite)]] + Ferron.site = sites_tb[sites_arr[tonumber(whichsite)]] Ferron.site.siteconfig.baseurl = (Ferron.devmode == true and Ferron.site.siteconfig.urldev or Ferron.site.siteconfig.url) Ferron.site.siteconfig.prefetchlist = {} - return Ferron.site end