Modul:Karte/Work: Unterschied zwischen den Versionen

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


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


Zeile 41: Zeile 41:
geoobjects.geojson.url = "{{canonicalurl:" .. geoobjects.geojson.fullpagename .. "}}"
geoobjects.geojson.url = "{{canonicalurl:" .. geoobjects.geojson.fullpagename .. "}}"
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)


-- width/height
-- width/height
if com.isTrue(args["box"]) or args["width"] == "auto" then
if 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 com.isTrue(args["box"]) or args["height"] == "auto" then
if 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 182: Zeile 183:
-- mw.logObject(map_args, "map_args")
-- mw.logObject(map_args, "map_args")
t = t .. frame:callParserFunction("#display_map", map_args)
t = t .. frame:callParserFunction("#display_map", map_args)
if geoobjects.geojson.arg ~= nil and map_args["geojson"] == nil then
if geoobjects.geojson.missing then
t = t .. "<small>Karte [" .. geoobjects.geojson.url .. " " ..
t = t .. "<small>Karte [" .. geoobjects.geojson.url .. " " ..
geoobjects.geojson.arg .. "] nicht gefunden</small>"
geoobjects.geojson.arg .. "] nicht gefunden</small>"
Zeile 204: Zeile 205:
-- Box um Karte
-- Box um Karte
if com.isTrue(args["box"]) then
if args["box"] then
local headline = args["headline"] or geoobjects.geojson.arg or pagename
local headline = -- Box-Überschrift
args["headline"] or geoobjects.geojson.arg or pagename
t = box.box{headline = headline, content = t, textalign = center}
t = box.box{headline = headline, content = t, textalign = center}
end
end