Modul:Data/DE-096775621/1/37
Die Dokumentation für dieses Modul kann unter Modul:Data/DE-096775621/1/37/Doku erstellt werden
local p = {}
local tData = {
["rootfield"] = {
["access date"] = "2017-02-20",
["Einwohnerzahlen date"] = "2017-01-01",
["page"] = "http://www.vgem-marktheidenfeld.de/verwalt/EWzahlen.htm",
["publisher"] = "Verwaltungsgemeinschaft Marktheidenfeld",
["title"] = "Entwicklung der Einwohnerzahlen seit 1981",
["url"] = "http://www.vgem-marktheidenfeld.de/verwalt/EWzahlen.htm",
},
["value"] = {
["Birkenfeld"]=1630,
["Billingshausen"]=502,
["Gemeinde Birkenfeld"]=2132,
["Bischbrunn"]=921,
["Oberndorf"]=898,
["Gemeinde Bischbrunn"]=1819,
["Erlenbach"]=1744,
["Tiefenthal"]=633,
["Gemeinde Erlenbach"]=2377,
["Esselbach"]=903,
["Kredenbach"]=686,
["Steinmark"]=484,
["Gemeinde Esselbach"]=2073,
["Hafenlohr"]=1414,
["Windheim"]=469,
["Gemeinde Hafenlohr"]=1883,
["Karbach"]=1443,
["Roden"]=543,
["Ansbach"]=446,
["Gemeinde Roden"]=989,
["Rothenfels"]=372,
["Bergrothenfels"]=630,
["Stadt Rothenfels"]=1002,
["Urspringen"]=1378,
["VG"]=15096,
},
["valuefield"] = {
[""] = 1,
["Einwohnerzahlen"] = 1,
},
}
function p.getData(tArgs)
if type(tArgs) == type({}) then
local sArgs ="\n* fieldError\n* keyError\n* arg1"
local tClip = {tData["value"][tArgs.key]}
if tArgs.tryOther and not tClip then
local b, tSub = pcall(require, "Module:Data/DE-096775621/1/36")
if type(tSub) == type({}) and tSub.getData then
return tSub.getData(tArgs)
end
end
tArgs.field = tArgs.field or ""
if tData["rootfield"][tArgs.field] then
return tData["rootfield"][tArgs.field]
elseif tArgs.field == "field list" then
local s = "* field list\n*key table" .. sArgs
local t = {}
for i, v in pairs(tData["rootfield"]) do
t[#t + 1] = i
end
table.sort(t)
for i, v in pairs(t) do
s = s .. "\n* " .. v
end
t = {}
for i, v in pairs(tData["valuefield"]) do
t[#t + 1] = i
end
table.sort(t)
for i, v in pairs(t) do
s = s .. "\n* " .. v
end
return s
elseif tArgs.field == "key table" then
local s = '{| class="wikitable"\n!key\n'
local t = {}
for i, v in pairs(tData["value"]) do
t[#t + 1] = {i}
end
table.sort(t, function(t1 ,t2) return t1[1] < t2[1] end)
for i, v in pairs(t) do
s = s .. "|-\n|" .. v[1] .. "\n"
end
return s .. "|}"
elseif (sArgs .. "\n"):find("\n* " .. tArgs.field .. "\n", 1 ,true) then
return tArgs[tArgs.field]
elseif not tClip then
tArgs.keyError = tArgs.keyError or '<span class="error">key = ""</span>'
return tArgs.keyError
elseif tData["valuefield"][tArgs.field] then
return tClip[tData["valuefield"][tArgs.field]]
else
tArgs.fieldError = tArgs.fieldError or '<span class="error">field = "field list"</span>'
return tArgs.fieldError
end
else
return '<span class="error">tArgs = {}</span>'
end
end
function p.invokeData(frame)
local t = {}
t.key = frame.args[1] or frame.args["key"]
t.field = frame.args[2] or frame.args["field"]
for i, v in pairs(frame.args) do
t[i] = t[i] or v
end
return p.getData(t)
end
return p