ferron

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

commit f9c5cf627af0c2013f3ddd20525eb0a4e1156991
parent 61ff3dc7c9393be827fd3fbab808744be98fa52e
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Thu, 30 Nov 2017 09:27:11 -0500

Remove `listindex_table` and use `listindex_metadatas_mt` instead

Diffstat:
Mfunctions/make-lists-of-pages.lua | 13++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/functions/make-lists-of-pages.lua b/functions/make-lists-of-pages.lua @@ -22,7 +22,6 @@ local function makelistsofpages() local listindex_section = path.dirname(listindex):match("^.+/(.+)$") local listindex_metadatas = json.decode(fileutils.pullfilecontent(listindex_noextension .. ".json")) local listindex_metadatas_mt = setmetatable({}, { __index = listindex_metadatas }) - local listindex_table = {} print("ยง Make an index page for the `" .. listindex_section .. "` section:") @@ -30,16 +29,16 @@ local function makelistsofpages() listindex_metadatas_mt.content = markdown(fileutils.pullfilecontent(listindex)) -- Set a dynamic permalink listindex_metadatas_mt.permalink = Ferron.site.config.SITE.BASEURL .. path.dirname(listindex_relpath) - - listindex_table = listindex_metadatas_mt - listindex_table["SITE"] = Ferron.site.config.SITE - listindex_table["entries"] = {} + -- Import site configuration in the metatable + listindex_metadatas_mt["SITE"] = Ferron.site.config.SITE + -- Set a table for the list of entries + listindex_metadatas_mt["entries"] = {} for k, v in tableutils.sortdescendingpairs(Ferron.site.pagestable) do local date, datetime, section, relpath = k:match("(.-)|(.-)|(.-)|(.-)$") if section == listindex_section or relpath:match("%/"..listindex_section.."%/") then - table.insert(listindex_table["entries"], v) + table.insert(listindex_metadatas_mt["entries"], v) end end @@ -55,7 +54,7 @@ local function makelistsofpages() templateutils.setmustache( fileutils.pullfilecontent(Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/" .. listindex_metadatas.template .. ".mustache"), Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/partials", - listindex_table + listindex_metadatas_mt ) )