ferron

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

commit cc6d41367d764482e8d6d95bf8be8bf059b5df85
parent 1663d52f26ab4f1b1373b781ba574bf875c8d089
Author: Hugo Soucy <hsoucy@kronostechnologies.com>
Date:   Mon,  4 Feb 2019 07:59:12 -0500

Remove several `~= nil`

Diffstat:
Mferron/content.lua | 6+++---
Mferron/list.lua | 6+++---
Mferron/tag.lua | 6+++---
Mferron/utilities/template-utils.lua | 2+-
4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/ferron/content.lua b/ferron/content.lua @@ -14,7 +14,7 @@ local templateutils = require "ferron.utilities.template-utils" function content.getarchetypes(dir) local archetypes = {} - local archetypesdir = (dir ~= nil and dir or Ferron.site.archetypes) + local archetypesdir = dir or Ferron.site.archetypes if fileutils.isDirectory(archetypesdir) then for archetype, attr in fileutils.getdirtree(archetypesdir) do @@ -58,8 +58,8 @@ function content.setcontent() end function content.makecontent(contenttype, contenttitle) - local archetypetype = (contenttype ~= nil and contenttype or arg[1]) - local title = (contenttitle ~= nil and contenttitle or arg[2]) + local archetypetype = contenttype or arg[1] + local title = contenttitle or arg[2] if tableutils.hasvalue(content.getarchetypes(), archetypetype) and type(title) == "string" then local archetype = {} diff --git a/ferron/list.lua b/ferron/list.lua @@ -15,10 +15,10 @@ local feed = require "ferron.feed" local static = require "ferron.static" local function sortentries(entries_tb, list_mt) - local list_length = list_mt.length ~= nil and list_mt.length or nil - local entries_count = list_length ~= nil and 0 or nil + local list_length = list_mt.length or nil + local entries_count = list_length and 0 or nil - if entries_count ~= nil then + if entries_count then for k, v in tableutils.sortdescendingpairs(entries_tb) do if entries_count < list_length then table.insert(list_mt["entries"], v) diff --git a/ferron/tag.lua b/ferron/tag.lua @@ -16,7 +16,7 @@ local function maketagstable() local pages = Ferron.site.pagestable for k, page in pairs(pages) do - if page.keywords ~= nil then + if page.keywords then for i, keyword in ipairs(page.keywords) do if tableutils.hasvalue(tagstable, keyword) == false then tagstable[keyword] = {} @@ -26,9 +26,9 @@ local function maketagstable() end for k, page in pairs(pages) do - if page.keywords ~= nil then + if page.keywords then for i, keyword in ipairs(page.keywords) do - if tagstable[keyword] ~= nil then + if tagstable[keyword] then table.insert(tagstable[keyword], page.rellink) end end diff --git a/ferron/utilities/template-utils.lua b/ferron/utilities/template-utils.lua @@ -16,7 +16,7 @@ function templateutils.selecttemplate(index, templatename) local templatepath = Ferron.site.path .. Ferron.site.config.paths.templates .. "/" local template = nil - if templatename ~= nil and type(templatename) == "string" then + if templatename and type(templatename) == "string" then template = templatepath .. templatename else if type(index) == "boolean" and index == true then