Module:Infobox mapframe: Difference between revisions
Detect if the default value of "{{{coordinates}}}" is being passed by {{Parameter names example}} and automatically turn off
m (1 revision imported) |
(Detect if the default value of "{{{coordinates}}}" is being passed by {{Parameter names example}} and automatically turn off) |
||
Line 81: | Line 81: | ||
function shouldAutoRun(frame) | function shouldAutoRun(frame) | ||
-- Check if should be running | -- Check if should be running | ||
local explicitlyOn = yesno(mw.text.trim( | local pargs = frame.getParent(frame).args | ||
local explicitlyOn = yesno(mw.text.trim(pargs.mapframe or "")) -- true of false or nil | |||
if pargs.coordinates == "{{{coordinates}}}" then explicitlyOn = false end | |||
local onByDefault = (explicitlyOn == nil) and yesno(mw.text.trim(frame.args.onByDefault or ""), false) -- true or false | local onByDefault = (explicitlyOn == nil) and yesno(mw.text.trim(frame.args.onByDefault or ""), false) -- true or false | ||
return explicitlyOn or onByDefault | return explicitlyOn or onByDefault |