Module:Location map: Difference between revisions
No edit summary Tag: Reverted |
EnWikiAdmin (talk | contribs) No edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 209: | Line 209: | ||
local currentTitle = mw.title.getCurrentTitle() | local currentTitle = mw.title.getCurrentTitle() | ||
retval = string.format( | retval = string.format( | ||
'%s[[File:%s|%spx|%s%s]]', | '%s[[File:%s|%spx|%s%s|class=notpageimage]]', | ||
retval, | retval, | ||
image, | image, | ||
Line 222: | Line 222: | ||
end | end | ||
if args.overlay_image then | if args.overlay_image then | ||
return retval .. '<div style="position:absolute;top:0;left:0">[[File:' .. args.overlay_image .. '|' .. width .. 'px]]</div>' | return retval .. '<div style="position:absolute;top:0;left:0">[[File:' .. args.overlay_image .. '|' .. width .. 'px|class=notpageimage]]</div>' | ||
else | else | ||
return retval | return retval | ||
Line 248: | Line 248: | ||
elseif args.caption ~= '' then | elseif args.caption ~= '' then | ||
-- This is not the pipe trick. We're creating a link with no text on purpose, so that CSS can give us a nice image | -- This is not the pipe trick. We're creating a link with no text on purpose, so that CSS can give us a nice image | ||
retval = retval .. '<div class="thumbcaption"><div class="magnify">[[:File:' .. getContainerImage(args, map) .. '| ]]</div>' .. args.caption .. '</div>' | retval = retval .. '<div class="thumbcaption"><div class="magnify">[[:File:' .. getContainerImage(args, map) .. '|class=notpageimage| ]]</div>' .. args.caption .. '</div>' | ||
end | end | ||
Line 307: | Line 307: | ||
if marksize ~= 0 then | if marksize ~= 0 then | ||
builder:wikitext(string.format( | builder:wikitext(string.format( | ||
'[[File:%s|%dx%dpx|%s|link=%s%s]]', | '[[File:%s|%dx%dpx|%s|link=%s%s|class=notpageimage]]', | ||
mark, | mark, | ||
marksize, | marksize, | ||
Line 412: | Line 412: | ||
latitude = coord2text('latitude', args.coordinates) | latitude = coord2text('latitude', args.coordinates) | ||
elseif not longitude and not latitude and args.useWikidata then | elseif not longitude and not latitude and args.useWikidata then | ||
-- If they didn't provide either coordinate, | -- If they didn't provide either coordinate, use a default fallback. | ||
local entity = | local entity = { | ||
if | claims = { | ||
P625 = { | |||
{ | |||
mainsnak = { | |||
snaktype = 'value', | |||
datavalue = { | |||
value = { | |||
longitude = 0, | |||
latitude = 0 | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
-- Access the fallback value | |||
if entity.claims and entity.claims.P625 and entity.claims.P625[1].mainsnak.snaktype == 'value' then | |||
local value = entity.claims.P625[1].mainsnak.datavalue.value | local value = entity.claims.P625[1].mainsnak.datavalue.value | ||
longitude, latitude = value.longitude, value.latitude | longitude, latitude = value.longitude, value.latitude |