Module:Calendar: Difference between revisions

From Nguhcraft Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:
if mw.title.new('Calendar/' .. system, 'Module').exists then
if mw.title.new('Calendar/' .. system, 'Module').exists then
local cal = require("Module:Calendar/"..system)
local cal = require("Module:Calendar/"..system)
cal.to_formatted(cal.from(frame.args), frame.args)
return cal.to_formatted(cal.from(frame.args), frame.args)
else
else
return '<p style="color: red"><code>Module:Calendar</code> error: no such calendar: <code>' .. system .. '</code></p>[[Category:Pages with script errors]]'
return '<p style="color: red"><code>Module:Calendar</code> error: no such calendar: <code>' .. system .. '</code></p>[[Category:Pages with script errors]]'

Revision as of 17:51, 22 May 2026

Submodules:


local p = {}

local def = require("Module:Utils").def

p.format = function(frame)
	local system = def(frame.args.cal, def(frame.args[1], 'gregorian'))
	if mw.title.new('Calendar/' .. system, 'Module').exists then
		local cal = require("Module:Calendar/"..system)
		return cal.to_formatted(cal.from(frame.args), frame.args)
	else
		return '<p style="color: red"><code>Module:Calendar</code> error: no such calendar: <code>' .. system .. '</code></p>[[Category:Pages with script errors]]'
	end
end



return p