Modul:Turnierritter: Unterschied zwischen den Versionen

Aus GaretienWiki
Zur Navigation springen Zur Suche springen
VolkoV (D | B)
Keine Bearbeitungszusammenfassung
VolkoV (D | B)
Keine Bearbeitungszusammenfassung
Zeile 27: Zeile 27:


function ausgabe(zeile)
function ausgabe(zeile)
if 1==1 then
return dump(zeile,"")
end
local spalte={}
local spalte={}
for k,v in pairs(zeile) do
for k,v in pairs(zeile) do

Version vom 24. Juni 2024, 18:59 Uhr

Dokumentation unter Modul:Turnierritter/Doku.
require("Modul:Hilfsfunktionen")

local p = {}

function abfrage(query)
	local reiter=mw.smw.ask("[[Kategorie:Turnierritter]] "..query
		.."|mainlabel=-"
		.."|?#"
		.."|?Alter"
		.."|?Turnierstatus"
		.."|?Turnierklasse"
		.."|?Turnierpublikum"
		.."|?Turnieranmerkung"
		.."|?Wappen ist#"
		.."|?Bild ist#"
		.."|?Sortierschlüssel"
		.."|format=template"
		.."|template=Turnierritter"
		.."|searchlabel="
		.."|limit=500"
	)
	if reiter==nil then
		return {}
	end
	return reiter
end

function ausgabe(zeile)
	if 1==1 then
		return dump(zeile,"")
	end
	local spalte={}
	for k,v in pairs(zeile) do
		spalte[k]=robusttrim(zeile[k])
	end
	s='|-'
		..'\n|<span style="display:none;">'..spalte[9]..'</span>[['..spalte[7]..'|50x50px|link=]]'
		..'\n|[['..spalte[8]..'|50x50px|link=]]'
		..'\n|'..spalte[1]
		..'\n|'..spalte[2]
		..'\n|'
	if spalte[3]~="unbekannt" then s=s..spalte[3] end
	local sort=0
	if spalte[4]=='Neuling' then sort=1 end
	if spalte[4]=='Mittelmaß' then sort=2 end
	if spalte[4]=='Favorit' then sort=3 end
	if spalte[4]=='Legende' then sort=4 end
	s=s..'\n|<span style="display:none;">'..sort..'</span>'..spalte[4]
		..'\n|'
	if spalte[5]~="unbekannt" then s=s..spalte[5] end
	s=s..'|'..spalte[6]
end

function p.turnierreiter(frame)
	local query=robusttrim(frame.args[1])
	local reiter=abfrage(query)
	local s=""
	for _,v in pairs(reiter) do
		s=s..ausgabe(v)
	end
	return s
end

return p