Zmiany
m
local skip
elseif (i~=1 and mw.ustring.gsub(element, "%s", "") == tostring(tonumber(element))) then
tabela = tabela .. "| style=\"text-align:right;\" | " .. element .. "\n"
suma[i] = suma[i] + (tonumber(element) or 0)
skip = 1
tabela sumy = tabela sumy .. "| style=\n"text-align:right pokazsumy = 0;\" | " .. element .. "\n"
parametr wierszcenter
local wiersznaglowek = wywolanie.args['wiersz nagłówek'] or ""
local wierszpodsumowanie = wywolanie.args['wiersz podsumowanie'] or ""
local wierszcenter = wywolanie.args['wiersz center'] or "style=\"background:#ddd; border-top:1px solid #aaa; text-align:center;\""
local separator = "*"
local linia
local kolumny = 0
local suma = {}
local pokazsuma = {}
local format = {}
local kategoria = "Kategoria:Infoboksy – błędne dane – " .. (wywolanie.args['kategoria'] or "Moduł:Infoboksy")
local i
if wywolanie.args['nagłówek'] then
tabela = tabela .. "| " .. element .. "\n"
suma[kolumny] = 0
pokazsuma[kolumny] = 1
format[kolumny] = ""
end
end
if wywolanie.args['wiersz'] then
local wiersz = "!" .. wywolanie.args['wiersz']
i = 0
while (mw.ustring.match(wiersz, "![^!]*")) do
element = mw.ustring.match(wiersz, "![^!]*")
wiersz = mw.ustring.gsub(wiersz, p._escapePattern(element), "", 1)
element = mw.ustring.gsub(element, "!%s*", "")
i = i+1
format[i] = element
end
end
local wiersze = 0
if wywolanie.args['tabela'] then
local zawartosc = wywolanie.args['tabela'] .. "\n"
while (mw.ustring.match(zawartosc, "[^\n]*\n")) do
wiersze = wiersze + 1
linia = mw.ustring.match(zawartosc, "[^\n]*\n")
zawartosc = mw.ustring.gsub(zawartosc, p._escapePattern(linia), "", 1)
i = 0
if mw.ustring.match(linia, "!%+") then
linia = mw.ustring.gsub(linia, "!%+%s", "")
i = kolumny
tabela = tabela .. "! colspan=\"" .. kolumny .. "\" " .. wierszcenter .. " | " .. linia .. "\n"
linia = ""
end
while (i<kolumny and mw.ustring.match(linia, "![^!]*")) do
element = mw.ustring.match(linia, "![^!]*")
i = i+1
local liczba
liczba = mw.ustring.match(element, "^%d+") or ""
element = mw.ustring.gsub(element, p._escapePattern(liczba), "", 1)
if tonumber(liczba) == nil then
pokazsuma[i] = 0
else
suma[i] = suma[i] + (tonumber(liczba) or 0)
end
element = liczba .. element
if element ~= "" then
if format[i] == "()" then
element = "(" .. element .. ")"
end
end
if (wywolanie.args['kol'..i]) then
tabela = tabela .. "| " .. wywolanie.args['kol'..i] .. " | " .. element .. "\n"
else
tabela = tabela .. "| " .. element .. "\n"
end
end
while (i<kolumny) do
i = i+1
pokazsuma[i] = 0
end
if linia ~= "" then
tabela = tabela .. "|-\n! colspan=\"" .. kolumny .. "\" style=\"background:pink;\" | [[" .. kategoria .. "]] BŁĄD: " .. mw.ustring.gsub(linia, "%n", "") .. "\n"
end
end
if zawartosc ~= "" then
tabela = tabela .. "|-\n! colspan=\"" .. kolumny .. "\" style=\"background:red;\" | [[" .. kategoria .. "]] BŁĄD: " .. mw.ustring.gsub(zawartosc, "%n", "") .. "\n"
end
end
if wywolanie.args['podsumowanie'] then
i = 0
tabela = tabela .. "|- " .. wierszpodsumowanie .. "\n"
local podsumowanie = "!" .. wywolanie.args['podsumowanie']
local pokazsumy = 1
if wiersze < 2 then
pokazsumy = 0
end
local sumy = ""
while (i<kolumny and mw.ustring.match(podsumowanie, "![^!]*")) do
element = mw.ustring.match(podsumowanie, "![^!]*")
i = i+1
if element == "-+" then skip = skip+1if pokazsuma[i]>0 then elseif element if format[i] == "+()" then tabela suma[i] = tabela .. "| style=\"text-align:right;\" | (" .. suma[i] .. "\n)" skip = 1 else if skip>1 then end tabela sumy = tabela sumy .. "| colspan=\"" .. skip .. "\" style=\"text-align:right;\" | " .. element suma[i] .. "\n"
else
end
else skip sumy = 1sumy .. "| style=\"text-align:right;\" | " .. element .. "\n"
end
end
if podsumowanie ~= "" pokazsumy>0 then tabela = tabela .. "|-\n! colspan=\"" .. kolumny .. "\" style=\"background:red;\" | " .. podsumowanie .. "\n"sumy
end
end