Modul:Attribut: Unterschied zwischen den Versionen

Aus FürthWiki

1.171 Bytes hinzugefügt ,  Gestern um 16:02
+ AttrInfo(), attrInfotextDelimiter(), AttrField()
(getAttrAttributes() + ValueQuery; + AttrValueQuery())
(+ AttrInfo(), attrInfotextDelimiter(), AttrField())
 
Zeile 1: Zeile 1:
local p = {}
local p = {}
local dev = require("Modul:Development")


function p.getAttrAttributes(attr, klasse)
function p.getAttrAttributes(attr, klasse)
Zeile 60: Zeile 62:


function p.AttrText(frame) -- Attribut-Anzeige-Texte
function p.AttrText(frame) -- Attribut-Anzeige-Texte
return p.attrText(frame.args[1], frame.args[2])
local frame, _, args = dev.GetFrameAndParentArgs(frame)
local attr, klasse = args[1], args[2]
return p.attrText(attr, klasse)
end
end


function p.attrText(attr, klasse, mehrzahl)
function p.attrText(attr, klasse, mehrzahl)
local query, text = p.getAttrAttributes(attr, klasse)
local text
local query = p.getAttrAttributes(attr, klasse)
if query == nil then
if query == nil then
text = attr
text = attr
Zeile 73: Zeile 78:
end
end
return text
return text
end
function p.AttrInfo(frame)
local frame, _, args = dev.GetFrameAndParentArgs(frame)
local attr, klasse = args[1], args[2]
local info, delimiter = p.attrInfotextDelimiter(attr, klasse)
if info ~= nil then
info = info .. "."
if delimiter ~= nil then
info = info .. " Mehrere Eintragungen möglich, zu trennen per " ..
delimiter
end
info = string.gsub(info, "%.%.", ".")
info = frame:callParserFunction("#info", info, "note")
end
return info
end
function p.attrInfotextDelimiter(attr, klasse)
local text, delimiter
local query = p.getAttrAttributes(attr, klasse)
if query ~= nil then
text = query["Infotext"]
delimiter = query["Delimiter"]
end
return text, delimiter
end
function p.AttrField(frame)
local t = ""
local frame, _, args = dev.GetFrameAndParentArgs(frame)
local attr, klasse = args[1], args[2]
local query = p.getAttrAttributes(attr, klasse)
t = t .. "{{{field|" .. attr
if query ~= nil and query["FieldArgs"] ~= nil then
t = t .. "|" .. query["FieldArgs"]
end
t = t .. "}}}"
return t
end
end