Modul:Wartung: Unterschied zwischen den Versionen

Aus FürthWiki

Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 21: Zeile 21:
t = t .. htm.tableHeader(z)
t = t .. htm.tableHeader(z)
else
else
local anzahl = 0
local zeile = {}
local zeile = {}
local query = ""
for _, s in ipairs(zeilen[1]) do
if z[s] ~= "" and s ~= "Anzahl" then
query = query .. "[[" .. s .. "::" .. z[s] .. "]]"
end
end
query = query .. "|format=count"
z["Anzahl"] = mw.smw.ask(query)
for _, s in ipairs(zeilen[1]) do
for _, s in ipairs(zeilen[1]) do
table.insert(zeile, z[s])
table.insert(zeile, z[s])

Version vom 14. Januar 2026, 07:57 Uhr

local p = {}

local htm = require("Modul:HTML")

local zeilen =
	{	{	"Wartungsmeldung",
			"Kategorie",
			"KlassenName",
			"Ehemals",
			"Anzahl"},
		{	["Wartungsmeldung"] = "Datei-Freiattribut-Fehler",
			["Kategorie"] = "",
			["KlassenName"] = "",
			["Ehemals"] = ""},
	}

function p.Wartungstabelle(frame)
	local t = ""
	for i, z in ipairs(zeilen) do
		if i == 1 then
			t = t .. htm.tableHeader(z)
		else
			local zeile = {}
			local query = ""
			for _, s in ipairs(zeilen[1]) do
				if z[s] ~= "" and s ~= "Anzahl" then
					query = query .. "[[" .. s .. "::" .. z[s] .. "]]"
				end
			end
			query = query .. "|format=count"
			z["Anzahl"] = mw.smw.ask(query)
			for _, s in ipairs(zeilen[1]) do
				table.insert(zeile, z[s])
			end
			table.insert(zeile, anzahl)
			t = t .. htm.tableLine{zeile}
		end
	end
	t = t .. htm.tableFooter()
	return t
end

return p