Modul:Tabbox: Unterschied zwischen den Versionen

Aus FürthWiki

Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 19: Zeile 19:
end
end


local tpl_daten = p.daten(frame, args)
local tpl_tab = p.tab(frame, args["2"])
local tab_daten=''
local tab_tab=''
if tpl_daten:gsub("%s+", "") ~= '' then
if tpl_tab:gsub("%s+", "") ~= '' then
if args["Überschrift"] ~= nil then
tab_tab='<tab name=' .. args["1"] .. '>' .. tpl_tab .. '</tab>'
tab_daten='<tab name=' .. args["Überschrift"] .. '>' .. tpl_daten .. '</tab>'
else
tab_daten='<tab name=Daten>' .. tpl_daten .. '</tab>'
end
end
end


Zeile 47: Zeile 43:
end
end


function p.daten(frame, args)
function p.tab(frame, tabcontent)
     return frame:expandTemplate{title = 'Faktenbox/Daten', args=args}
     return frame:expandTemplate{title = 'Faktenbox/Tab', args={tabcontent=tabcontent}}
end
end


return p
return p

Version vom 25. August 2025, 18:48 Uhr

local p = {} --p stands for package

function p.Faktenbox( frame )
	local args = frame:getParent().args
	
	-- Before you ask: No, you cant' use extensionTag here!
	local tpl_bild = p.bild(frame, args)
	local tab_bild=''
	if tpl_bild:gsub("%s+", "") ~= '' then
		tab_bild='<tab name=Bild>' .. 
		tpl_bild .. '</tab>'
	end
	
	local tpl_karte = p.karte(frame, args)
	local tab_karte=''
	if tpl_karte:gsub("%s+", "") ~= '' then
		tab_karte='<tab name=Karte>' .. 
		tpl_karte .. '</tab>'
	end

	local tpl_tab = p.tab(frame, args["2"])
	local tab_tab=''
	if tpl_tab:gsub("%s+", "") ~= '' then
		tab_tab='<tab name=' .. args["1"] .. '>' .. tpl_tab .. '</tab>'
	end

	local t ='<div class=factbox><tabs>' .. 
	   tab_bild .. 
	   tab_karte ..
	   tab_daten .. 
	   '</tabs></div>'

	-- Use preprocess to render the factbox and all contens at once
	return frame:preprocess(t)
end

function p.bild(frame, args)
    return frame:expandTemplate{title = 'Bildertab', args={Bild=args.Bild}}
end

function p.karte(frame, args)
    return frame:expandTemplate{title = 'Faktenbox/Karte', args=args}
end

function p.tab(frame, tabcontent)
    return frame:expandTemplate{title = 'Faktenbox/Tab', args={tabcontent=tabcontent}}
end

return p