Jump to content

Module:Geological time and Module:Geological time/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
dedup Calabrian
 
use require('strict') instead of require('Module:No globals')
 
Line 8: Line 8:
-- these lists for a match, then return an appropriate link to the timespans
-- these lists for a match, then return an appropriate link to the timespans
-- adjacent to those matches
-- adjacent to those matches

p.eon = {'Hadean', 'Archean', 'Proterozoic', 'Phanerozoic'}
p.eon = {'Hadean', 'Archean', 'Proterozoic', 'Phanerozoic'}

p.era = {'Eoarchean', 'Paleoarchean', 'Mesoarchean', 'Neoarchean',
p.era = {'Eoarchean', 'Paleoarchean', 'Mesoarchean', 'Neoarchean',
'Paleoproterozoic', 'Mesoproterozoic', 'Neoproterozoic',
'Paleoproterozoic', 'Mesoproterozoic', 'Neoproterozoic',
'Paleozoic', 'Mesozoic', 'Cenozoic'}
'Paleozoic', 'Mesozoic', 'Cenozoic'}

p.period = {'Siderian', 'Rhyacian', 'Orosirian', 'Statherian',
p.period = {'Siderian', 'Rhyacian', 'Orosirian', 'Statherian',
'Calymmian', 'Ectasian', 'Stenian',
'Calymmian', 'Ectasian', 'Stenian',
Line 20: Line 17:
'Cambrian', 'Ordovician', 'Silurian', 'Devonian', 'Carboniferous', 'Permian',
'Cambrian', 'Ordovician', 'Silurian', 'Devonian', 'Carboniferous', 'Permian',
'Triassic', 'Jurassic', 'Cretaceous', 'Paleogene', 'Neogene', 'Quaternary'}
'Triassic', 'Jurassic', 'Cretaceous', 'Paleogene', 'Neogene', 'Quaternary'}

p.epoch = {'Terreneuvian', 'Cambrian Series 2', 'Miaolingian', 'Furongian',
p.epoch = {'Terreneuvian', 'Cambrian Series 2', 'Miaolingian', 'Furongian',
'Early Ordovician', 'Middle Ordovician', 'Late Ordovician',
'Early Ordovician', 'Middle Ordovician', 'Late Ordovician',
Line 33: Line 29:
'Paleocene', 'Eocene', 'Oligocene',
'Paleocene', 'Eocene', 'Oligocene',
'Miocene', 'Pliocene', 'Pleistocene', 'Holocene'}
'Miocene', 'Pliocene', 'Pleistocene', 'Holocene'}

p.series = {'Furongian',
p.series = {'Furongian',
'Lower Ordovician', 'Middle Ordovician', 'Upper Ordovician',
'Lower Ordovician', 'Middle Ordovician', 'Upper Ordovician',
Line 43: Line 38:
'Lower Jurassic', 'Middle Jurassic', 'Upper Jurassic',
'Lower Jurassic', 'Middle Jurassic', 'Upper Jurassic',
'Lower Cretaceous', 'Upper Cretaceous','Paleocene'}
'Lower Cretaceous', 'Upper Cretaceous','Paleocene'}

p.age = {'Fortunian', 'Cambrian Stage 2', 'Cambrian Stage 3', 'Cambrian Stage 4',
p.age = {'Fortunian', 'Cambrian Stage 2', 'Cambrian Stage 3', 'Cambrian Stage 4',
'Wuliuan', 'Drumian', 'Guzhangian', 'Paibian', 'Jiangshanian', 'Cambrian Stage 10',
'Wuliuan', 'Drumian', 'Guzhangian', 'Paibian', 'Jiangshanian', 'Cambrian Stage 10',
Line 58: Line 52:
'Danian','Selandian','Thanetian','Ypresian','Lutetian','Bartonian','Priabonian','Rupelian','Chattian',
'Danian','Selandian','Thanetian','Ypresian','Lutetian','Bartonian','Priabonian','Rupelian','Chattian',
{base='Aquitanian', dab='(stage)'},'Burdigalian','Langhian','Serravallian','Tortonian','Messinian','Zanclean','Piacenzian',
{base='Aquitanian', dab='(stage)'},'Burdigalian','Langhian','Serravallian','Tortonian','Messinian','Zanclean','Piacenzian',
'Gelasian',{base='Calabrian', dab='(stage)'},'Late Pleistocene','Greenlandian','Northgrippian','Meghalayan'}
'Gelasian',{base='Calabrian', dab='(stage)'},'Calabrian','Late Pleistocene','Greenlandian','Northgrippian','Meghalayan'}


-- Determine whether a query string matches a stored timespan string
-- Determine whether a query string matches a stored timespan string
Line 159: Line 153:
return warn
return warn
end
end
local prevTitle = adjacent.prev and mw.title.new(adjacent.prev, namespace)
local prevTitle = adjacent and adjacent.prev and mw.title.new(adjacent.prev, namespace)
local nextTitle = adjacent.next and mw.title.new(adjacent.next, namespace)
local nextTitle = adjacent and adjacent.next and mw.title.new(adjacent.next, namespace)
return catPair(prevTitle, nextTitle)
return catPair(prevTitle, nextTitle)
end
end


-- Template entry point
-- Function to find timespan before argument
function p._before(s)
local findOut = s and find(tostring(s))
return findOut and findOut.prev
end

-- Function to find timespan after argument
function p._after(s)
local findOut = s and find(tostring(s))
return findOut and findOut.next
end

-- Template entry points
function p.seeAlso(frame)
function p.seeAlso(frame)
local args = getArgs(frame)
local args = getArgs(frame)
return p._seeAlso(args)
return p._seeAlso(args)
end

function p.before(frame)
local args = getArgs(frame)
return p._before(args[1]) or ""
end

function p.after(frame)
local args = getArgs(frame)
return p._after(args[1]) or ""
end
end