Module:Calendar: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 5: | Line 5: | ||
p.format = function(frame) | p.format = function(frame) | ||
local system = def(frame.args.cal, def(frame.args[1], 'gregorian')) | local system = def(frame.args.cal, def(frame.args[1], 'gregorian')) | ||
if mw.title.new('Calendar/' .. system, 'Module').exists | 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) | cal.to_formatted(cal.from(frame.args), frame.args) | ||
Revision as of 17:50, 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)
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