ferron

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

commit fe5a95a12e1eab0ce5a11ec2c193e107a99aaf81
parent 8b73198b92f3af01d1f5710689e970c251062f3d
Author: Hugo Soucy <hs0ucy@h50ucy.local>
Date:   Tue,  2 Oct 2018 21:38:34 -0400

Change & apply the design of the feedtypes table

Diffstat:
Mconfig.lua | 15++++++++++++---
Mferron/feed.lua | 6+++---
2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/config.lua b/config.lua @@ -33,9 +33,18 @@ local config = { }, feedtypes = { - "atom", - "rss2", - "json", + atom = { + name = "feed.atom", + extension = ".xml", + }, + rss2 = { + name = "feed.rss2", + extension = ".xml", + }, + json = { + name = "feed", + extension = ".json", + }, }, } diff --git a/ferron/feed.lua b/ferron/feed.lua @@ -10,12 +10,12 @@ function feed.makefeed(entries, destination) local feedtypes = (not Ferron.site.siteconfig.feedtypes and config.feedtypes or Ferron.site.siteconfig.feedtypes) local feedpartials = path.isdir(Ferron.site.path .. Ferron.site.siteconfig.paths.templates .. "/partials") - for i, v in ipairs(feedtypes) do - local feedtemplate = Ferron.site.path .. Ferron.site.siteconfig.paths.templates .. "/feed/" .. v .. ".mustache" + for k, v in pairs(feedtypes) do + local feedtemplate = Ferron.site.path .. Ferron.site.siteconfig.paths.templates .. "/feed/" .. k .. ".mustache" if path.isfile(feedtemplate) then fileutils.pushfilecontent( - destination .. "/feed." .. v, + destination .. "/" .. v.name .. v.extension, templateutils.processmustache( fileutils.pullfilecontent(feedtemplate), feedpartials,