Tech, emailconfirmed, Administrators (Semantic MediaWiki), Curators (Semantic MediaWiki), Administrators
12,451
edits
Bongolium500 (talk | contribs) No edit summary |
Bongolium500 (talk | contribs) 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 | 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 | local numToReturn = 0 | ||
if #release < 5 then numToReturn = #release else numToReturn = 5 end | |||
local usedNumbers = {} | |||
for count in range(1, numToReturn) do | |||
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 |
edits