Modulo:Kategorio laŭ jaro
Dokumentado por ĉi tiu modulo povas esti kreata ĉe Modulo:Kategorio laŭ jaro/dokumentado
local p = {}
function getCenturyBox(namespace, century)
local text = '<div class="toccolours" style="margin:2px 0;font-size:87%;line-height:1.6;-moz-column-width:30em;-webkit-column-width:30em;column-width:30em;-moz-column-gap:.5em;-webkit-column-gap:.5em;column-gap:.5em;column-gap:.5em;column-rule:thin solid #AAA;text-align:center">'
text = text .. "'''" .. namespace .. " laŭ jaroj:''' "
text = text .. "[[:Kategorio:" .. namespace .. " - " .. century .. "00"..
"|<small>''(antaŭaj jaroj ĝis " ..century .. "00)''</small>]]<br>"
local year = century * 100 + 1
while year < (century + 1) * 100 + 1 do
text = text .. "[[:Kategorio:" .. namespace .. " - " .. year .. "|" .. year .. "]]"
if year % 10 == 0 then
text = text .. "<br>"
else
text = text .. " '''·''' "
end
year = year + 1
end
text = text .. "[[:Kategorio:" .. namespace .. " - " .. century + 1 .. "01"..
"|<small>''(sekvaj jaroj ekde " ..century + 1 .. "01)''</small>]]<br>" text = text .. '</div>'
return text
end
function p.main()
local name = mw.title.getCurrentTitle().text
local namespace, year = mw.ustring.match(name, '([^ ]+) %- (%d%d%d%d)')
local decade = year % 100
local century = math.floor((year - 1) / 100) + 1
local text = getCenturyBox(namespace, century - 1)
text = text .. mw.ustring.format('[[Kategorio:%s - %s-a jarcento|%s]]', namespace, century, decade)
text = text .. mw.ustring.format('[[Kategorio:%s laŭ jaroj|%s]]', namespace, year)
text = text .. '[[Kategorio:' .. year .. ']]'
return text
end
return p