Modul:Bild: Unterschied zwischen den Versionen

Aus FürthWiki
Zur Navigation springen Zur Suche springen
Zeile 13: Zeile 13:
 
t = '<table class="wikitable">'..
 
t = '<table class="wikitable">'..
 
'<th colspan="4">'..mw.title.getCurrentTitle().text..'</th>'
 
'<th colspan="4">'..mw.title.getCurrentTitle().text..'</th>'
 +
 +
if not isEmpty(args.Genre) then
 +
t=t..'<tr>'..
 +
'<td>[[Attribut:Genre|Genre]]</td>' ..
 +
'<td colspan="3">' ..
 +
frame:callParserFunction(
 +
'#arraymap', args.Genre, ';', 'x', '[[:Kategorie:x|x]]') .. '</td>' ..
 +
'</tr>'
 +
end
 
 
 
-- Liste Freiattribute und Werte auf
 
-- Liste Freiattribute und Werte auf
Zeile 27: Zeile 36:
 
end
 
end
 
 
if not isEmpty(args.Genre) then
 
t=t..'<tr>'..
 
'<td>[[Attribut:Genre|Genre]]</td>' ..
 
'<td colspan="3">' ..
 
frame:callParserFunction(
 
'#arraymap', args.Genre, ';', 'x', '[[:Kategorie:x|x]]') .. '</td>' ..
 
'</tr>'
 
end
 
 
if not isEmpty(args.Urheber) then
 
if not isEmpty(args.Urheber) then
 
t=t..'<tr>'..
 
t=t..'<tr>'..
Zeile 41: Zeile 42:
 
'</tr>'
 
'</tr>'
 
end
 
end
 +
 
if not isEmpty(args.Quellangaben) then
 
if not isEmpty(args.Quellangaben) then
 
t=t..'<tr>'..
 
t=t..'<tr>'..
Zeile 47: Zeile 49:
 
'</tr>'
 
'</tr>'
 
end
 
end
 +
 
if not isEmpty(args.Ort) then
 
if not isEmpty(args.Ort) then
 
t = t .. '<tr>'..
 
t = t .. '<tr>'..
Zeile 59: Zeile 62:
 
t=t..z..'</tr>'
 
t=t..z..'</tr>'
 
end
 
end
 +
 
if not isEmpty(args.Strasse) then
 
if not isEmpty(args.Strasse) then
 
t=t..'<tr>'..
 
t=t..'<tr>'..

Version vom 3. Februar 2024, 15:32 Uhr

local p = {} --p stands for package
local c = require( "Module:Common" )

function p.Faktenbox( frame )
	pf = frame:getParent()
	args = pf.args
	t1 = p.Daten( frame, args )
	t2 = p.NewBox( frame, args )
	return frame:preprocess(t1..'<br/>\n'..t2)
end

function p.NewBox( frame, args )
	t = '<table class="wikitable">'..
		'<th colspan="4">'..mw.title.getCurrentTitle().text..'</th>'
	
	if not isEmpty(args.Genre) then
		t=t..'<tr>'..
			'<td>[[Attribut:Genre|Genre]]</td>' ..
			'<td colspan="3">' .. 
				frame:callParserFunction(
				'#arraymap', args.Genre, ';', 'x', '[[:Kategorie:x|x]]') .. '</td>' ..
		'</tr>'
	end
	
	-- Liste Freiattribute und Werte auf
	for i=1,6 do
		a='Attribut'..i
		w='Wert'..i
		if not isEmpty(args[a]) then
			t=t..'<tr>'..
				'<td>[[Attribut:'..args[a]..'|'..args[a]..']]</td>'..
				'<td colspan="3">'..frame:callParserFunction(
				'#arraymap', args[w], ';', 'x', '[[x]]')..'</td>'..
			'</tr>'
		end
	end
	
	if not isEmpty(args.Urheber) then
		t=t..'<tr>'..
			'<td>[[Attribut:Urheber|Urheber]]</td>' ..
			'<td colspan="3">' .. args.Urheber ..'</td>'..
		'</tr>'
	end
	
	if not isEmpty(args.Quellangaben) then
		t=t..'<tr>'..
		    '<td>[[Attribut:Quellangaben|Quellangaben]]</td>'..
		    '<td colspan="3">'..args.Quellangaben..'</td>'..
		'</tr>'
	end
	
	if not isEmpty(args.Ort) then
		t = t .. '<tr>'..
			'<td>[[Attribut:Ort|Ort]]</td>'..
			'<td>'..frame:callParserFunction(
				'#arraymap', args.Ort, ';', 'x', '[[x]]') ..'</td>'..
			'<td><b>ausblenden:</b></td>'
		z = '<td></td>'
		if not isEmpty(args.ZeigeNichtInOrt) then
			z = '<td>'..args.ZeigeNichtInOrt..'</td>'
		end
		t=t..z..'</tr>'
	end
	
	if not isEmpty(args.Strasse) then
		t=t..'<tr>'..
			'<td>[[Attribut:Strasse|Straße]]</td>'..
			'<td>'..frame:callParserFunction(
				'#arraymap', args.Strasse, ';', 'x', '[[x]]') ..'</td>'..
			'<td><b>ausblenden:</b></td>'
		z = '<td></td>'
		if not isEmpty(args.ZeigeNichtInStrasse) then
			z = '<td>'..args.ZeigeNichtInStrasse..'</td>'
		end
		t=t..z..'</tr>'
	end
		t=t..'</table>' 
	return t
end 

function p.Daten( frame, args )
	t = frame:expandTemplate{title = 'Bild.Daten', args={
        Genre=args.Genre,
        Attribut1=args.Attribut1,
        Wert1=args.Wert1,
        Attribut2=args.Attribut2,
        Wert2=args.Wert2,
        Attribut3=args.Attribut3,
        Wert3=args.Wert3,
        Attribut4=args.Attribut4,
        Wert4=args.Wert4,
        Attribut5=args.Attribut5,
        Wert5=args.Wert5,
        Attribut6=args.Attribut6,
        Wert6=args.Wert6,
        Urheber=args.Urheber,
        Quellangaben=args.Quellangaben,
        Ort=args.Ort,
        ZeigeNichtInOrt=args.ZeigeNichtInOrt,
        Strasse=args.Strasse,
        Hausnummer=args.Hausnummer,
        ZeigeNichtInStrasse=args.ZeigeNichtInStrasse,
        Erstellungsdatum=args.Erstellungsdatum,
        UeberDatum=args.UeberDatum,
        Seitennummer=args.Seitennummer,
        Signatur=args.Signatur,
        Beschreibung=args.Beschreibung,
        Lizenz=args.Lizenz}
	}
    return t
end

return p