Module:Calendar date and Module:Calendar date/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
m Reverted edit by 213.147.181.177 (talk) to last version by 130.64.64.65 |
use require('strict') instead of require('Module:No globals') |
||
Line 3: | Line 3: | ||
Display Gregorian date of a holiday that moves year to year. Date data can be obtained from multiple sources as configured in Module:Calendar date/events |
Display Gregorian date of a holiday that moves year to year. Date data can be obtained from multiple sources as configured in Module:Calendar date/events |
||
"localfile" = local data file (eg. https://en.wikipedia.org/wiki/ |
"localfile" = local data file (eg. https://en.wikipedia.org/wiki/Template:Calendar_date/localfiles/Hanukkah) |
||
"calculator" = user-supplied date calculator |
"calculator" = user-supplied date calculator |
||
"wikidata" = <tbd> for holidays with their own date entity page such as https://www.wikidata.org/wiki/Q51224536 |
"wikidata" = <tbd> for holidays with their own date entity page such as https://www.wikidata.org/wiki/Q51224536 |
||
Line 39: | Line 39: | ||
if arg == "" or arg == nil then |
if arg == "" or arg == nil then |
||
return nil |
return nil |
||
else |
|||
⚫ | |||
end |
end |
||
⚫ | |||
end |
end |
||
local function trimArg2(arg) |
local function trimArg2(arg) |
||
if arg == nil then |
if arg == nil then |
||
return nil |
return nil |
||
else |
|||
⚫ | |||
end |
end |
||
⚫ | |||
end |
end |
||
Line 74: | Line 76: | ||
if display and ('' ~= display) then |
if display and ('' ~= display) then |
||
return table.concat ({'[[', link, '|', display, ']]'}); |
return table.concat ({'[[', link, '|', display, ']]'}); |
||
else |
|||
⚫ | |||
end |
end |
||
⚫ | |||
end |
end |
||
else -- no_link |
else -- no_link |
||
if display and ('' ~= display) then -- if there is display text |
if display and ('' ~= display) then -- if there is display text |
||
return display; -- return that |
return display; -- return that |
||
else |
|||
⚫ | |||
end |
end |
||
⚫ | |||
end |
end |
||
end |
end |
||
Line 172: | Line 176: | ||
if format ~= "infobox" then |
if format ~= "infobox" then |
||
return mw.getContentLanguage():formatDate (formatFull[df], date) |
return mw.getContentLanguage():formatDate (formatFull[df], date) |
||
else |
|||
⚫ | |||
end |
end |
||
⚫ | |||
end |
end |
||
Line 286: | Line 291: | ||
if startdate == enddate or cfg.days == "1" then -- single date |
if startdate == enddate or cfg.days == "1" then -- single date |
||
return prepend1 .. startdate .. endoutoffset .. cite |
return prepend1 .. startdate .. endoutoffset .. cite |
||
else |
|||
⚫ | |||
end |
end |
||
⚫ | |||
end |
end |
||
Line 328: | Line 334: | ||
--- Determine format type |
--- Determine format type |
||
format = trimArg(args.format) |
format = trimArg(args.format) |
||
if not format |
if not format then |
||
format = "none" |
|||
elseif format ~= "infobox" then |
|||
format = "none" |
format = "none" |
||
end |
end |
||
Line 391: | Line 399: | ||
elseif cfg.source then |
elseif cfg.source then |
||
cite = frame:preprocess('<ref name="' .. holiday .. ' dates">' .. cfg.source:gsub("YYYY", date) .. '</ref>') |
cite = frame:preprocess('<ref name="' .. holiday .. ' dates">' .. cfg.source:gsub("YYYY", date) .. '</ref>') |
||
else |
|||
cite = "" |
|||
end |
end |
||
else |
else |