Module:Calendar date: Difference between revisions

From Phuketer
ABC local shim for standalone imported Wikipedia dependency
Tag: Replaced
ABC final compatibility shim: add calendardate function
 
Line 1: Line 1:
-- ABC local compatibility shim for imported Wikipedia calendar-date calls.
local p = {}
local p = {}


function p.main(frame)
local function render(frame)
local args = frame and frame.args or {}
 
if args[1] and tostring(args[1]) ~= '' then
return tostring(args[1])
end
 
if args.date and tostring(args.date) ~= '' then
return tostring(args.date)
end
 
return ''
return ''
end
end


function p._main(args)
p.main = render
p.calendardate = render
p.calendarDate = render
p._main = function(args)
if args and args[1] then
return tostring(args[1])
end
return ''
return ''
end
end
setmetatable(p, {
__index = function(t, k)
local f = function(frame)
return render(frame)
end
rawset(t, k, f)
return f
end
})


return p
return p

Latest revision as of 17:44, 16 June 2026

Documentation for this module may be created at Module:Calendar date/doc

-- ABC local compatibility shim for imported Wikipedia calendar-date calls.

local p = {}

local function render(frame)
	local args = frame and frame.args or {}

	if args[1] and tostring(args[1]) ~= '' then
		return tostring(args[1])
	end

	if args.date and tostring(args.date) ~= '' then
		return tostring(args.date)
	end

	return ''
end

p.main = render
p.calendardate = render
p.calendarDate = render
p._main = function(args)
	if args and args[1] then
		return tostring(args[1])
	end
	return ''
end

setmetatable(p, {
	__index = function(t, k)
		local f = function(frame)
			return render(frame)
		end
		rawset(t, k, f)
		return f
	end
})

return p