15.269
Bearbeitungen
(Karte() mit wik.getArgs) |
(geocode location and locationlist erweitert um popuptitle/popuptext) |
||
| Zeile 25: | Zeile 25: | ||
local minimum_one_geocode_ok = false | local minimum_one_geocode_ok = false | ||
if not com.isTrue(args["Ehemals"]) then | if not com.isTrue(args["Ehemals"]) then | ||
local | -- locationlist und location zusammenführen | ||
local locations_merged = str.splitAndStrip(args["locationlist"] or "", ";") | |||
table.insert( | local location = str.strip(args["location"] or "") | ||
if location ~= "" then | |||
table.insert(locations_merged, args["location"] .. | |||
"~" .. (args["popuptitle"] or "") .. | |||
"~" .. (args["popuptext"] or "")) | |||
end | end | ||
for _, l in ipairs( | -- alle locations durchiterieren und für jedes ein subobject erstellen | ||
for _, l in ipairs(locations_merged) do | |||
local subobject_entry = {} | local subobject_entry = {} | ||
subobject_entry["Geolokation"] = | -- Aufteilung location ~ popuptitle ~ popuptext | ||
l = str.split2(l, "~") | |||
local location = str.strip(l[1] or "") | |||
local popuptitle = str.strip(l[2] or "") | |||
local popuptext = str.strip(l[3] or "") | |||
-- location geocode | |||
if location ~= "" then | |||
subobject_entry["Geolokation"] = location | |||
local geocode = frame:callParserFunction("#geocode", location) | |||
if geocode ~= "Geocoding failed" then | |||
subobject_entry["Geokoordinate"] = geocode | |||
minimum_one_geocode_ok = true | |||
end | |||
end | end | ||
-- popuptitle und popuptext ablegen | |||
if popuptitle ~= "" then | |||
subobject_entry["KartePopupTitle"] = popuptitle | |||
end | |||
if popuptext ~= "" then | |||
subobject_entry["KartePopupText"] = popuptext | |||
end | |||
-- subobject in Liste aufnehmen | |||
table.insert(subobjects, subobject_entry) | table.insert(subobjects, subobject_entry) | ||
end | end | ||
| Zeile 60: | Zeile 81: | ||
-- bisherige Vorlagen-Karte | -- bisherige Vorlagen-Karte | ||
t = frame:expandTemplate{title = "Karte/Legacy", args = args} | t = t .. frame:expandTemplate{title = "Karte/Legacy", args = args} | ||
mw.logObject(t, "t") | mw.logObject(t, "t") | ||