Difference between revisions of "Module:Birthday"
Jump to navigation
Jump to search
Line 9: | Line 9: | ||
local month = "" | local month = "" | ||
if (mw.ustring.find(date, "August")) then | if(mw.ustring.find(date, "January")) then | ||
month = " | month = 1 | ||
elseif(mw.ustring.find(date, "February")) then | |||
month = 2 | |||
elseif(mw.ustring.find(date, "March")) then | |||
month = 3 | |||
elseif(mw.ustring.find(date, "April")) then | |||
month = 4 | |||
elseif(mw.ustring.find(date, "May")) then | |||
month = 5 | |||
elseif(mw.ustring.find(date, "June")) then | |||
month = 6 | |||
elseif(mw.ustring.find(date, "July")) then | |||
month = 7 | |||
elseif(mw.ustring.find(date, "August")) then | |||
month = 8 | |||
elseif(mw.ustring.find(date, "September")) then | |||
month = 9 | |||
elseif(mw.ustring.find(date, "October")) then | |||
month = 10 | |||
elseif(mw.ustring.find(date, "November")) then | |||
month = 11 | |||
elseif(mw.ustring.find(date, "December")) then | |||
month = 12 | |||
end | end | ||
Revision as of 13:25, 9 May 2021
Documentation for this module may be created at Module:Birthday/doc
local p = {} function p.main(frame) local titleObject = mw.title.getCurrentTitle() local titleText = titleObject.fullText local date = mw.ustring.gsub(titleText, "List of characters born on ", "") local month = "" if(mw.ustring.find(date, "January")) then month = 1 elseif(mw.ustring.find(date, "February")) then month = 2 elseif(mw.ustring.find(date, "March")) then month = 3 elseif(mw.ustring.find(date, "April")) then month = 4 elseif(mw.ustring.find(date, "May")) then month = 5 elseif(mw.ustring.find(date, "June")) then month = 6 elseif(mw.ustring.find(date, "July")) then month = 7 elseif(mw.ustring.find(date, "August")) then month = 8 elseif(mw.ustring.find(date, "September")) then month = 9 elseif(mw.ustring.find(date, "October")) then month = 10 elseif(mw.ustring.find(date, "November")) then month = 11 elseif(mw.ustring.find(date, "December")) then month = 12 end local result = "This is a list of characters born on " .. date .. " --- test: " .. mw.ustring.find(date, "August") .. "test test" .. month .. "." local result = result .. "[[Category:Lists]]" local result = result .. "[[Category:Lists of characters by birthday]]" return result end return p