ferron

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

commit 8b73198b92f3af01d1f5710689e970c251062f3d
parent 46bdc5393b4ed237e8de57c2a514274b363bc648
Author: Hugo Soucy <hs0ucy@users.noreply.github.com>
Date:   Tue,  2 Oct 2018 20:00:32 -0400

Merge pull request #3 from hs0ucy/optimization_2

Optimization 2
Diffstat:
Mferron/site.lua | 23+++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/ferron/site.lua b/ferron/site.lua @@ -36,21 +36,24 @@ end function site.setsite() local sites_list = site.listsites() - -- Site chooser: Which site do you want to build? local whichsite = nil - repeat - io.write("For which website do you want to proceed? \n") + if #sites_list > 1 then + repeat + io.write("For which website do you want to proceed? \n") - for k, v in ipairs(sites_list) do - io.write(k .. ") " .. v .. "\n") - end + for k, v in ipairs(sites_list) do + io.write(k .. ") " .. v .. "\n") + end - io.write("Please enter the number... \n") - io.flush() + io.write("Please enter the number... \n") + io.flush() - whichsite=io.read() - until (tableutils.haskey(sites_list, tonumber(whichsite))) == true + whichsite=io.read() + until (tableutils.haskey(sites_list, tonumber(whichsite))) == true + else + whichsite = 1 + end Ferron.site = site.getsiteinfos(sites_list[tonumber(whichsite)]) Ferron.site.siteconfig.baseurl = (Ferron.devmode == true and Ferron.site.siteconfig.urldev or Ferron.site.siteconfig.url)