%s
%s
%s
%s
#!/usr/bin/env luajit local page, entry_list = {}, {} local eval = function (state, action_list) for _, action in ipairs (action_list) do action (state) end end title = function (title) page.title = title end description = function (desc) page.description = desc end game = function (details) table.insert (entry_list, function (page) local entry = {} eval (entry, details) table.insert (page, entry) end) end name = function (name) return function (entry) entry.name = name end end id = function (id) return function (entry) entry.id = id end end released_on = function (date) return function (entry) entry.date = date end end cover = function (file) return function (entry) entry.cover = file end end mature_themes = function (entry) entry.mature_themes = true end flavor_text = function (text) return function (entry) entry.flavor_text = text end end content_description = function (desc) return function (entry) entry.content_description = desc end end credits = function (credits) return function (entry) entry.credits = {} eval (entry.credits, credits) end end downloads = function (downloads) return function (entry) entry.downloads = {} eval (entry.downloads, downloads) end end link = { to = function (to) return { says = function (says) return function (list) table.insert (list, {says = says, to = to}) end end } end } require "entries" eval (page, entry_list) local html_shell = [[
%s
%s
%s
%s
%s
🐑 %s 🐑
]] local html_link = [[%s]] local to_html_downloads = function (downloads) local html_downloads = {} for _, link in ipairs (downloads) do table.insert (html_downloads, html_link :format (link.to, link.says)) end return table.concat (html_downloads, " / ") end local to_html_credits = function (credits) local html_credits = {} for _, link in ipairs (credits) do table.insert (html_credits, html_credit :format (link.to, link.says)) end return table.concat (html_credits, "\n") end local to_html_entry_name_list = function (page) local html_entry_name_list = {} for _, entry in ipairs (page) do table.insert (html_entry_name_list, html_link :format ("#" .. entry.id, entry.name)) end return table.concat (html_entry_name_list, " / ") end local to_html = function (page) local html_entry_list = {} for _, entry in ipairs (page) do local html = html_entry :format ( entry.id, entry.id, entry.name, entry.id, entry.date, entry.cover, entry.flavor_text, entry.content_description, to_html_downloads (entry.downloads or {}), to_html_credits (entry.credits or {}) ) table.insert (html_entry_list, html) end return html_shell :format ( page.title, page.title, page.description, to_html_entry_name_list (page), table.concat (html_entry_list, "