Modul:Karte/Work: Unterschied zwischen den Versionen

Aus FürthWiki

keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 31: Zeile 31:


-- defaults setzen
-- defaults setzen
args["box"] = com.isTrue(args["box"] or "Ja") -- gleich in boolean wandeln
args["box"] = args["box"] or "Ja"
args["zoom"] = args["zoom"] or "16"
args["zoom"] = args["zoom"] or "16"


Zeile 37: Zeile 37:
geoobjects.geojson = {}
geoobjects.geojson = {}
geoobjects.geojson.arg = args["geojson"]
geoobjects.geojson.arg = args["geojson"]
geoobjects.geojson.pagename = geoobjects.geojson.arg or pagename
geoobjects.geojson.pagename = geoobjects.geojson.arg or pagename -- oder implizite GeoJson mit gleichem Seitennamen
geoobjects.geojson.fullpagename = "GeoJson:" .. geoobjects.geojson.pagename
geoobjects.geojson.fullpagename = "GeoJson:" .. geoobjects.geojson.pagename
geoobjects.geojson.url = "{{canonicalurl:" .. geoobjects.geojson.fullpagename .. "}}"
geoobjects.geojson.url =
"{{canonicalurl:" .. geoobjects.geojson.fullpagename .. "}}" -- über diese kommt man schneller dazu, eine neue GeoJson-Karte anzulegen
geoobjects.geojson.exists = wik.pageExists(geoobjects.geojson.fullpagename)
geoobjects.geojson.exists = wik.pageExists(geoobjects.geojson.fullpagename)
geoobjects.geojson.missing = (geoobjects.geojson.arg ~= nil and not geoobjects.geojson.exists)
geoobjects.geojson.missing =
(geoobjects.geojson.arg ~= nil and not geoobjects.geojson.exists)


-- width/height
-- width/height
if args["box"] or args["width"] == "auto" then
if com.isTrue(args["box"]) or args["width"] == "auto" then
args["width"] = nil -- ohne width passt sich Karte eigenständig in Box ein
args["width"] = nil -- ohne width passt sich Karte eigenständig in Box ein
elseif args["width"] == nil then
elseif args["width"] == nil then
args["width"] = "50%" -- default bei keiner width-Angabe und keiner Box
args["width"] = "50%" -- default bei keiner width-Angabe und keiner Box
end
end
if args["box"] or args["height"] == "auto" then
if com.isTrue(args["box"]) or args["height"] == "auto" then
args["height"] = nil -- ohne height passt sich Karte eigenständig in Box ein
args["height"] = nil -- ohne height passt sich Karte eigenständig in Box ein
elseif args["height"] == nil then
elseif args["height"] == nil then
Zeile 55: Zeile 57:
end
end


-- geocode location and locationlist
-- geocode location and locationlist -- zerlegt locationlist und versucht geocode zu jeder location
local minimum_one_geocode_ok = false -- Flag, dass mindestens ein geocode erfolgreich war
local minimum_one_geocode_ok = false -- Flag, dass mindestens ein geocode erfolgreich war
-- locationlist und location zusammenführen
-- locationlist in table splitten und mit location zusammenführen
local locationlist = str.splitAndStrip(args["locationlist"] or "", ";")
local locationlist = str.splitAndStrip(args["locationlist"] or "", ";") -- bei leerer locationlist wird leere Liste rückgeliefert
table.insert(locationlist,
if args["location"] ~= nil then -- location hinzufügen
(args["location"] or "") .. "~" ..
table.insert(locationlist, (args["location"] or "") .. "~" ..
(args["popuptitle"] or "") .. "~" ..
(args["popuptitle"] or "") .. "~" .. (args["popuptext"] or ""))
(args["popuptext"] or ""))
end
-- alle locations durchiterieren und für jedes ein subobject erstellen
-- alle locations durchiterieren und für jedes ein geoobject (später subobject) erstellen
for _, l in ipairs(locationlist) do
for _, l in ipairs(locationlist) do
-- Aufteilung location ~ popuptitle ~ popuptext
-- Aufteilung location ~ popuptitle ~ popuptext
Zeile 205: Zeile 207:
-- Box um Karte
-- Box um Karte
if args["box"] then
if com.isTrue(args["box"]) then
local headline = -- Box-Überschrift
local headline = -- Box-Überschrift
args["headline"] or geoobjects.geojson.arg or pagename
args["headline"] or geoobjects.geojson.arg or pagename