Content deleted Content added
Tom.Reding (talk | contribs) +|min= navbar functionality |
Tom.Reding (talk | contribs) m Style tweaks |
||
Line 37:
local function addOrd( i ) --20 -> 20th, etc.
if
local s = tostring(i)
local lastd = mw.ustring.match(s, '%d$')
if lastd == '1' then return s
elseif lastd == '2' then return s
elseif lastd == '3' then return s
elseif lastd ~= nil then return s
else return '' end
else
Line 54:
function p.autodetect( frame )
local currentTitle = mw.title.getCurrentTitle()
local header = ' ' --header template(s), nav bar, and category description text; whitespace-initialized for convenience▼
local nav = nil
local description = nil
▲ local header = ' ' --header template(s), nav bar, and category description text
local categories = {}
local outString = nil
Line 68:
local currDeca = mw.ustring.match(currCat, 'the (%d%d%d%d)s$')
local currCent = mw.ustring.match(currCat, 'the (%d+)[snrt][tdh] century')
local parentCent = nil --used with currYear (i.e. Fish) & currDeca (i.e. Spiders)▼
local parentDeca = nil --used with currYear (i.e. Spiders) & currDeca (i.e. Spiders)
▲ local parentCent = nil --used with currYear (i.e. Fish) & currDeca (i.e. Spiders)
local lastCent, nextCent = nil, nil --used with currYear (i.e. Fish) & currCent (i.e. Fish)
local minYear = tonumber(map[currGroup].min)
Line 94:
return '' --add err msg/cat?
end
--produce cats & navs
local iparent = 1
local parenti = 'parent' .. iparent
while
local parent = map[currGroup][currYDC][parenti]
▲ description = map[currGroup][currYDC].description
end▼
if currYDC == 'year' then
Line 117 ⟶ 114:
categories[iparent] = '[[:Category:' .. parent .. ' described in ' .. currYear .. ']]'
end
elseif currYDC == 'decade' then
if nav == nil then
nav = frame:expandTemplate{ title = 'Container category' }
local args = { decade = currDeca, min = minYear, cat = currGroup .. ' described in the' }
nav = frame:expandTemplate{ title = 'Category by decade', args = args }
Line 127 ⟶ 126:
categories[iparent] = '[[:Category:' .. parent .. ' described in the ' .. currDeca .. 's]]'
end
elseif currYDC == 'century' then
if nav == nil then
|