ferron

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

commit 5ff190d2c260abab09a8bc225cf525fe0314dd9d
parent b2a6519d5753ba9d16c94baae6c53812a09a5825
Author: Hugo Soucy <hs0ucy@h50ucy.local>
Date:   Tue,  2 Jul 2019 21:50:26 -0400

Add isNotdotdirectory and apply it

Diffstat:
Mferron/site.lua | 8+++++---
Mferron/utilities/file-utils.lua | 11+++++++++++
2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/ferron/site.lua b/ferron/site.lua @@ -18,9 +18,9 @@ function site.getsitelist(siteslocation) return tb.map( function(site, i) if fl.isDirectory(location .. site) - and site ~= '.' - and site ~= '..' + and fl.isNotDotDirectory(site) then + print(site) return site end end, @@ -28,6 +28,8 @@ function site.getsitelist(siteslocation) ) end +-- Check if the value of the arg[1] (sitename) exists in the table +-- returns by site.getsitelist method. function site.isSite(sitename) if tb.hasvalue(site.getsitelist(), sitename) then return sitename @@ -36,6 +38,7 @@ function site.isSite(sitename) return false end +-- Get the configuration file of the selected website. function site.getsiteconfig(sitename) package.path = package.path .. ';sites/'.. sitename ..'/?.lua' @@ -48,7 +51,6 @@ function site.setsiteconfig(sitename) site.config = tb.extend({}, config, site.getsiteconfig(thatsite)) Ferron.site.config = site.config - return site.config end diff --git a/ferron/utilities/file-utils.lua b/ferron/utilities/file-utils.lua @@ -36,6 +36,17 @@ function fileutils.isDirectory(filepath) return false end +function fileutils.isNotDotDirectory(dirname) + if dirname ~= '.' + and dirname ~= '..' + and dirname ~= '.git' + then + return dirname + end + + return false +end + function fileutils.isMarkdown(filepath) if fileutils.isFile(filepath) and (mimetypes.guess(filepath) == 'text/x-markdown'