Modul:Spielwiese
Erscheinungsbild
Hier können kurzzeitige Code-Tests oder sonstige Spielereien durchgeführt werden.
Zu weitergehenden und dauerhaften Tests siehe Hilfe:Lua #Erprobung.
local p = {}
function p.f(frame)
local args = frame:getParent().args
local items = {}
local titelPrefix = 'titel'
for key, value in pairs(args) do
local index = tonumber(key)
if index then
value = mw.text.trim(value)
if value ~= '' then
local titel = mw.text.trim(args[titelPrefix .. key] or '')
if titel ~= '' then
table.insert(items, string.format('[[%s|%s]]', value, titel))
else
table.insert(items, string.format('[[%s]]', value))
end
end
end
end
if #items == 0 then
return '<span class="error">Einbindungsfehler: Die [[Vorlage:Siehe auch|Vorlage „Siehe auch“]] benötigt immer mindestens ein Argument.</span>'
end
local text
if #items == 1 then
text = items[1]
elseif #items == 2 then
text = items[1] .. ' und ' .. items[2]
else
text = table.concat(items, ', ', 1, #items - 1)
text = text .. ' und ' .. items[#items]
end
return string.format(
'<div class="sieheauch" role="navigation" style="font-style:italic;"><span class="sieheauch-text">Siehe auch</span>: %s</div>',
text
)
end
return p