Content deleted Content added
Tom.Reding (talk | contribs) m fix |
Tom.Reding (talk | contribs) Proper error checking, from sandbox |
||
Line 94:
}
local outString = nil
local bConfError = false
--prelim namespace/title determination
Line 198 ⟶ 199:
nextCent = currCent + 1
else
bConfError = true
trackingCategories[2] = '[[Category:Described in year error|N]]' --invalid category name
end
--conf error checkng (missing keys)
--produce description & toc▼
if
if conf[currGroup]
bConfError = true
description = conf[currGroup][currYDC].description▼
trackingCategories[2] = '[[Category:Described in year error|
if mw.ustring.match(description, '%%year%%') then▼
elseif conf[currGroup][currYDC] == nil then
if currYear then description = mw.ustring.gsub(description, '%%year%%', currYear) --"2001"▼
bConfError = true
else description = mw.ustring.gsub(description, '%%year%%', 'this year') end▼
trackingCategories[2] = '[[Category:Described in year error|2]]' --year/decade/century key missing
else▼
if conf[currGroup][currYDC].description == nil then
bConfError = true
trackingCategories[2] = '[[Category:Described in year error|3]]' --description key missing
end
if conf[currGroup][currYDC].parent1 == nil then
if mw.ustring.match(description, '%%decade%%') then▼
bConfError = true
if currDeca then description = mw.ustring.gsub(description, '%%decade%%', currDeca .. 's') --"2000s"▼
trackingCategories[2] = '[[Category:Described in year error|4]]' --parent key missing
else description = mw.ustring.gsub(description, '%%decade%%', 'this decade') end▼
end
if mw.ustring.match(description, '%%century%%') then▼
if currCent then description = mw.ustring.gsub(description, '%%century%%', addOrd(currCent)) --"21st"▼
else description = mw.ustring.gsub(description, '%%century%%', 'this century') end▼
▲ --produce description & toc
▲ end
if bConfError == false then
if mw.site.stats.pagesInCategory(currCat, 'pages') >= conf['tocmin'] then --expensive▼
local args = { numerals = 'no' }▼
toc = frame:expandTemplate{ title = 'Category TOC', args = args }▼
▲ end
▲ else
end
▲ trackingCategories[2] = '[[Category:Described in year error|T]]' --null description text
▲
end
▲
end
end
end
--produce cats & navs
if
local iparent = 1
local parenti = 'parent' .. iparent
Line 284 ⟶ 302:
parenti = 'parent' .. iparent
end --while conf[currGroup][currYDC][parenti] do
end --if
--check for non-existent cats
|