Modul:Benutzer:Volcanus:FIDE-Titel

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

Die Dokumentation für dieses Modul kann unter Modul:Benutzer:Volcanus:FIDE-Titel/Doku erstellt werden

local wikidata = require("Modul:Wikidata")

local p = {}

local TestConfig = {
	{
		Title = "Sportmeister der Sowjetunion im Schach",
		Periods = {
			{
				PStart = "1929", 
				PEnd = "1935"
			},
			{PStart = 1967}
		}
	},
	{
		Title = "Internationaler Meister im Fernschach",
		Periods = {
			{PStart = 1967}
		}
	},
	{
		Title = "Internationaler Schiedsrichter",
		Periods = {
			{PStart = 1956}
		}
	},
	{
		Title = "test",
		Periods = {
			{PEnd = 2021}
		}
	}
}

function p.outputTestConfig()
	local erg = ""
	for key, titles in pairs(TestConfig) do
		for idx, title in pairs(titles) do
			if idx == "Title" then
				erg = erg .. title .. " "
			elseif idx == "Periods" then
				local length = #title
				for idx2, year in pairs(title) do					
					if idx2 == 1 then
						erg = erg .. "("
					else
						erg = erg .. "; "
					end
				
					if year.PStart and year.PStart ~= "" then
						erg = erg .. year.PStart .. "-"
					else
						erg = erg .. "????" .. "-"
					end
					if year.PEnd and year.PEnd ~= "" then
						erg = erg .. year.PEnd
					else
						erg = erg .. "????"
					end
					
					if idx2 == length then
						erg = erg .. ")"
					end
				end
			end
		end
		erg = erg .. "<br />"
	end
	return erg
end

function p.getWikidata(frame)
	local wd = wikidata.claim(frame)
	local erg = ""
	if wd then
		local temp = mw.text.split(wd, "\n", plain )
		for k, v in pairs(temp) do
			erg = erg .. v 
		end
	end
	return erg
end

function p.hello( frame )
    return "Hello, world!"
end

return p