Modul:QoD
Pidangan
This module is used by {{QoDList}} to automatically show a list of all "Quotes of the Day" for a given month and year.
local dayBase = 'Wikiquote:Cutatan poé ieu/'
local lang = mw.language.getContentLanguage()
local p = {}
function msg(monthName)
if string.len(monthName)<=3 then
return monthName..' long'
end
return monthName
end
function p.list(frame)
local s = frame.args[1]
if s==nil or s=='' then
s = mw.title.getCurrentTitle().subpageText
end
local month, year = string.match(s,'^(%w+) (%d+)$')
if month==nil or year==nil then
s = mw.title.new(frame:getTitle()).subpageText
end
month, year = string.match(s,'^(%w+) (%d+)$')
if month~=nil and year~=nil then
local output = {}
local viw = frame:preprocess('{{lcfirst:{{int:view}}}}')
local tlk = frame:preprocess('{{lcfirst:{{int:talk}}}}')
local his = frame:preprocess('{{lcfirst:{{int:history short}}}}')
for x = 1,tonumber(lang:formatDate('t','1 '..month..' '..year)) do
local page = mw.title.new(dayBase..x..' '..month..', '..year)
local t = ';[['..x..' '..month..']]\n'
if page.exists then
t = t..frame:preprocess(page:getContent())
else
t = t..'[['..page.fullText..']]'
end
t = t..' <br clear="all">\n'
t = t..'[['..page.fullText..'|'..viw..']] - [['..page.talkPageTitle.fullText..'|'
t = t..tlk..']] - ['..page:fullUrl{action = 'history'}..' '..his..']'
table.insert(output,t)
end
output = table.concat(output,'\n----\n')
output = output..'\n[[tr:Vikisöz:Günün sözü/Arşiv/'..mw.message.new(msg(month)):inLanguage('tr'):plain()..' '..year..']]'
return output
end
end
return p