Modul:Category described in year: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
Glorious Engine (bicara | kontrib)
←Membuat halaman berisi 'require('Module:No globals') local conf = require( 'Module:Category described in year/conf' ) --configuration module --[[============================================...'
 
Tidak ada ringkasan suntingan
Baris 44:
local categories = {}
local trackingCategories = {
[1] = '', --placeholder for [[CategoryKategori:Described in year unknown category]]
[2] = '', --placeholder for [[CategoryKategori:Described in year error]]
}
local outString = nil
Baris 62:
else --currQID & currCat both nil
if currentTitle.fullText ~= 'Template:Category described in year' then --ignore self...
trackingCategories[2] = '[[CategoryKategori:Described in year error|P]]' --missing a category parameter outside category namespace
end
end
Baris 153:
currYDCF = 'decade'
bConfError = true
trackingCategories[2] = '[[CategoryKategori:Described in year error|D]]' --invalid decade-parent (deprecated)
elseif currCent then
currYDCF = 'century'
Baris 160:
else
bConfError = true
trackingCategories[2] = '[[CategoryKategori:Described in year error|N]]' --invalid category name
end
Baris 169:
if conf[currGroup] == nil then
bConfError = true
trackingCategories[2] = '[[CategoryKategori:Described in year error|1]]' --group (Bacteria/Plants/etc.) key missing from conf
elseif conf[currGroup][currYDCF] == nil then
bConfError = true
trackingCategories[2] = '[[CategoryKategori:Described in year error|2]]' --year/century/formal key missing
else
if conf[currGroup][currYDCF].description == nil then
bConfError = true
trackingCategories[2] = '[[CategoryKategori:Described in year error|3]]' --description key missing
end
if conf[currGroup][currYDCF].parent1 == nil then
bConfError = true
trackingCategories[2] = '[[CategoryKategori:Described in year error|4]]' --parent key missing
end
end
Baris 230:
if parent == 'century' then
if isNilOrEmpty(sortkey) then sortkey = currYear end --default to currYear
categories[iparent] = '[[CategoryKategori:'..currGroup..' described in the '..addOrd(parentCent)..' century|'..sortkey..']]'
elseif parent == 'biology' then
if isNilOrEmpty(sortkey) then sortkey = '' --default to none
else sortkey = '|'..sortkey end
if tonumber(currYear) < 1865 then
categories[iparent] = '[[CategoryKategori:'..currYear..' in science'..sortkey..']]' --biology cat structure doesn't exist pre-1865, as of 10/2018
else
categories[iparent] = '[[CategoryKategori:'..currYear..' in biology'..sortkey..']]' --if/when all biology cats exists, merge this elseif with 'paleontology'
end
elseif parent == 'paleontology' then
if isNilOrEmpty(sortkey) then sortkey = '' --default to none
else sortkey = '|'..sortkey end
categories[iparent] = '[[CategoryKategori:'..currYear..' in '..parent..sortkey..']]'
elseif parent == 'environment' then
if isNilOrEmpty(sortkey) then sortkey = '' --default to none
else sortkey = '|'..sortkey end
categories[iparent] = '[[CategoryKategori:'..currYear..' in the environment'..sortkey..']]'
elseif mw.ustring.match(parent, '^%u[%l ]+') then --e.g. Animals/Insects/Fossil taxa
if isNilOrEmpty(sortkey) then sortkey = '' --default to none
else sortkey = '|'..sortkey end
categories[iparent] = '[[CategoryKategori:'..parent..' described in '..currYear..sortkey..']]'
else
trackingCategories[2] = '[[CategoryKategori:Described in year error|Y]]' --invalid year-parent
end
Baris 267:
if parent == 'formal' then
if isNilOrEmpty(sortkey) then sortkey = addOrd(currCent) end --default to currCent
categories[iparent] = '[[CategoryKategori:'..currGroup..' by year of formal description|'..sortkey..']]'
elseif parent == 'biology' then
if isNilOrEmpty(sortkey) then sortkey = '' --default to none
else sortkey = '|'..sortkey end
if tonumber(currCent) < 19 then
categories[iparent] = '[[CategoryKategori:'..addOrd(currCent)..' century in science'..sortkey..']]' --biology cat structure doesn't exist pre-1865, as of 10/2018
else
categories[iparent] = '[[CategoryKategori:'..addOrd(currCent)..' century in biology'..sortkey..']]' --if/when all biology cats exists, merge this elseif with 'paleontology'
end
elseif parent == 'paleontology' then
if isNilOrEmpty(sortkey) then sortkey = '' --default to none
else sortkey = '|'..sortkey end
categories[iparent] = '[[CategoryKategori:'..addOrd(currCent)..' century in '..parent..sortkey..']]'
elseif parent == 'environment' then
if isNilOrEmpty(sortkey) then sortkey = '' --default to none
else sortkey = '|'..sortkey end
categories[iparent] = '[[CategoryKategori:'..addOrd(currCent)..' century in the environment'..sortkey..']]'
elseif mw.ustring.match(parent, '^%u[%l ]+') then --e.g. Animals/Insects/Fossil taxa
if isNilOrEmpty(sortkey) then sortkey = '' --default to none
else sortkey = '|'..sortkey end
categories[iparent] = '[[CategoryKategori:'..parent..' described in the '..addOrd(currCent)..' century'..sortkey..']]'
else
trackingCategories[2] = '[[CategoryKategori:Described in year error|C]]' --invalid century-parent
end
Baris 299:
if parent == 'Group' then
if isNilOrEmpty(sortkey) then sortkey = ' Year' end --default to " Year"
categories[iparent] = '[[CategoryKategori:'..currGroup..'|'..sortkey..']]'
elseif parent == 'Animals' or parent == 'Insects' or parent == 'Molluscs' then
if isNilOrEmpty(sortkey) then sortkey = ' ' end --default to " "
categories[iparent] = '[[CategoryKategori:'..parent..' by year of formal description|'..sortkey..']]'
elseif parent == 'Species' or parent == 'Taxa' or parent == 'Fossil taxa' then
if isNilOrEmpty(sortkey) then sortkey = '' --default to none
else sortkey = '|'..sortkey end
categories[iparent] = '[[CategoryKategori:'..parent..' by year of formal description'..sortkey..']]'
elseif parent == 'paleontology' then
if isNilOrEmpty(sortkey) then sortkey = ' ' end --default to " "
categories[iparent] = '[[CategoryKategori:Paleontology by year|'..sortkey..']]'
else
trackingCategories[2] = '[[CategoryKategori:Described in year error|F]]' --invalid formal-parent
end
--[[========================= Error ==========================]]
else
trackingCategories[2] = '[[CategoryKategori:Described in year error|U]]' --unknown configuration
end
Baris 329:
local cat = mw.ustring.match(category, '%[%[Category:([%w%s]+)')
if mw.title.new(cat, 14).exists == false then
trackingCategories[1] = '[[CategoryKategori:Described in year unknown category]]'
break
end