24.921
Bearbeitungen
(query["Einzahl"] = query["Einzahl"] or query["Mehrzahl"] or attr) |
(getAttrAttributes() + ValueQuery; + AttrValueQuery()) |
||
| Zeile 2: | Zeile 2: | ||
function p.getAttrAttributes(attr, klasse) | function p.getAttrAttributes(attr, klasse) | ||
-- Kommandozeile zum Debuggen: | |||
-- mw.logObject(p.getAttrAttributes("Ehemals")) | |||
-- mw.logObject(p.getAttrAttributes("BietetKartenzahlung")) | |||
local query = {"[[Attribut:" .. attr .. "]]", | local query = {"[[Attribut:" .. attr .. "]]", | ||
"?Datentyp#-", mainlabel = "-", limit = 1} | "?Datentyp#-", mainlabel = "-", limit = 1} | ||
| Zeile 42: | Zeile 45: | ||
query["Mehrzahl"] = query["Mehrzahl"] or query["Einzahl"] or attr | query["Mehrzahl"] = query["Mehrzahl"] or query["Einzahl"] or attr | ||
query["Einzahl"] = query["Einzahl"] or query["Mehrzahl"] or attr | query["Einzahl"] = query["Einzahl"] or query["Mehrzahl"] or attr | ||
-- Abfrage-String zusammenbauen | |||
query["ValueQuery"] = "?" .. attr | |||
if query["Anzeigeformat"] ~= nil then | |||
query["ValueQuery"] = | |||
query["ValueQuery"] .. "#" .. query["Anzeigeformat"] | |||
end | |||
if query["Einzahl"] ~= attr then | |||
query["ValueQuery"] = | |||
query["ValueQuery"] .. "=" .. query["Einzahl"] | |||
end | |||
end | end | ||
return query | return query | ||
| Zeile 60: | Zeile 73: | ||
end | end | ||
return text | return text | ||
end | |||
function p.AttrValueQuery(frame) -- Attribut-Abfragestring | |||
-- Kommandozeile zum Debuggen: | |||
-- =p.AttrValueQuery{args={"BietetKartenzahlung"}} | |||
local attr = frame.args[1] | |||
local klasse = frame.args[2] | |||
local query = p.getAttrAttributes(attr, klasse) | |||
return query["ValueQuery"] | |||
end | end | ||
return p | return p | ||