Module:Bongolium500/main page modules: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
no edit summary
No edit summary
No edit summary
Line 15: Line 15:
local monthName = MONTHS[tonumber(month)]
local monthName = MONTHS[tonumber(month)]
local pageName = day .. " " .. monthName .. " (releases)"
local pageName = day .. " " .. monthName .. " (releases)"
local outputWidget = "<div class=\"mainpage-releases tech\" id=\"releases\"><h2>[[" .. pageName .. "|On this day in...]]</h2> \n<h3>"
local outputWidget = "<div class=\"mainpage-releases tech\" id=\"releases\"><h2>[[" .. pageName .. "|On this day in...]]</h2>"
local pageText = frame:callParserFunction('#dpl:', {include='*', title=pageName}):gsub(".*-->", ""):gsub("<!--.*", "")
local pageText = frame:callParserFunction('#dpl:', {include='*', title=pageName}):gsub(".*-->", ""):gsub("<!--.*", "")
local releases = textUtil.split(pageText, "*")
local releases = textUtil.split(pageText, "*")
local randomRelease = releases[math.random(1, #releases)]
local numToReturn = 0
local temp = textUtil.split(randomRelease, " %- ")
if #release < 5 then numToReturn = #release else numToReturn = 5 end
local year = temp[1]
local usedNumbers = {}
local text = temp[2]
for count in range(1, numToReturn) do
outputWidget = outputWidget .. "..." .. year .."</h3> \n<span>" .. text .. "</span></div>"
local ranNum = math.random(1, #release)
while not usedNumbers[ranNum] do
ranNum = math.random(1, #release)
end
usedNumbers[ranNum] = true
local randomRelease = releases[ranNum]
local temp = textUtil.split(randomRelease, " %- ")
local year = temp[1]
local text = temp[2]
outputWidget = outputWidget .. "... \n<h3>" .. year .."</h3> \n<span>" .. text .. "</span>"
end
cache.set(PREFIX .. currentDate, outputWidget)
outputWidget = outputWidget .. "</div>"
--cache.set(PREFIX .. currentDate, outputWidget)
end
end
return outputWidget
return outputWidget
Cookies help us deliver our services. By using our services, you agree to our use of cookies.