Jump to content

Module:Sandbox/Andrybak

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Andrybak (talk | contribs) at 18:14, 8 October 2023 (test). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local function list(frame)
	local start = 1609455600
	local images = {}
	for t = 0, 512, 1
	do
		local d = os.date("%Y-%m-%d", start + t * 24 * 60 * 60)
		local image = frame:expandTemplate{
			title = "POTD/" .. d,
			args = { "image" }
		}
		table.insert(images, image)
	end
	return frame:preprocess(table.concat(images, "<br />"))
end

local function asciiToSevenSegmentDisplayUnicode(s)
	local map = {
		['0'] = "🯰",
		['1'] = "🯱",
		['2'] = "🯲",
		['3'] = "🯳",
		['4'] = "🯴",
		['5'] = "🯵",
		['6'] = "🯶",
		['7'] = "🯷",
		['8'] = "🯸",
		['9'] = "🯹"
	}
	local result = string.gsub(s, "%d",
		function(digit)
			local replacement = map[digit]
			return replacement or digit
		end
	)
	return result
end

p = {}
p.list = list
return p