Modul:HTML: Unterschied zwischen den Versionen

330 Bytes hinzugefügt ,  Mittwoch um 07:38
keine Bearbeitungszusammenfassung
(line)
Keine Bearbeitungszusammenfassung
Zeile 2: Zeile 2:


function p.TableHeader(frame)
function p.TableHeader(frame)
-- mw.log("TableHeader(frame)")
return p.tableHeader(frame.args)
-- mw.logObject(frame.args, "frame.args")
end
 
function p.tableHeader(args)
-- mw.log("tableHeader(args)")
-- mw.logObject(args, "args")
local t =  
local t =  
"<table class=\"wikitable sortable\" border=\"1\">\n" ..
"<table class=\"wikitable sortable\" border=\"1\">\n" ..
"<tr>\n"
"<tr>\n"
for _, a in ipairs(frame.args) do
for _, a in ipairs(args) do
t = t .. "  <th>" .. a .. "</th>\n"
t = t .. "  <th>" .. a .. "</th>\n"
end
end
Zeile 19: Zeile 23:
end
end


function p.tableLine(line)
function p.tableLine(args)
-- mw.log("tableLine(line)")
-- mw.log("tableLine(args)")
-- mw.logObject(line, "line")
-- mw.logObject(args, "args")
local t = "<tr>\n"
local tr_args = ""
for _, a in ipairs(line) do
local td_args = ""
t = t .. "  <td>" .. a .. "</td>\n"
if args.tr_args ~= nil then
tr_args = " " .. args.tr_args
end
local t = "<tr " .. tr_args .. ">\n"
for _, a in ipairs(args) do
td_args = ""
if type(a) == "table" then
if a.td_args ~= nil then
td_args = " " .. a.td_args
end
a = a[1]
end
t = t .. "  <td" .. td_args .. ">" .. a .. "</td>\n"
end
end
t = t .. "</tr>\n"
t = t .. "</tr>\n"
Zeile 32: Zeile 48:


function p.TableFooter(frame)
function p.TableFooter(frame)
-- mw.log("TableFooter(frame)")
return p.tableFooter()
local t = "</table>\n"
end
-- mw.logObject(t, "t")
 
return t
function p.tableFooter()
-- mw.log("tableFooter()")
return "</table>\n"
end
end


return p
return p