Modul:Location map: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
Tag: Pembatalan |
Hidayatsrf (bicara | kontrib) update (Laporkan galat!) |
||
Baris 1:
require('
local p = {}
local getArgs = require('
local function round(n, decimals)
Baris 14:
error('The name of the location map definition to use must be specified', 2)
end
local moduletitle = mw.title.new('
if not moduletitle then
error(string.format('%q is not a valid name for a location map definition', map), 2)
elseif moduletitle.exists then
local mapData = mw.loadData('
return function(name, params)
if name == nil then
return '
elseif mapData[name] == nil then
return ''
Baris 30:
end
end
elseif mw.title.new('
local cache = {}
if type(frame) ~= 'table' or type(frame.expandTemplate) ~= 'function' then
Baris 40:
else
if name == nil then
return '
elseif cache[name] == nil then
cache[name] = frame:expandTemplate{title = 'Location map ' .. map, args = { name }}
Baris 48:
end
else
error('Unable to find the specified location map definition. Neither "
end
end
Baris 158:
end
local width
local default_as_number = tonumber(mw.ustring.match(tostring(args.default_width),"%d*"))
if not args.width then
width = round((
elseif mw.ustring.sub(args.width, -2) == 'px' then
width = mw.ustring.sub(args.width, 1, -3)
Baris 165 ⟶ 166:
width = args.width
end
local width_as_number = tonumber(mw.ustring.match(tostring(width),"%d*")) or 0;
if width_as_number == 0 then
-- check to see if width is junk. If it is, then use default calculation
width = round((default_as_number or 240) * (tonumber(map('defaultscale')) or 1))
width_as_number = tonumber(mw.ustring.match(tostring(width),"%d*")) or 0;
end
if args.max_width ~= "" and args.max_width ~= nil then
-- check to see if width bigger than max_width
local max_as_number = tonumber(mw.ustring.match(args.max_width,"%d*")) or 0;
if width_as_number>max_as_number and max_as_number>0 then
width = args.max_width;
end
end
local retval = args.float == 'center' and '<div class="center">' or ''
if args.caption and args.caption ~= '' and args.border ~= 'infobox' then
Baris 201 ⟶ 215:
image,
width,
args.alt or ((args.label or mw.title.getCurrentTitle().text) .. '
args.maplink and ('|link=' .. args.maplink) or ''
)
if args.overlay_image then
return retval .. '<div style="position:absolute;top:0;left:0">[[
else
return retval
Baris 231 ⟶ 245:
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
retval = retval .. '<div class="thumbcaption"><div class="magnify">[[:
end
Baris 248 ⟶ 262:
end
mw.logObject(args, 'args')
retval = retval .. '[[Category:Location maps with
end
if map('skew') ~= '' or map('lat_skew') ~= '' or map('crosses180') ~= '' or map('type') ~= '' then
mw.log('Removed parameter used in map definition ' .. map())
local key = (map('skew') ~= '' and 'skew' or '') ..
retval = retval .. '[[Category:Location maps with possible errors|Map using removed parameter]]'▼
(map('lat_skew') ~= '' and 'lat_skew' or '') ..
(map('crosses180') ~= '' and 'crosses180' or '') ..
(map('type') ~= '' and 'type' or '')
▲ retval = retval .. '[[Category:Location maps with
end
if string.find(map('name'), '|', 1, true) then
mw.log('Pipe used in name of map definition ' .. map())
retval = retval .. '[[Category:Location maps with
end
if args.float == 'center' then
Baris 277 ⟶ 295:
if marksize ~= 0 then
builder:wikitext(string.format(
'[[
mark,
marksize,
Baris 337 ⟶ 355:
function p.mark(frame, args, map)
if not args then
args = getArgs(frame, {wrappers = '
end
if not map then
Baris 385 ⟶ 403:
end
mw.logObject(args, 'args')
local key = (args.skew and 'skew' or '') ..
builder:wikitext('[[Category:Location maps with possible errors|Page using removed parameter]]')▼
(args.lon_shift and 'lon_shift' or '') ..
(args.markhigh and 'markhigh' or '')
▲ builder:wikitext('[[Category:Location maps with
end
if map('x') ~= '' then
Baris 404 ⟶ 425:
end
mw.logObject(args, 'args')
local key = frame:preprocess('{{FULLPAGENAME}}')
builder:wikitext('[[Category:Location maps with
end
local mark = args.mark or map('mark')
Baris 431 ⟶ 453:
function p.main(frame, args, map)
if not args then
args = getArgs(frame, {wrappers = '
end
if args.useWikidata == nil then
|